Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 1 | Q: Why does dnsmasq open UDP ports >1024 as well as port 53. |
| 2 | Is this a security problem/trojan/backdoor? |
| 3 | |
| 4 | A: The high ports that dnsmasq opens is for replies from the upstream |
| 5 | nameserver(s). Queries from dnsmasq to upstream nameservers are sent |
| 6 | from these ports and replies received to them. The reason for doing this is |
| 7 | that most firewall setups block incoming packets _to_ port 53, in order |
| 8 | to stop DNS queries from the outside world. If dnsmasq sent its queries |
| 9 | from port 53 the replies would be _to_ port 53 and get blocked. |
| 10 | |
| 11 | This is not a security hole since dnsmasq will only accept replies to that |
| 12 | port: queries are dropped. The replies must be to oustanding queries |
| 13 | which dnsmasq has forwarded, otherwise they are dropped too. |
| 14 | |
| 15 | Addendum: dnsmasq now has the option "query-port" (-Q), which allows |
| 16 | you to specify the UDP port to be used for this purpose. If not |
| 17 | specified, the operating system will select an available port number |
| 18 | just as it did before. |
| 19 | |
| 20 | Q: Why doesn't dnsmasq support DNS queries over TCP? Don't the RFC's specify |
| 21 | that? |
| 22 | |
Simon Kelley | feba5c1 | 2004-07-27 20:28:58 +0100 | [diff] [blame] | 23 | A: Update: from version 2.10, it does. There are a few limitations: |
| 24 | data obtained via TCP is not cached, and dynamically-created |
| 25 | interfaces may break under certain circumstances. Source-address |
| 26 | or query-port specifications are ignored for TCP. |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 27 | |
| 28 | Q: When I send SIGUSR1 to dump the contents of the cache, some entries have |
| 29 | no IP address and are for names like mymachine.mydomain.com.mydomain.com. |
| 30 | What are these? |
| 31 | |
| 32 | A: They are negative entries: that's what the N flag means. Dnsmasq asked |
| 33 | an upstream nameserver to resolve that address and it replied "doesn't |
| 34 | exist, and won't exist for <n> hours" so dnsmasq saved that information so |
| 35 | that if _it_ gets asked the same question it can answer directly without |
| 36 | having to go back to the upstream server again. The strange repeated domains |
| 37 | result from the way resolvers search short names. See "man resolv.conf" for |
| 38 | details. |
| 39 | |
| 40 | |
| 41 | Q: Will dnsmasq compile/run on non-Linux systems? |
| 42 | |
| 43 | A: Yes, there is explicit support for *BSD and Solaris. |
| 44 | For other systems, try altering the settings in config.h. |
| 45 | |
| 46 | A: Update for V2. Doing DHCP is rather non-portable, so there may be |
| 47 | a few teething troubles. The initial 2.0 release is known to work |
| 48 | on Linux 2.2.x, Linux 2.4.x and Linux 2.6.x with uclibc and glibc |
| 49 | 2.3. It also works on FreeBSD 4.8. The crucial problem is sending |
| 50 | raw packets, bypassing the IP stack. Dnsmasq contains code to do |
| 51 | using PF_PACKET sockets (which is for Linux) and the Berkeley packet |
| 52 | filter (which works with BSD). If you are trying to port to another |
| 53 | Un*x, bpf is the most likeley candidate. See config.h |
| 54 | |
| 55 | Q: My companies' nameserver knows about some names which aren't in the |
| 56 | public DNS. Even though I put it first in /etc/resolv.conf, it |
| 57 | dosen't work: dnsmasq seems not to use the nameservers in the order |
| 58 | given. What am I doing wrong? |
| 59 | |
| 60 | A: By default, dnsmasq treats all the nameservers it knows about as |
| 61 | equal: it picks the one to use using an algorithm designed to avoid |
| 62 | nameservers which aren't responding. To make dnsmasq use the |
| 63 | servers in order, give it the -o flag. If you want some queries |
| 64 | sent to a special server, think about using the -S flag to give the |
| 65 | IP address of that server, and telling dnsmasq exactly which |
| 66 | domains to use the server for. |
| 67 | |
| 68 | Q: OK, I've got queries to a private nameserver working, now how about |
| 69 | reverse queries for a range of IP addresses? |
| 70 | |
| 71 | A: Use the standard DNS convention of <reversed address>.in-addr.arpa. |
| 72 | For instance to send reverse queries on the range 192.168.0.0 to |
| 73 | 192.168.0.255 to a nameserver at 10.0.0.1 do |
| 74 | server=/0.168.192.in-addr.arpa/10.0.0.1 |
Simon Kelley | feba5c1 | 2004-07-27 20:28:58 +0100 | [diff] [blame] | 75 | Note that the "bogus-priv" option take priority over this option, |
| 76 | so the above will not work when the bogus-priv option is set. |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 77 | |
| 78 | Q: Dnsmasq fails to start with an error like this: "dnsmasq: bind |
| 79 | failed: Cannot assign requested address". What's the problem? |
| 80 | |
| 81 | A: This has been seen when a system is bringing up a PPP interface at |
| 82 | boot time: by the time dnsmasq start the interface has been |
| 83 | created, but not brought up and assigned an address. The easiest |
| 84 | solution is to use --interface flags to specify which interfaces |
| 85 | dnsmasq should listen on. Since you are unlikely to want dnsmasq to |
| 86 | listen on a PPP interface and offer DNS service to the world, the |
| 87 | problem is solved. |
| 88 | |
| 89 | Q: I'm running on BSD and dnsmasq won't accept long options on the |
| 90 | command line. |
| 91 | |
| 92 | A: Dnsmasq when built on BSD systems doesn't use GNU getopt by |
| 93 | default. You can either just use the single-letter options or |
| 94 | change config.h and the Makefile to use getopt-long. Note that |
| 95 | options in /etc/dnsmasq.conf must always be the long form, |
| 96 | on all platforms. |
| 97 | |
| 98 | Q: Names on the internet are working fine, but looking up local names |
| 99 | from /etc/hosts or DHCP doesn't seem to work. |
| 100 | |
| 101 | A: Resolver code sometime does strange things when given names without |
| 102 | any dots in. Win2k and WinXP may not use the DNS at all and just |
| 103 | try and look up the name using WINS. On unix look at "options ndots:" |
| 104 | in "man resolv.conf" for details on this topic. Testing lookups |
| 105 | using "nslookup" or "dig" will work, but then attempting to run |
| 106 | "ping" will get a lookup failure, appending a dot to the end of the |
| 107 | hostname will fix things. (ie "ping myhost" fails, but "ping |
| 108 | myhost." works. The solution is to make sure that all your hosts |
| 109 | have a domain set ("domain" in resolv.conf, the network applet in |
| 110 | windows, or set a domain in your DHCP server). Any domain will do, |
| 111 | but "localnet" is traditional. Now when you resolve "myhost" the |
| 112 | resolver will attempt to look up "myhost.localnet" so you need to |
| 113 | have dnsmasq reply to that name. The way to do that is to include |
| 114 | the domain in each name on /etc/hosts and/or to use the |
| 115 | --expand-hosts and --domain-suffix options. |
| 116 | |
| 117 | Q: Can I get dnsmasq to save the contents of its cache to disk when |
| 118 | I shut my machine down and re-load when it starts again. |
| 119 | |
| 120 | A: No, that facility is not provided. Very few names in the DNS have |
| 121 | their time-to-live set for longer than a few hours so most of the |
| 122 | cache entries would have expired after a shutdown. For longer-lived |
| 123 | names it's much cheaper to just reload them from the upstream |
| 124 | server. Note that dnsmasq is not shut down between PPP sessions so |
| 125 | go off-line and then on-line again will not lose the contents of |
| 126 | the cache. |
| 127 | |
| 128 | Q: Who are Verisign, what do they have to do with the bogus-nxdomain |
| 129 | option in dnsmasq and why should I wory about it? |
| 130 | |
| 131 | A: [note: this was written in September 2003, things may well change.] |
| 132 | Versign run the .com and .net top-level-domains. They have just |
| 133 | changed the configuration of their servers so that unknown .com and |
| 134 | .net domains, instead of returning an error code NXDOMAIN, (no such |
| 135 | domain) return the address of a host at Versign which runs a web |
| 136 | server showing a search page. Most right-thinking people regard |
| 137 | this new behaviour as broken :-). You can test to see if you are |
| 138 | suffering Versign brokeness by run a command like |
| 139 | |
| 140 | host jlsdajkdalld.com |
| 141 | |
| 142 | If you get "jlsdajkdalld.com" does not exist, then all is fine, if |
| 143 | host returns an IP address, then the DNS is broken. (Try a few |
| 144 | different unlikely domains, just in case you picked a wierd one |
| 145 | which really _is_ registered.) |
| 146 | |
| 147 | Assuming that your DNS is broken, and you want to fix it, simply |
| 148 | note the IP address being returned and pass it to dnsmasq using the |
| 149 | --bogus-nxdomain flag. Dnsmasq will check for results returning |
| 150 | that address and substitute an NXDOMAIN instead. |
| 151 | |
| 152 | As of writing, the IP address in question for the .com and .net |
| 153 | domains is is 64.94.110.11. Various other, less prominent, |
| 154 | registries pull the same stunt; there is a list of them all, and |
| 155 | the addresses to block, at http://winware.org/bogus-domains.txt |
| 156 | |
Simon Kelley | 1ab84e2 | 2004-01-29 16:48:35 +0000 | [diff] [blame] | 157 | Q: This new DHCP server is well and good, but it doesn't work for me. |
| 158 | What's the problem? |
| 159 | |
| 160 | A: There are a couple of configuration gotchas which have been |
| 161 | encountered by people moving from the ISC dhcpd to the dnsmasq |
| 162 | integrated DHCP daemon. Both are related to differences in |
| 163 | in the way the two daemons bypass the IP stack to do "ground up" |
| 164 | IP configuration and can lead to the dnsmasq daemon failing |
| 165 | whilst the ISC one works. |
| 166 | |
| 167 | The first thing to check is the broadcast address set for the |
| 168 | ethernet interface. This is normally the adddress on the connected |
| 169 | network with all ones in the host part. For instance if the |
| 170 | address of the ethernet interface is 192.168.55.7 and the netmask |
| 171 | is 255.255.255.0 then the broadcast address should be |
| 172 | 192.168.55.255. Having a broadcast address which is not on the |
| 173 | network to which the interface is connected kills things stone |
| 174 | dead. |
| 175 | |
| 176 | The second potential problem relates to firewall rules: since the ISC |
| 177 | daemon in some configurations bypasses the kernel firewall rules |
| 178 | entirely, the ability to run the ISC daemon does not indicate |
| 179 | that the current configuration is OK for the dnsmasq daemon. |
| 180 | For the dnsmasq daemon to operate it's vital that UDP packets to |
| 181 | and from ports 67 and 68 and broadcast packets with source |
| 182 | address 0.0.0.0 and destination address 255.255.255.255 are not |
| 183 | dropped by iptables/ipchains. |
Simon Kelley | 33820b7 | 2004-04-03 21:10:00 +0100 | [diff] [blame] | 184 | |
| 185 | Q: I'm running Debian, and my machines get an address fine with DHCP, |
| 186 | but their names are not appearing in the DNS. |
| 187 | |
| 188 | A: By default, none of the DHCP clients send the host-name when asking |
| 189 | for a lease. For most of the clients, you can set the host-name to |
| 190 | send with the "hostname" keyword in /etc/network/interfaces. (See |
| 191 | "man interfaces" for details.) That doesn't work for dhclient, were |
| 192 | you have to add something like "send host-name daisy" to |
Simon Kelley | 3be3454 | 2004-09-11 19:12:13 +0100 | [diff] [blame] | 193 | /etc/dhclient.conf [Update: the lastest dhcpcd packages _do_ send |
| 194 | the hostname by default. |
Simon Kelley | 33820b7 | 2004-04-03 21:10:00 +0100 | [diff] [blame] | 195 | |
| 196 | Q: I'm network booting my machines, and trying to give them static |
| 197 | DHCP-assigned addresses. The machine gets its correct address |
| 198 | whilst booting, but then the OS starts and it seems to get |
| 199 | allocated a different address. |
| 200 | |
| 201 | A: What is happening is this: The boot process sends a DHCP |
| 202 | request and gets allocated the static address corresponding to its |
| 203 | MAC address. The boot loader does not send a client-id. Then the OS |
| 204 | starts and repeats the DHCP process, but it it does send a |
| 205 | client-id. Dnsmasq cannot assume that the two requests are from the |
| 206 | same machine (since the client ID's don't match) and even though |
| 207 | the MAC address has a static allocation, that address is still in |
| 208 | use by the first incarnation of the machine (the one from the boot, |
| 209 | without a client ID.) dnsmasq therefore has to give the machine a |
Simon Kelley | de37951 | 2004-06-22 20:23:33 +0100 | [diff] [blame] | 210 | dynamic address from its pool. There are three ways to solve this: |
Simon Kelley | 33820b7 | 2004-04-03 21:10:00 +0100 | [diff] [blame] | 211 | (1) persuade your DHCP client not to send a client ID, or (2) set up |
| 212 | the static assignment to the client ID, not the MAC address. The |
| 213 | default client-id will be 01:<MAC address>, so change the dhcp-host |
| 214 | line from "dhcp-host=11:22:33:44:55:66,1.2.3.4" to |
Simon Kelley | de37951 | 2004-06-22 20:23:33 +0100 | [diff] [blame] | 215 | "dhcp-host=id:01:11:22:33:44:55:66,1.2.3.4" or (3) tell dnsmasq to |
| 216 | ignore client IDs for a particular MAC address, like this: |
| 217 | dhcp-host=11:22:33:44:55:66,id:* |
Simon Kelley | 33820b7 | 2004-04-03 21:10:00 +0100 | [diff] [blame] | 218 | |
| 219 | Q: What network types are supported by the DHCP server? |
Simon Kelley | 1ab84e2 | 2004-01-29 16:48:35 +0000 | [diff] [blame] | 220 | |
Simon Kelley | 33820b7 | 2004-04-03 21:10:00 +0100 | [diff] [blame] | 221 | A: Ethernet (and 802.11 wireless) are supported on all platforms. On |
| 222 | Linux Token Ring is also supported. |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 223 | |
Simon Kelley | de37951 | 2004-06-22 20:23:33 +0100 | [diff] [blame] | 224 | Q: What is this strange "bind-interface" option? |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 225 | |
Simon Kelley | de37951 | 2004-06-22 20:23:33 +0100 | [diff] [blame] | 226 | A: The DNS spec says that the reply to a DNS query must come from the |
| 227 | same address it was sent to. The traditional way to write an UDP |
| 228 | server to do this is to find all of the addresses belonging to the |
| 229 | machine (ie all the interfaces on the machine) and then create a |
| 230 | socket for each interface which is bound to the address of the |
| 231 | interface. Then when a packet is sent to address A, it is received |
| 232 | on the socket bound to address A and when the reply is also sent |
| 233 | via that socket, the source address is set to A by the kernel and |
| 234 | everything works. This is the how dnsmasq works when |
| 235 | "bind-interfaces" is set, with the obvious extension that is misses |
| 236 | out creating sockets for some interfaces depending on the |
| 237 | --interface, --address and --except-interface flags. The |
| 238 | disadvantage of this approach is that it breaks if interfaces don't |
| 239 | exist or are not configured when the daemon starts and does the |
| 240 | socket creation step. In a hotplug-aware world this is a real |
| 241 | problem. |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 242 | |
Simon Kelley | de37951 | 2004-06-22 20:23:33 +0100 | [diff] [blame] | 243 | The alternative approach is to have only one socket, which is bound |
| 244 | to the correct port and the wildcard IP address (0.0.0.0). That |
| 245 | socket will receive _all_ packets sent to port 53, no matter what |
| 246 | destination address they have. This solves the problem of |
| 247 | interfaces which are created or reconfigured after daemon |
| 248 | start-up. To make this work is more complicated because of the |
| 249 | "reply source address" problem. When a UDP packet is sent by a |
| 250 | socket bound to 0.0.0.0 its source address will be set to the |
| 251 | address of one of the machine's interfaces, but which one is not |
| 252 | determined and can vary depending on the OS being run. To get round |
| 253 | this it is neccessary to use a scary advanced API to determine the |
| 254 | address to which a query was sent, and force that to be the source |
| 255 | address in the reply. For IPv4 this stuff in non-portable and quite |
| 256 | often not even available (It's different between FreeBSD 5.x and |
| 257 | Linux, for instance, and FreeBSD 4.x, Linux 2.0.x and OpenBSD don't |
| 258 | have it at all.) Hence "bind-interfaces" has to always be available |
| 259 | as a fall back. For IPv6 the API is standard and universally |
| 260 | available. |
| 261 | |
| 262 | It could be argued that if the --interface or --address flags are |
| 263 | used then binding interfaces is more appropriate, but using |
| 264 | wildcard binding means that dnsmasq will quite happily start up |
| 265 | after being told to use interfaces which don't exist, but which are |
| 266 | created later. Wildcard binding breaks the scenario when dnsmasq is |
| 267 | listening on one interface and another server (most probably BIND) |
| 268 | is listening on another. It's not possible for BIND to bind to an |
| 269 | (address,port) pair when dnsmasq has bound (wildcard,port), hence |
| 270 | the ability to explicitly turn off wildcard binding. |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 271 | |
Simon Kelley | c1bb850 | 2004-08-11 18:40:17 +0100 | [diff] [blame] | 272 | Q: Why doesn't Kerberos work/why can't I get sensible answers to |
| 273 | queries for SRV records. |
Simon Kelley | 9e4abcb | 2004-01-22 19:47:41 +0000 | [diff] [blame] | 274 | |
Simon Kelley | c1bb850 | 2004-08-11 18:40:17 +0100 | [diff] [blame] | 275 | A: Probably because you have the "filterwin2k" option set. Note that |
| 276 | it was on by default in example configuration files included in |
| 277 | versions before 2.12, so you might have it set on without |
| 278 | realising. |
| 279 | |
Simon Kelley | 3be3454 | 2004-09-11 19:12:13 +0100 | [diff] [blame] | 280 | Q: Can I get email notification when a new version of dnsmasq is |
| 281 | released? |
| 282 | |
| 283 | A: Yes, new releases of dnsmasq are always announced through |
| 284 | freshmeat.net, and they allow you to subcribe to email alerts when |
| 285 | new versions of particular projects are released. |
| 286 | |
Simon Kelley | fd9fa48 | 2004-10-21 20:24:00 +0100 | [diff] [blame] | 287 | Q: What does the dhcp-authoritative option do? |
| 288 | |
| 289 | A: See http://www.isc.org/index.pl?/sw/dhcp/authoritative.php - that's |
| 290 | for the ISC daemon, but the same applies to dnsmasq. |
| 291 | |
| 292 | Q: Why does my Gentoo box pause for a minute before getting a new |
| 293 | lease? |
| 294 | |
| 295 | A: Because when a Gentoo box shuts down, it releases its lease with |
| 296 | the server but remembers it on the client; this seems to be a |
| 297 | Gentoo-specific patch to dhcpcd. On restart it tries to renew |
| 298 | a lease which is long gone, as far as dnsmasq is concerned, and |
| 299 | dnsmasq ignores it until is times out and restarts the process. |
| 300 | To fix this, set the dhcp-authoritative flag in dnsmasq. |
| 301 | |
| 302 | |
Simon Kelley | 3be3454 | 2004-09-11 19:12:13 +0100 | [diff] [blame] | 303 | |
Simon Kelley | c1bb850 | 2004-08-11 18:40:17 +0100 | [diff] [blame] | 304 | |
| 305 | |