I'm almost done with my VRRP setup, and in a few days i'll be ready to share my experience on the wiki.
Unfortunately there is still one single issue.
Is there a way to disable DHCP on a device through the CLI?
I want to execute it through a notify_master and notify_backup script.
It's being executed, but i can't see any change in the DHCP behaviour.
Is there something i'm missing?
Thanks in advance!
logger "Running BACKUP Script.."
uci set dhcp.lan.ignore="1"
uci commit dhcp
Looks right to me if with "disable DHCP" you mean "stop provding DHCP leases".
Exactly! Unfortunately my script is not achieving this goal.
Try putting the following in
/etc/rc.local to prevent updates from re-adding the DHCP services.
for i in dnsmasq odhcpd; do
if /etc/init.d/"$i" enabled; then
The script will disable handing out dhcpv4 and stop odhcpd. If the router restarts RA and dhcpv6 will start working again. Also it will stop nameserver from working, not sure if you want that.
What is not working exactly?
What i want to achieve with my script, is to only disable the distribution of DHCP leases, DNS should keep running.
Unfortunately dnsmasq keeps handing out DHCP leases.
uci set dhcp.lan.ignore='1'
uci commit dhcp
This will work and not cause collateral damage.
How did you troubleshoot?
If you run the script by yourself does it work?
If you call it from another application, does it actually run?
Another thing to realize is that disabling the DHCP server does not revoke existing DHCP leases. It simply stops the server from allocating new leases. Therefore, the clients that already have leases will continue to use their assigned IP addresses until the lease expires. By default, the lease time is 12 hours. You can obviously force the issue by releasing/renewing the leases on the client machines.
Good point by @psherman . You can't expect to release the already allocated addresses when you stop dhcpd.
When a client tries to renew, it'll offer its ciaddr (current address). The server can extend the lease or refuse to renew that lease and offer a new one. In both cases the server assignment table should be updated.
By default clients will start trying to renew leases with the original server at T1 (0.5 * duration_of_lease). At T2 (0.875 * duration_of_lease) it will start sending broadcasts.
You could have the servers offer different ranges. One could do 192.168.10.100-149, the other can do 192.168.10.150-199, etc.