[Dnsmasq-discuss] DHCP Relay, assign address from other vlan, with no dhcp listening on it

Michael Rack michael.rack at rsm-freilassing.de
Mon Sep 12 08:47:58 BST 2011


Hi Vladimir,

can you more explain your network-setup?

The Problem with dhcp-relay is, that dnsmasq trys to find a address 
within the dhcp-relay its ip-address.

So, when the DHCP-Relay have the IP-Address 192.168.0.2/24, dnsmasq trys 
to allocate a ip within the dhcp-range 192.168.0.0/24. If there is no 
dhcp-range=192.168.0.100,192.168.0.250,255.255.255.0,192.168.0.255,5h 
defined, dnsmasq is not able to find any free ip-address.

You can not use tags! That is a problem besides the programm layout. 
DNSMASQ first try to find a dhcp-range, if there is no range available, 
dnsmasq quits with "no address available".

I had to modify my DHCP-Relay-Programm to implement the feature "IPv4 
Subnet Selection Option" http://tools.ietf.org/html/rfc3011

My dhcp-relay (dhcp-forwarder is listning on 172.16.1.8/24) adds that 
"Subnet Selection Option"-option to tell dnsmasq to assign ip-addresses 
from the dhcp-range 192.168.0.0/24 instead of 172.16.1.0/24.

Your Layer2-Switch is surely not able to add this DHCP-Information to 
the DISCOVER-Message, so dnsmasq is not the right DHCP-Server for you. 
Your DHCP-Server have to choose the dhcp-range from the information 
"dhcp-circuitid".


But, why are you using DHCP-Relay on your VLAN-Layer2-Switch?
Is your VLAN transparent switched from your DNSMASQ-Box to your client?
Let DNSMASQ listen on vlan2 and add a dhcp-range for this interface.

Liebe Grüße aus Freilassing,

Michael Rack
RSM Freilassing
-- 
RSM Freilassing                 Tel.: +49 8654 607110
Nocksteinstr. 13                Fax.: +49 8654 670438
D-83395 Freilassing            www.rsm-freilassing.de


