WAN interface fails to reconnect after outage

Started by andre.lackmann, April 14, 2023, 12:25:56 AM

Previous topic - Next topic
More recent versions of OPNsense appears to have an issue reconnecting the WAN interface after an outage from our provider. I'm using a cable modem that provides DHCP ethernet. In the past I've simply rebooted OPNsense and everything would return to normal. OPNSense is setup as our home gateway, so this solution isn't very wife friendly when I'm away, so it would be ideal if it fixed itself.

I've done some forum digging, and others have put in crontasks to toggle the WAN interface (this and this). When this occurred yday, I tried doing this manually and it didn't work, as the interface ALREADY had the correct DHCP ip address from my provider so nothing really changed.

Doing some more digging, I found the running a RENEW from the Interfaces / Overview / WAN interface page DID solve the issue, with the following in the logs:


2023-04-13T19:33:20   Notice   opnsense   /usr/local/etc/rc.newwanip: Resyncing OpenVPN instances for interface WAN.   
2023-04-13T19:33:20   Notice   opnsense   /usr/local/etc/rc.newwanip: plugins_configure vpn (execute task : openvpn_configure_do(,wan))   
2023-04-13T19:33:20   Notice   opnsense   /usr/local/etc/rc.newwanip: plugins_configure vpn (execute task : ipsec_configure_do(,wan))   
2023-04-13T19:33:20   Notice   opnsense   /usr/local/etc/rc.newwanip: plugins_configure vpn (,wan)   
2023-04-13T19:33:19   Notice   opnsense   /usr/local/etc/rc.newwanip: plugins_configure monitor (execute task : dpinger_configure_do(,WAN_DHCP6))   
2023-04-13T19:33:19   Notice   opnsense   /usr/local/etc/rc.newwanip: plugins_configure monitor (,WAN_DHCP6)   
2023-04-13T19:33:19   Notice   opnsense   /usr/local/etc/rc.newwanip: ROUTING: keeping current default gateway '159.196.116.1'   
2023-04-13T19:33:19   Notice   opnsense   /usr/local/etc/rc.newwanip: ROUTING: setting IPv4 default route to 159.196.116.1   
2023-04-13T19:33:19   Notice   opnsense   /usr/local/etc/rc.newwanip: ROUTING: IPv4 default gateway set to wan   
2023-04-13T19:33:19   Notice   opnsense   /usr/local/etc/rc.newwanip: ROUTING: entering configure using 'wan'   
2023-04-13T19:33:19   Notice   opnsense   /usr/local/etc/rc.newwanip: IP renwal starting (new: 159.196.119.169, old: , interface: WAN[wan], device: vtnet2)   
2023-04-13T19:33:19   Notice   opnsense   /status_interfaces.php: plugins_configure monitor (execute task : dpinger_configure_do(,WAN_DHCP6))   
2023-04-13T19:33:19   Notice   opnsense   /status_interfaces.php: plugins_configure monitor (,WAN_DHCP6)   
2023-04-13T19:33:19   Notice   opnsense   /status_interfaces.php: ROUTING: setting IPv4 default route to 159.196.116.1   
2023-04-13T19:33:19   Notice   opnsense   /status_interfaces.php: ROUTING: IPv4 default gateway set to wan   
2023-04-13T19:33:19   Notice   opnsense   /status_interfaces.php: ROUTING: entering configure using 'wan'   
2023-04-13T19:33:19   Notice   dhclient   Creating resolv.conf   
2023-04-13T19:33:19   Notice   dhclient   New Routers (vtnet2): 159.196.116.1   
2023-04-13T19:33:19   Notice   dhclient   New Broadcast Address (vtnet2): 159.196.119.255   
2023-04-13T19:33:19   Notice   dhclient   New Subnet Mask (vtnet2): 255.255.252.0   
2023-04-13T19:33:19   Notice   dhclient   New IP Address (vtnet2): 159.196.119.169



This line in particular suggests OPNsense didn't think there was ANY IP address associated with the WAN link.

2023-04-13T19:33:19   Notice   opnsense   /usr/local/etc/rc.newwanip: IP renwal starting (new: 159.196.119.169, old: , interface: WAN[wan], device: vtnet2)   

FWIW I have setup a Monitor IP for the Gateway. When returning from an outage, this shows as Online so it appears as OPNsense is aware the connection has returned but doesn't refresh the interface properly and so no routes are refreshed.

Digging further, it appears I can use the CLI to automate the renewal process, by running `configctl interfaces reconfigure wan` either by cron or manually. I CAN do that - but why is OPNsense not doing this automatically? Is this a bug OR am I missing some config somewhere?

This annoys me as well.  Have you found a solution besides CRON?