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?