[Dnsmasq-discuss] how to push static routes to DHCP clients

Jochen Schulz ml at well-adjusted.de
Sun Jan 15 20:59:35 GMT 2006

Simon Kelley:
> Jochen Schulz wrote:
>> dhcp-option=wifi,33,,
> Your configuration looks fine, and should work. The problem is almost 
> certainly with your DHCP client, not the server.

You are correct. When I add 'static-routes' to the 'request' stanza in
my dhclient.conf, I receive the route.

> What client are  you using? The ISC dhclient  can be configured to 
> request an option in dhclient.conf, and I guess the host-configuratoin 
> script would need to be modified to get the value of the option and run 
> the correct "route add" command.

Correct. I found out that you can write custom scripts which dhclient
executes at certain points if operation. I created the file
/etc/dhclient-exit-hooks which contains this:

if [ $reason == "BOUND" ] || [ $reason == "REBOOT" ]
        host=$(echo $new_static_routes | awk '{ print $1 }')
        gw=$(echo $new_static_routes | awk '{ print $2 }')
        route add -host $host gw $gw

dhclient executes this after getting a lease and apparently it works in
my case. Of course it's not well tested and I am a poor shell

Thanks a lot, Simon. Not only for developing and maintaining dnsmasq,
but also for your prompt support.

In idle moments I remember former lovers with sentimental tenderness.
[Agree]   [Disagree]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20060115/89c70cfb/attachment.pgp

More information about the Dnsmasq-discuss mailing list