opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.28k stars 727 forks source link

Add cli command to reload interface #3805

Closed definitio closed 4 years ago

definitio commented 4 years ago

Is your feature request related to a problem? Please describe. I have a usb LTE modem that hangs sometimes. There is solution: reset device via usbconfig reset and reload interface via GUI. I want to automate it with Monit, but configctl interface reconfigure <interface_name> doesn't work as expected for me.

Describe the solution you'd like I would like to have a command like configctl interface reload <interface_name> that acts as reload button from Interfaces: Overview.

Additional context Forum thread: https://forum.opnsense.org/index.php?topic=14848.0

AdSchellevis commented 4 years ago

reload fires configctl interface reload...

https://github.com/opnsense/core/blob/b2560c6eb46e2739a33c8e761db2b9efe541b776/src/www/status_interfaces.php#L118

---[POSTs submit=remote]>

https://github.com/opnsense/core/blob/b2560c6eb46e2739a33c8e761db2b9efe541b776/src/www/status_interfaces.php#L38-L40

definitio commented 4 years ago

I see but configctl interface reconfigure <interface_name> is not enough, the interface is still down after running command. Looks like I found solution. There are dhclient and /usr/local/etc/rc.newwanip in the sytem log after pressing reload button. configctl interface reconfigure <interface_name> && dhclient <interface_name> && configctl interface newip <interface_name> works for me after manual modem disconnection. Thanks for help!

x90skysn3k commented 2 years ago

I know this is closed but following up because I had the same exact issue, however you script did not help get my IPv6 interface back up. So I utilized these commands which fixed my issue. /usr/local/sbin/configctl interface linkup stop <interface> && /usr/local/sbin/configctl interface reconfigure <interface> && /usr/local/sbin/configctl interface linkup start <interface>