Proper way to perform the dhcp release/renew via script?
-
The webui has function under Status/Interfaces/WAN to release WAN and perform renew.
What is the command line equivalent of this to use in script?
/etc/rc.d/dhclient forcerestart igb0
/etc/rc.linkup stop igb0
/etc/rc.linkup start igb0I notice ipv6 does not restart properly with dhclient forcerestart.
To bypass my isp's (att) gateway box, I'm using wpa_supplicant to handle 802.1x eapol auth. This runs at boot and appears to be generally stable.
With my old firewall I had a cron task that ran every 10 minutes to verify connectivity and kill/restart the wpa_supplicant if it was unresponsive. Part of the script was to initiate a dhcp renew once eapol authorized successfully.
-
It does this:
if ($_POST['ifdescr'] && $_POST['submit']) { $interface = $_POST['ifdescr']; if ($_POST['status'] == "up") { if ($_POST['relinquish_lease']) { dhcp_relinquish_lease($_POST['if'], $_POST['ifdescr'], $_POST['ipv']); } interface_bring_down($interface); restart_interface_services($interface); filter_configure(); system_routing_configure(); send_event("service reload packages"); } else { interface_configure($interface); } header("Location: status_interfaces.php"); exit; }
So you could just include those php functions in your script.
I would probably try rc.linkup stop and start as you showed though. That will likely run a bunch of other things but if it doesn't cause an issue I'd go with it.
-
@stephenw10 The original script is in bash, but is fairly simple so should be easily adaptable to tcsh.
I know lots of other folks with similar configurations don't even bother with a watchdog script for wpa_supplicant. This is fine if it works. I rather have something in there that ensures there's network connectivity and the supplicant is not stalled.