Am 12.09.2011 09:17, schrieb SpiderX:
> Thanks for reply.
> I have just tried this.
> conflg:
> #dhcp-range=tag:vlan-2-port-16,10.1.2.2,10.1.2.245,255.255.255.0,10.1.2.255,10m
> #dhcp-range=tag:#vlan-2-port-16,172.16.33.2,172.16.33.249,255.255.255.0,10m
> dhcp-host=48:5b:39:36:a2:73,10.1.2.100
>
> Absolutely nothing happened with such config, dnsmasq did nothing.
> I saw DHCPDISCOVER in vlan1033 at the same time.
> When I commented out 'dhcp-range=tag:#vlan-2-port-16,172.16.33.2....',
> dnsmasq tried assign address from
> range 172.16.33.2-172.16.33.249.
> log:
> Sep 12 13:00:45 dnsmasq-dhcp[11194]: 2517313542 available DHCP range:
> 172.16.33.2 -- 172.16.33.249
> Sep 12 13:00:45 dnsmasq-dhcp[11194]: 2517313542 client provides name: laptop
> Sep 12 13:00:45 dnsmasq-dhcp[11194]: 2517313542 DHCPDISCOVER(vlan1033)
> 172.16.33.121 48:5b:39:36:a2:73 no address available
> Sep 12 13:00:48 dnsmasq-dhcp[11194]: 2517313542 available DHCP range:
> 172.16.33.2 -- 172.16.33.249
> Sep 12 13:00:48 dnsmasq-dhcp[11194]: 2517313542 client provides name: laptop
> Sep 12 13:00:48 dnsmasq-dhcp[11194]: 2517313542 DHCPDISCOVER(vlan1033)
> 172.16.33.121 48:5b:39:36:a2:73 no address available
>
> With such results I assume that dhcp relay with dnsmasq don't work at all.
> Any ideas?
>
> On Sat, Sep 10, 2011 at 11:09 PM, Shantanu Gadgil
> <shantanugadgil at yahoo.com>  wrote:
>> Hi Vladimir,
>> I assume you have tried with a simpler setup:
>> *without tags in the range part*.
>> Use the 'static' dhcp range method to assign the IPs based on mac address.
>>
>> Regards,
>> Shantanu
>>
>> --- On Sat, 9/10/11, SpiderX<spiderx at spiderx.dp.ua>  wrote:
>>
>>> From: SpiderX<spiderx at spiderx.dp.ua>
>>> Subject: [Dnsmasq-discuss] DHCP Relay, assign address from other vlan, with no dhcp listening on it
>>> To: dnsmasq-discuss at lists.thekelleys.org.uk
>>> Date: Saturday, September 10, 2011, 2:58 PM
>>> Hello, my name is Vladimir.
>>> I'm trying to setup dnsmasq to work in DHCP Relay (RFC3046)
>>> environment.
>>> Compiled with tftp, dhcp support and without dbus, ipv6,
>>> idn.
>>>
>>> topology:
>>> client (dhcp,10.1.2.0/24) — l2 switch (172.16.33.50) —
>>> server with
>>> dnsmasq (172.16.30.252)
>>>
>>> server:
>>> ip a:
>>> 5: vlan0002 at eth1:<BROADCAST,MULTICAST,UP,LOWER_UP>
>>> mtu 1500 qdisc
>>> noqueue state UP
>>>      link/ether 00:1e:67:02:ad:6a brd
>>> ff:ff:ff:ff:ff:ff
>>>      inet 10.1.2.250/24 brd 10.1.2.255 scope
>>> global vlan0002
>>> 6: vlan0003 at eth1:<BROADCAST,MULTICAST,UP,LOWER_UP>
>>> mtu 1500 qdisc
>>> noqueue state UP
>>>      link/ether 00:1e:67:02:ad:6a brd
>>> ff:ff:ff:ff:ff:ff
>>>      inet 10.1.3.250/24 brd 10.1.3.255 scope
>>> global vlan0003
>>> ..........lots of vlan......
>>> 88: vlan1033 at eth1:<BROADCAST,MULTICAST,UP,LOWER_UP>
>>> mtu 1500 qdisc
>>> noqueue state UP
>>>      link/ether 00:1e:67:02:ad:6a brd
>>> ff:ff:ff:ff:ff:ff
>>>      inet 172.16.33.252/24 scope global vlan1033
>>> sysctl:
>>> net.ipv4.ip_forward=1
>>>
>>> config:
>>> dhcp-circuitid=set:vlan-2-port-16,00:04:00:02:00:10
>>> dhcp-option=option:router,10.1.2.250
>>> dhcp-range=tag:vlan-2-port-16,10.1.2.2,10.1.2.245,255.255.255.0,10.1.2.255,10m
>>> dhcp-range=tag:#vlan-2-port-16,172.16.33.2,172.16.33.249,255.255.255.0,10m
>>> dhcp-leasefile=/var/lib/misc/dnsmasq.leases
>>> dhcp-authoritative
>>> log-dhcp
>>> log-facility=/var/log/dnsmasq.log
>>>
>>> log:
>>> Sep 10 14:37:28 dnsmasq[20380]: started, version 2.58
>>> cachesize 150
>>> Sep 10 14:37:28 dnsmasq[20380]: compile time options:
>>> no-IPv6
>>> GNU-getopt no-DBus i18n DHCP TFTP no-conntrack IDN
>>> Sep 10 14:37:28 dnsmasq-dhcp[20380]: DHCP, IP range
>>> 172.16.33.2 --
>>> 172.16.33.249, lease time 10m
>>> Sep 10 14:37:28 dnsmasq-dhcp[20380]: DHCP, IP range
>>> 10.1.2.2 --
>>> 10.1.2.245, lease time 10m
>>> Sep 10 14:37:28 dnsmasq[20380]: reading /etc/resolv.conf
>>> Sep 10 14:37:28 dnsmasq[20380]: using nameserver
>>> 91.193.69.4#53
>>> Sep 10 14:37:28 dnsmasq[20380]: bad address at /etc/hosts
>>> line 2
>>> Sep 10 14:37:28 dnsmasq[20380]: read /etc/hosts - 1
>>> addresses
>>> Sep 10 14:37:39 dnsmasq-dhcp[20380]: 3769651775 available
>>> DHCP range:
>>> 172.16.33.2 -- 172.16.33.249
>>> Sep 10 14:37:39 dnsmasq-dhcp[20380]: 3769651775 client
>>> provides name: laptop
>>> Sep 10 14:37:39 dnsmasq-dhcp[20380]: 3769651775
>>> DHCPDISCOVER(vlan1033)
>>> 172.16.33.121 48:5b:39:36:a2:73 no address available
>>> Sep 10 14:37:44 dnsmasq-dhcp[20380]: 3769651775 available
>>> DHCP range:
>>> 172.16.33.2 -- 172.16.33.249
>>> Sep 10 14:37:44 dnsmasq-dhcp[20380]: 3769651775 client
>>> provides name: laptop
>>> Sep 10 14:37:44 dnsmasq-dhcp[20380]: 3769651775
>>> DHCPDISCOVER(vlan1033)
>>> 172.16.33.121 48:5b:39:36:a2:73 no address available
>>>
>>> So, dnsmasq got a DHCPDISCOVER message in vlan1033 with
>>> option82 that
>>> match tag vlan-2-port-16.
>>> Client doesn't get a lease because of 'tag:#vlan-2-port-16'
>>> in last
>>> dhcp-range, that's why I assume that tag vlan-2-port-16 is
>>> matched.
>>> The problem is dnsmasq completely ignore first range
>>> 'tag:vlan-2-port-16,10.1.2.2....', and always try to assign
>>> address
>>> from range 172.16.33.0/24.
>>> I think that happends because there is not ip address from
>>> network
>>> 10.1.2.0/24 on vlan1033 unlike ip address 172.16.33.252.
>>> So, I assume that dnsmasq assigns address from ranges that
>>> match ip
>>> addresses on interfaces dhcp packets come from.
>>> How dhcp relay supposed to work with such dnsmasq
>>> behavior?
>>>
>>> _______________________________________________
>>> Dnsmasq-discuss mailing list
>>> Dnsmasq-discuss at lists.thekelleys.org.uk
>>> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>>>
>> _______________________________________________
>> Dnsmasq-discuss mailing list
>> Dnsmasq-discuss at lists.thekelleys.org.uk
>> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> _______________________________________________
> 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