diff --git a/content/post/opnsense-virtualizaton-highly-available.md b/content/post/opnsense-virtualizaton-highly-available.md index b3e1449..aabd715 100644 --- a/content/post/opnsense-virtualizaton-highly-available.md +++ b/content/post/opnsense-virtualizaton-highly-available.md @@ -213,9 +213,61 @@ Now I can safely sync my services like described above, this will only propagate The last thing I need to configure is the WAN interface, my ISP box is only giving me one IP address over DHCP, I don't want my 2 VMs compete to claim it. To handle that, I will give my 2 VMs the same MAC for the WAN interface, then I need to find a solution to enable the WAN interface only on the master node. -In Proxmox WebGUI, I copy the MAC address of the net0 interface (*POC WAN*) from `poc-opnsense-1` and paste it to the one in `poc-opnsense-2`. +In the Proxmox WebGUI, I copy the MAC address of the net0 interface (*POC WAN*) from `poc-opnsense-1` and paste it to the one in `poc-opnsense-2`. + +To handle the activation of the WAN interface on the master node while deactivating the backup, I could use a script. On CARP event, scripts located in `/usr/local/etc/rc.syshood.d/carp` are played. I found this [Gist](https://gist.github.com/spali/2da4f23e488219504b2ada12ac59a7dc#file-10-wancarp) which is exactly what I wanted. + +I copy this script in `/usr/local/etc/rc.syshood.d/carp/10-wan` on both nodes: +```php +#!/usr/local/bin/php +