2

I run Ubuntu 16.04 LTS.

I want to redirect DNS requests coming from some ip[-range] to another instance of dnsmasq on port 1995. To do so I added these lines in /etc/dnsmasq.conf file :

dhcp-range=set:red,10.10.10.11,10.10.10.222,255.255.255.0,12h
dhcp-option=tag:red,6,10.10.10.10:1995

But when I restart dnsmasq it fails telling that Bad IP address on line ...

I also tried

dhcp-option=tag:red,6,10.10.10.10#1995 

This also fails as Bad IP Address

Now, tell me how to specify the port number of other DNS Servers in dhcp-option ?

Chitholian
  • 131
  • 1
  • 5

1 Answers1

3

When it comes down to it, the issue here is not so much dnsmasq but rather the DHCP protocol itself.

Option 6 has no field for holding any port, only a sequence of 4 octet/byte (32 bit) IPv4 addresses.

From RFC2132: DHCP Options and BOOTP Vendor Extensions:

3.8. Domain Name Server Option

   The domain name server option specifies a list of Domain Name System
   (STD 13, RFC 1035 [8]) name servers available to the client.  Servers
   SHOULD be listed in order of preference.

   The code for the domain name server option is 6.  The minimum length
   for this option is 4 octets, and the length MUST always be a multiple
   of 4.

    Code   Len         Address 1               Address 2
   +-----+-----+-----+-----+-----+-----+-----+-----+--
   |  6  |  n  |  a1 |  a2 |  a3 |  a4 |  a1 |  a2 |  ...
   +-----+-----+-----+-----+-----+-----+-----+-----+--

Unless you're changing the overall approach, you'll want to put your different nameservers on different addresses rather than on different ports.
Håkan Lindqvist
  • 33,741
  • 5
  • 65
  • 90