[Dnsmasq-discuss] Restrict DHCP providing default gateway to *one* host on one network

Simon Kelley simon at thekelleys.org.uk
Mon Apr 22 09:18:35 BST 2013


On 19/04/13 19:59, Willard Dennis wrote:
>
>
> Hi all,
>
>
>
> Trying to do something with dnsmasq that I believe is
> possible, but I cannot get it to work... First, please take a look at my
> topology
>
> diagram:
>
>
>
> http://s1096.photobucket.com/user/willdennis/media/testbed_topology_diagram.png.html
>
>
>
> My problem is with the "WANem VM" host. It is
> connected to the two LANs, and I want the "10-net" interface to get a
> specific IP assigned, as well as a default gateway (this is working.) The
> problem is, I want the other NIC to get an IP assigned (which is working), but,
> NO default gateway set for that NIC. So the state I want to end up with is:
>
> Eth0 ("10-net") ->  specific IP address
> assigned, has default gateway set (same as all other hosts on that network that
> use DHCP)
>
> Eth1 ("20-net") ->  pool IP address assigned,
> NO default gateway set (unlike the other hosts on this network that use DHCP,
> which all need a default gateway assigned)
>
>
>
> Right now, the eth1 on the WANem host IS getting a
> default gateway assigned, which leads to this host having two default paths
> out:
>
>
>
> Destination         Gateway                  Genmask             Flags      Metric   Ref     Use      Iface
>
>
>
> <netroutes redacted>
>
> 0.0.0.0                   192.168.10.254     0.0.0.0                   UG         0           0         0           eth0
>
> 0.0.0.0                   192.168.20.254     0.0.0.0                   UG         0           0         0           eth1
>
>
>
> This is causing a reachability problem with this host.
>
>
>
> Here are the active stanzas in dnsmasq.conf currently:
>
>
>
> interface=vl10-ovsbr0
>
> interface=vl20-ovsbr0
>
> bind-interfaces
>
> dhcp-range=vl10-ovsbr0,192.168.10.50,192.168.10.150,4h
>
> dhcp-range=vl20-ovsbr0,192.168.20.50,192.168.20.150,4h
>
> dhcp-host=52:54:00:d5:ee:4d,id:*,192.168.10.1
>
> dhcp-mac=set:wanem-20,52:54:00:45:8c:6a
>
> dhcp-option=vl10-ovsbr0,3,192.168.10.254
>
> dhcp-option=vl20-ovsbr0,3,192.168.20.254
>
> dhcp-option=net:wanem-20,3
>
>
>
> I'm sure it's a simple config change, but I cannot seem
> to figure it out... If someone could help me out here, I'd sure appreciate
> it...
>
>

You're right , the change is simple. You just have to make the second 
dhcp-option line NOT apply to you wanem-20 host, so

dhcp-option=vl20-ovsbr0,3,192.168.20.254

becomes

dhcp-option=tag:vl20-ovsbr0,tag:!wanem-20,3,192.168.20.254

The above uses the newer tag syntax, and assumes your copy of dnsmasq is 
not ancient. If it's earlier than 2.53, then you need

dhcp-option=vl20-ovsbr0,#wanem-20,3,192.168.20.254


Cheers,

Simon.







More information about the Dnsmasq-discuss mailing list