4

I have a network of Windows 10 machines served (DNS and DHCP) by a dnsmasq instance on a Ubuntu server (Ubuntu 15.10, dnsmasq 2.75). The setup basically works (dnsmasq provides addresses and manages DNS requests correctly) except for one specific case.

I wanted to provide a specific DNS server to one particular machine. I used the tag option in dnsmasq:

# open zone
dhcp-host=84:3a:4b:20:94:f0,set:open

# DNS for everyone = OpenDNS
dhcp-option-force=option:dns-server,208.67.222.222,208.67.220.220
# DNS for open = Google
dhcp-option-force=tag:open,option:dns-server,8.8.8.8,8.8.4.4

Upon ipconfig /renew on the client, the correct options are sent by dnsmasq:

root@srv ~# dnsmasq -d
dnsmasq: started, version 2.75 cachesize 150
dnsmasq: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify
dnsmasq: reading /etc/resolv.conf
dnsmasq: using nameserver 192.168.0.254#53
dnsmasq-dhcp: DHCP, IP range 10.10.10.20 -- 10.10.10.100, lease time 5d
dnsmasq: cleared cache
dnsmasq-dhcp: 342453732 available DHCP range: 10.10.10.20 -- 10.10.10.100
dnsmasq-dhcp: 342453732 vendor class: MSFT 5.0
dnsmasq-dhcp: 342453732 client provides name: helloworld.example.com
dnsmasq-dhcp: 342453732 DHCPREQUEST(lan0) 10.10.10.21 84:3a:4b:20:94:f0
dnsmasq-dhcp: 342453732 tags: open, known, lan0
dnsmasq-dhcp: Ignoring domain example.com for DHCP host name helloworld
dnsmasq-dhcp: 342453732 DHCPACK(lan0) 10.10.10.21 84:3a:4b:20:94:f0 helloworld
dnsmasq-dhcp: 342453732 requested options: 1:netmask, 3:router, 6:dns-server, 15:domain-name,
dnsmasq-dhcp: 342453732 requested options: 31:router-discovery, 33:static-route, 43:vendor-encap,
dnsmasq-dhcp: 342453732 requested options: 44:netbios-ns, 46:netbios-nodetype, 47:netbios-scope,
dnsmasq-dhcp: 342453732 requested options: 121:classless-static-route, 249, 252
dnsmasq-dhcp: 342453732 next server: 10.10.10.254
dnsmasq-dhcp: 342453732 sent size:  1 option: 53 message-type  5
dnsmasq-dhcp: 342453732 sent size:  4 option: 54 server-identifier  10.10.10.254
dnsmasq-dhcp: 342453732 sent size:  4 option: 51 lease-time  5d
dnsmasq-dhcp: 342453732 sent size:  4 option: 58 T1  2d8h23m1s
dnsmasq-dhcp: 342453732 sent size:  4 option: 59 T2  4d5h23m1s
dnsmasq-dhcp: 342453732 sent size:  4 option:  1 netmask  255.255.255.0
dnsmasq-dhcp: 342453732 sent size:  4 option: 28 broadcast  10.10.10.255
dnsmasq-dhcp: 342453732 sent size:  4 option:  3 router  10.10.10.254
dnsmasq-dhcp: 342453732 sent size:  4 option: 15 domain-name  testlab
dnsmasq-dhcp: 342453732 sent size: 18 option: 81 FQDN  03:ff:ff:6c:77:35:79:6f:70:32:64:73:79:2e...
dnsmasq-dhcp: 342453732 sent size:  8 option:  6 dns-server  8.8.8.8, 8.8.4.4
dnsmasq-dhcp: 342453732 sent size:  1 option: 46 netbios-nodetype  08
dnsmasq-dhcp: 342453732 sent size:  4 option: 44 netbios-ns  10.10.10.254

So the client is given the IP 10.10.10.21 (I changed it during the tests and the correct one is assigned every time, for every change - so the response to the request is correctly interpreted by the client) and, among others, the specific DNS servers.

Everything looks good from the dnsmasqside.

On the client I get

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . : testlab
   Description . . . . . . . . . . . : Intel(R) Centrino(R) Advanced-N 6205
   Physical Address. . . . . . . . . : 84-3A-4B-20-94-F0
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::74d6:d6c:a5cc:54c7%8(Preferred)
   IPv4 Address. . . . . . . . . . . : 10.10.10.21(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : samedi 2 avril 2016 15:59:55
   Lease Expires . . . . . . . . . . : jeudi 7 avril 2016 16:03:15
   Default Gateway . . . . . . . . . : 10.10.10.254
   DHCP Server . . . . . . . . . . . : 10.10.10.254
   DHCPv6 IAID . . . . . . . . . . . : 75774539
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1C-87-7B-B4-3C-97-0E-67-52-6C
   DNS Servers . . . . . . . . . . . : 10.10.10.254
   Primary WINS Server . . . . . . . : 10.10.10.254
   NetBIOS over Tcpip. . . . . . . . : Enabled

I checked with Wireshark on the client the received traffic. In the DHCP ACK packet (the one recived from the DHCP server) the option is correct (so it was no stripped on the way or something like this):

enter image description here

The IP is OK but the DNS server is not correct: it defaults to the DHCP server - it looks like the received option is not correctly interpreted (?)

WoJ
  • 3,607
  • 9
  • 49
  • 79

1 Answers1

3

I found the problem: my DNS settings on the client were static. The IP was assigned via DHCP.

This is not normal and what brought me to check that is that I have had the same issue of the DNS switching to a static IP before - when going between my home and work network.

Again - this is not a normal situation and if I find out what causes the DNS to switch to a static IP I will update this answer.

WoJ
  • 3,607
  • 9
  • 49
  • 79