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

Simon Kelley simon at thekelleys.org.uk
Tue Apr 23 09:50:39 BST 2013


On 22/04/13 17:29, Will Dennis (Live.com) wrote:
> I did also just do a tcpdump and captured the DHCP packets when the WANem
> machine comes up - see http://pastebin.com/KS2feuDQ for the tcpdump output.
>
> On line 61 on the pastebin, I see that dnsmasq is still sending a default
> gateway in the DHCP offer...
>
> Thanks,
> Will
>
> -----Original Message-----
> From: Will Dennis (Live.com) [mailto:willarddennis at live.com]
> Sent: Monday, April 22, 2013 11:52 AM
> To: 'Simon Kelley'; 'dnsmasq-discuss at lists.thekelleys.org.uk'
> Subject: RE: [Dnsmasq-discuss] Restrict DHCP providing default gateway to
> *one* host on one network
>
> Thanks, Simon, for your help -- I am running v2.59 on the hypervisor host
> (dnsmasq package provided by Ubuntu 12.04.)
>
> I did implement the
> "dhcp-option=tag:vl20-ovsbr0,tag:!wanem-20,3,192.168.20.254" stanza as you
> provided in place of the former "dhcp-option=vl20-ovsbr0,3,192.168.20.254"
> that was there before (also deleted the " dhcp-option=net:wanem-20,3" stanza
> as well) but the WANem VM is still getting a default gateway on the NIC
> connected to vl20-ovsbr0 (net-20 interface.) Is the tagging syntax correct
> in the stanza "dhcp-mac=set:wanem-20,52:54:00:45:8c:6a"? (I have confirmed
> that the MAC is correct.)

Add

log-dhcp

to your configuration. Amongst other useful information, that will tell 
you exactly what options are being sent, and the tags which are set 
during any DHCP transaction. Both of these will help trace the problem.


Cheers,

Simon.

>
> Thanks,
> Will
>
> -----Original Message-----
> From: dnsmasq-discuss-bounces at lists.thekelleys.org.uk
> [mailto:dnsmasq-discuss-bounces at lists.thekelleys.org.uk] On Behalf Of Simon
> Kelley
> Sent: Monday, April 22, 2013 4:19 AM
> To: dnsmasq-discuss at lists.thekelleys.org.uk
> Subject: Re: [Dnsmasq-discuss] Restrict DHCP providing default gateway to
> *one* host on one network
>
> 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_di
>> agram.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.
>
>
>
>
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
>




More information about the Dnsmasq-discuss mailing list