<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
option routers in the host statement works. I've used it several
times.<br>
If there are many you may want to use a group:<br>
<font color="#804000"><tt>group "IKnowEwe" {</tt><tt><br>
</tt><tt> option routers 192.168.1.21; # group</tt><tt><br>
</tt><tt> host backup-pc { hardware ethernet
00:24:99:33:b3:b3; } # backup-pc</tt><tt><br>
</tt></font><font color="#804000"><tt><font color="#804000"><tt>
host backup-pc2 { hardware ethernet 00:24:99:33:b3:b4;
} # backup-pc</tt><tt><br>
.<br>
.<br>
</tt></font>}</tt><tt><br>
</tt><tt><br>
</tt></font>You can use tcpdump on the DHCP server to see what
options are asked for and<br>
what options are sent:<br>
<font color="#804000"><tt>tcpdump -vv -e -n -i eth0 portrange 67-68</tt><tt><br>
</tt></font>Make sure the clients are asking for and receiving
option 3.<br>
<br>
My DNS runs on my gateway server and I force all devices to use my
DNS with<br>
iptables. In the nat table:<br>
<font color="#804000"><tt>REDIRECT tcp -- * *
192.168.1.0/24 0.0.0.0/0 tcp dpt:53 /* domain inet
*/ redir ports 53</tt><tt><br>
</tt><tt>REDIRECT udp -- * * </tt></font><font
color="#804000"><tt><font color="#804000"><tt>192.168.1.0</tt></font>/24
0.0.0.0/0 udp dpt:53 /* domain inet */ redir ports
53</tt><tt><br>
</tt></font><br>
Bill<br>
<br>
<div class="moz-cite-prefix">On 7/25/2020 10:23 AM, Alexis Huxley
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:20200725142315.q7kwftwborfn62co@sugo.pasta.net">
<pre class="moz-quote-pre" wrap="">Hi, I have dhcpd.conf at home containing:
host { ... }
...
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option domain-name "pasta.net";
option domain-name-servers 192.168.1.21;
option ntp-servers time.pasta.net;
# 1-100 are reserved for statically configured hosts.
# 101-150 are reserved for known dynamic hosts (known because they're in host stanzas above).
# e.g. my Android phone on wifi.
pool {
range 192.168.1.101 192.168.1.150;
allow known-clients;
deny unknown-clients;
}
# 151-200 are for unknown dynamic hosts. e.g. visitors' phones on wifi.
pool {
range 192.168.1.151 192.168.1.200;
allow unknown-clients;
deny known-clients;
}
}
This works fine.
I now want to force 'known dynamic hosts'' to use a different gateway.
(In case you're curious: Since, when using wifi, my Android
phone silently refuses to use the DNS server proposed by the above
dhcpd.conf, I now want to change the phone's gateway to a masqueraing
Linux box, where I can hopefully use iptables to force the phone to
use the DNS server proposed by the DHCP server, and thereby block ads.)
The dhcpd.conf man page says:
In general, any parameter can appear anywhere that parameters
are allowed, and will be applied according to the scope in which
the parameter appears.
and I don't see anything special documented about 'option routers'.
So I thought this should work:
subnet 192.168.1.0 netmask 255.255.255.0 {
#option routers 192.168.1.1; <--- commented out at subnet level
...
pool {
range 192.168.1.101 192.168.1.150;
...
option routers 192.168.1.32; <--- this is the different gateway
}
pool {
range 192.168.1.151 192.168.1.200;
...
option routers 192.168.1.1; <--- this is the original gateway
}
but it looks like *no* host gets told its gateway.
To confirm that it wasn't a problem with my new gateway itself, I
put the original gateway in *both* pools, i.e. only the *location* of
the router declaration changes compared to the original configuration:
subnet 192.168.1.0 netmask 255.255.255.0 {
#option routers 192.168.1.1; <--- commented out at subnet level
...
pool {
range 192.168.1.101 192.168.1.150;
...
option routers 192.168.1.1; <--- this is the original gateway
}
pool {
range 192.168.1.151 192.168.1.200;
...
option routers 192.168.1.1; <--- this is the original gateway
}
The result was the same: no gateway.
My googles didn't turn up anything relevant and my experiments (using
'groups' failed), so any advice would be appreciated. I'm using
isc-dhcp-server 4.4.1 on Debian 10. Thanks!
Alexis
_______________________________________________
ISC funds the development of this software with paid support subscriptions. Contact us at <a class="moz-txt-link-freetext" href="https://www.isc.org/contact/">https://www.isc.org/contact/</a> for more information.
dhcp-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dhcp-users@lists.isc.org">dhcp-users@lists.isc.org</a>
<a class="moz-txt-link-freetext" href="https://lists.isc.org/mailman/listinfo/dhcp-users">https://lists.isc.org/mailman/listinfo/dhcp-users</a>
</pre>
</blockquote>
</body>
</html>