1

I have a gateway server which is set up originally with Ubuntu desktop 12.04 - perhaps a mistake, I don't know, something to bear in mind.

I ripped out network-manager and now want to get resolvconf, dhclient and dnsmasq to play well together.

dhclient gets the gateway's eth0 WAN IP address and the ISP DNS name server address from the modem.

dnsmasq needs to serve DHCP to the rest of the LAN on eth1 and acts as a DNS cache both for the LAN and for the gateway machine.

I also set up iptables as a firewall.

Right now, the gateway's /etc/resolv.conf shows only name server 127.0.0.1 which is correct AFAIK.

However I don't think that dhclient is giving dnsmasq the ISP DNS name server nor is dnsmasq picking up the OpenDNS and Google name servers I specified in /etc/network/interfaces - at the moment look-ups, i.e., ping or surfing, don't work unless I manually edit /etc/resolv.conf to put in an upstream name server like 8.8.8.8

So I removed the resolvconf package.

Now I'm not getting DHCP on my lan and I'm not able to do DNS look-ups on the host itself - I can surf and ping on the net, but not 127.0.0.1.

Where do I go from here? This setup with the config for dhclient and dnsmasq, and the same resolv.conf and hosts files worked on my old Debian box.

1
  • Strange that this questions got no answers or even comments. I've read answers to other questions by people who demonstrate enough knowledge in this area to answer it, so maybe something's wrong with the way I asked. I'm going to try deleting all but one of the questions.
    – Adam
    Aug 30, 2012 at 15:41

1 Answer 1

2

I worked out what the problem was.

After way too long struggling to work out what was wrong with resolvconf or dnsmasq, I finally decided to double-check the firewall. Since I hadn't changed anything in my iptables rules for 5 years, I didn't think this would be the problem. But I couldn't figure out why dnsmasq was listening on port 53 but not writing any DNS look-ups in its logs. So it had to be the firewall.

Along time ago, I wrote a rule to allow everything through that wasn't from the external interface.

iptables -A INPUT -i !eth0 -j ACCEPT

That worked fine on the old machine I had because I wasn't using dnsmasq for DNS look-ups on the actual server. So dnsmasq worked happily on requests coming in on eth1. But on my new machine, I started testing it with look-ups on lo. With Ubuntu 12.04 that rule does not allow "all interfaces except eth0". I played around with the rule and found that it should be this:

iptables -A INPUT ! -i eth0 -j ACCEPT

Maybe if I'd put the hour of work in back at the start to configure my new machine with ufw I would've been up and running on the same day. Coulda woulda shoulda....

2
  • I hope you also re-installed resolvconf. :)
    – jdthood
    Oct 29, 2012 at 10:30
  • no, i don't need resolvconf. this is a server more than anything, it's never going to need to update its config on the fly. i am running dnsmasq with my own config, having resolvconf would bring it in again which would be redundant.
    – Adam
    Oct 29, 2012 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .