DNSMASQ kills DNS lookup on FOG server
-
Hi all, I am having trouble with DNS lookups when DNSMASQ is active. Hosts do not resolve for me.
Disabling DNSMASQ allows me to lookup addresses again:
[CODE]service dnsmasq stop[/CODE]
but, of course, it breaks my setup as I don’t have access to the DHCP server.I followed the iPXE settings in this guide to setup - [url]http://www.fogproject.org/wiki/index.php/Using_FOG_with_an_unmodifiable_DHCP_server/_Using_FOG_with_no_DHCP_server[/url]
Any ideas what I might be missing?
Cheers,
del
-
in /etc/dnsmasqd/ltsp.conf comment out the “port=0” line and it should work with it running. I had this problem too and I did fix it so you don’t have to turn off the don’t function as a dns server option, but I can’t remember what I did. When I find that I’ll post that here too, but I figured a temporary fix that will allow you to still do the pxe boot is better than nothing.
-
That did indeed work, thanks. If you find your other solution, I would be very pleased to see it
-
This post is deleted! -
Ok, I think I found what fixed it. It has to do with the /etc/resolv.conf file. I’m running Ubuntu 14.04 server x64 and it defaulted the nameservers to 127.0.0.1 or something of that localhost address sort. All you need to do is make the dns servers you want to connect to appear in there. The trouble is, if you try to edit the /etc/resolv.conf file, your changes will magically disappear.
Lucky for you I already spent the time researching this and know how to get around it. I probably should have posted it somewhere when I did fix it.
Now, this is one of those problems where I tried so many things that I’m not actually sure which fixed it. So I’ll start with the method that I think did the trick and put all the other changes I did too. If you would be so kind as to try them one at a time so everyone knows the important part and I don’t end up telling people to edit more system files then needed and breaking any networks or anything.
[B]Symlink method[/B]
-
delete the current /etc/resolv.conf file with this command “sudo rm /etc/resolv.conf”
-
edit the master resolv.conf file with the command “nano /run/resolvconf/resolv.conf”
The format of the file is nameserver definitions…
For a dns server definition, you use nameserver, you can define more than one, each has its own line
nameserver [I]your.Network’s.DnsServer.Address [/I]
For example, if you wanted the server to use google public dns, you would have one line say
nameserver 8.8.8.8If you are on a enterprise type network that has a domain name you use the search line and the supersede statement The "search" line syntax - search [I]your.appended.domainName[/I] The supersede statement, this is a multiple line statement with the second line indented with a space- supersede domain-name "[I]your.appended.domainName[/I]"; (Quotes are apart of the syntax) prepend domain-name-servers [I]your.primary.dnsServer.address[/I];
(in case anyone hasn’t used nano before, to save and close the file, ctrl + x, then y )
-
Create the symlink to the master file with the command “sudo ln -s /run/resolvconf/resolv.conf”
-
Restart the resolvconf service and the dnsmasq service with “sudo service resolvconf restart” and “sudo service dnsmasq restart”
[I]Note: If the “port=0” line in /etc/dnsmasq.d/ltsp.conf is still commented out, go uncomment it before your restart the dnsmasq[/I] [I]service[/I] -
Do a quick test with “sudo apt-get update” if it succeeds than hooray! otherwise try the next method.
[B]resolvconf interfaces file[/B]
[I]If the symlink method alone didn’t work, it may be necessary to edit the files specific to each network interface, these instructions assume you only have one ethernet device named eth0, but these steps can easily apply to any additional interfaces.[/I]-
Edit the eth0 dhclient file with “sudo nano /run/resolvconf/interfaces/eth0.dhclient”
If you have a domain name, you need a domain line. It is the same as the “search” line in resolv.conf,
except you domain instead of search. i.e. “domain your.appended.domainName” (without quotes)The only other lines you need are the nameserver lines which use the same syntax as the resolv.conf file shown above
so just put in your nameserver definitions the same as before
-
Edit the eth0.inet file with “sudo nano /run/resolvconf/interfaces/eth0.inet”
In this file you only need one line defining your primary dns server with a single nameserver line -
Restart the resolvconf service and the dnsmasq service with “sudo service resolvconf restart” & “sudo service dnsmasq restart”
-
Do a quick test with “sudo apt-get update” if it succeeds than hooray! otherwise try the next method.
[B]resolvconf interface order and base config files[/B]
[I]If the above 2 methods still didn’t do the trick, try editing these 2 more config files. You may try restarting the service after each file to see if you only needed to edit one of them rather than both.[/I]-
Edit the base file with “sudo nano /etc/resolvconf/resolv.conf.d/base”
The syntax of this file is the same as the master resolv.conf file -
Edit the interface order with “sudo nano /etc/resolvconf/interface-order”
This file should already have lots of information in it. I edited so that the top two interfaces are
eth0.dhcp
eth*
It is likely that you only need to have eth* at the top, but this is what I have working. Keep all the rest of the interface order
as it is. -
Restart the resolvconf service and the dnsmasq service with “sudo service resolvconf restart” & “sudo service dnsmasq restart”
-
Do a quick test with “sudo apt-get update” if it succeeds than hooray! otherwise, the problem is something different or the linux distro your using uses the resolvconf service completely differently than ubuntu 14.04 and would require additional research.
I hope this helps. Good luck
Thanks,
-JJ -
-
Ok, thanks for the post. It’s fixed now and it was the very last step that did it. A few notes on the instructions above. Like you requested, I did each step one at a time.
[quote=“mecsr, post: 27208, member: 23886”]
[B]Symlink method[/B]- delete the current /etc/resolv.conf file with this command “sudo rm /etc/resolv.conf”[/quote]
/etc/resolv.conf -> This is already a symlink to the master file /run/resolvconf/resolv.conf
[quote=“mecsr, post: 27208, member: 23886”]
2. edit the master resolv.conf file with the command “nano /run/resolvconf/resolv.conf”
The format of the file is nameserver definitions…
For a dns server definition, you use nameserver, you can define more than one, each has its own line
nameserver [I]your.Network’s.DnsServer.Address [/I]
For example, if you wanted the server to use google public dns, you would have one line say
nameserver 8.8.8.8
[/quote]
/run/resolvconf/resolv.conf -> this file is modified automatically on resolvconf service restart[quote="mecsr, post: 27208, member: 23886
If you are on a enterprise type network that has a domain name you use the search line and the supersede statement
The “search” line syntax -
search [I]your.appended.domainName[/I]The supersede statement, this is a multiple line statement with the second line indented with a space-
supersede domain-name “[I]your.appended.domainName[/I]”; (Quotes are apart of the syntax)
prepend domain-name-servers [I]your.primary.dnsServer.address[/I];(in case anyone hasn’t used nano before, to save and close the file, ctrl + x, then y )
-
Create the symlink to the master file with the command “sudo ln -s /run/resolvconf/resolv.conf”
-
Restart the resolvconf service and the dnsmasq service with “sudo service resolvconf restart” and “sudo service dnsmasq restart”
[I]Note: If the “port=0” line in /etc/dnsmasq.d/ltsp.conf is still commented out, go uncomment it before your restart the dnsmasq[/I] [I]service[/I] -
Do a quick test with “sudo apt-get update” if it succeeds than hooray! otherwise try the next method.
[/quote]
This solution didn’t work. The files were automatically modified on service restart.
[quote=“mecsr, post: 27208, member: 23886”]
[B]resolvconf interfaces file[/B]
[I]If the symlink method alone didn’t work, it may be necessary to edit the files specific to each network interface, these instructions assume you only have one ethernet device named eth0, but these steps can easily apply to any additional interfaces.[/I]- Edit the eth0 dhclient file with “sudo nano /run/resolvconf/interfaces/eth0.dhclient”
If you have a domain name, you need a domain line. It is the same as the “search” line in resolv.conf,
except you domain instead of search. i.e. “domain your.appended.domainName” (without quotes)
The only other lines you need are the nameserver lines which use the same syntax as the resolv.conf file shown above
so just put in your nameserver definitions the same as before
[/quote]I didn’t have an eth0.dhclient file.
[quote=“mecsr, post: 27208, member: 23886”]
2. Edit the eth0.inet file with “sudo nano /run/resolvconf/interfaces/eth0.inet”
In this file you only need one line defining your primary dns server with a single nameserver line-
Restart the resolvconf service and the dnsmasq service with “sudo service resolvconf restart” & “sudo service dnsmasq restart”
-
Do a quick test with “sudo apt-get update” if it succeeds than hooray! otherwise try the next method.
[/quote]
My eth0.inet file already had the correct info in it. I also had an lo.dnsmasq file with one line in it
[CODE]nameserver 127.0.0.1[/CODE]
So I modified this file with the correct details but, once again, on service restart the file reverted to the original values.[quote=“mecsr, post: 27208, member: 23886”]
[B]resolvconf interface order and base config files[/B]
[I]If the above 2 methods still didn’t do the trick, try editing these 2 more config files. You may try restarting the service after each file to see if you only needed to edit one of them rather than both.[/I]- Edit the base file with “sudo nano /etc/resolvconf/resolv.conf.d/base”
The syntax of this file is the same as the master resolv.conf file[/quote]
I modified the base file with the values and restarted the service but the /etc/resolv.conf did not reflect the changes
[quote=“mecsr, post: 27208, member: 23886”]
2. Edit the interface order with “sudo nano /etc/resolvconf/interface-order”
This file should already have lots of information in it. I edited so that the top two interfaces are
eth0.dhcp
eth*
It is likely that you only need to have eth* at the top, but this is what I have working. Keep all the rest of the interface order
as it is.-
Restart the resolvconf service and the dnsmasq service with “sudo service resolvconf restart” & “sudo service dnsmasq restart”
-
Do a quick test with “sudo apt-get update” if it succeeds than hooray! otherwise, the problem is something different or the linux distro your using uses the resolvconf service completely differently than ubuntu 14.04 and would require additional research.
I hope this helps. Good luck
Thanks,
-JJ[/quote]This final step was the one that worked. I only put eth* at the top of the interface-order file and restarted the service. Did a quick ping test… success! Checked the /etc/resolv.conf and it had pulled the details from eth0.inet
So it seems the real problem is the lo.dnsmasq file which takes precedence in the interface-order
[CODE]# interface-order(5)
lo.inet*
lo.dnsmasq
lo.pdnsd
lo.!(pdns|pdns-recursor)
lo
tun*
tap*
hso*
em+([0-9])?(+([0-9]))*
p+([0-9])p+([0-9])?(+([0-9]))*
ath*
eth*
wlan*
ppp*
*
[/CODE]
The above was the original layout.Thanks for your help JJ. It was an interesting ride and probably wouldn’t have known the flow of these files from day to day usage.
- delete the current /etc/resolv.conf file with this command “sudo rm /etc/resolv.conf”[/quote]