SpiderX wrote:
> 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
> <shantanugad...@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 <spid...@spiderx.dp.ua> wrote:
>>
>>> From: SpiderX <spid...@spiderx.dp.ua>
>>> Subject: [Dnsmasq-discuss] DHCP Relay, assign address from other vlan, with 
>>> no dhcp listening on it
>>> To: dnsmasq-discuss@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@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@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@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?


I think what's happening is that the relay adds its 172.... address to
the relayed DHCP packet, so dnsmasq has to allocate an address on that
network. To fix this you need to configure the relay to add a "subnet
selector" for the 10.... network. Dnsmasq supports both RFC3011 and
RFC3527 subnet selectors, so reading those RFCs and the documentation
for the DHCP-relay would be a good starting place.


Cheers,

Simon.

Reply via email to