#!/bin/shgatewayIP=$(netstat -4rn | grep default | awk '{print $2}')wanInterface="em0"echo "Gateway: $gatewayIP"echo "WAN Interface: $wanInterface"if [ -z $gatewayIP ]then echo "NO Gateway" #Bring the interface down then up to renew the WAN DHCP ifconfig $wanInterface down ifconfig $wanInterface upelse # if return = 0 then host is reachable ping -c 1 $gatewayIP > /dev/null if [ $? -eq 0 ] then echo "Gateway Reachable" else echo "Gateway Unreachable" #Bring the interface down then up to renew the WAN DHCP ifconfig $wanInterface down ifconfig $wanInterface up fifi
I just started to use opnsense, run all updates and also get similar issue. Re-boot helped initially but second time around then ISP renewed the IP lease, I have lost ability to connect to https port 443. Not sure if this is related. I was still able to ping DNS or ip entries on the internet. I had switched back to my TPLink router and noticed that my new IP lease is completely different to what the Opnsense had. So either i got new IP or Opnsense did not update properly.