dnsmasq – use with Network Manager.

Niles Machine Company
Niles Machine Company (Photo credits: roadtrafficsigns.com)

 

Well if you have not heard about dnsmasq:

 

Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server.
It is designed to provide DNS and, optionally, DHCP, to a small network.
It can serve the names of local machines which are not in the global
DNS. The DHCP server integrates with the DNS server and allows machines
with DHCP-allocated addresses to appear in the DNS with names configured
either in each host or in a central configuration file. Dnsmasq supports
static and dynamic DHCP leases and BOOTP for network booting of diskless
machines.

 

and for the installation :

 

sudo yum install dnsmasq

 

So, now that it is installed, all you need to do is add the following in file: /etc/NetworkManager/NetworkManager.conf

 

dns=dnsmasq

 

in the main section. Restart your network manager using sysctl and you should see that command:

 

dig google.com

 

should show result like below:

 

google.com. 185 IN A 74.125.236.169
google.com. 185 IN A 74.125.236.174
google.com. 185 IN A 74.125.236.160
google.com. 185 IN A 74.125.236.161
;; Query time: 50 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Jan 14 17:16:39 2013
;; MSG SIZE rcvd: 215

 

If it does not, then you might want to add a dispatcher to Network Manager that adds localhost to your “/etc/resolv.conf” file. And here is the name of the file – /etc/NetworkManager/dispatcher.d/localhost-prepend and the contents

 

#!/bin/bash
# Prepend localhost to resolv.conf for dnsmasq

if [[ ! $(grep 127.0.0.1 /etc/resolv.conf) ]]; then
  sed -i '1s|^|nameserver 127.0.0.1n|' /etc/resolv.conf
fi

 

Thats all there is to it 🙂

 

 

Enhanced by Zemanta

[Solution] Solaris issue with wget not resolving Domain name (DNS name lookup failure)

Today I was working with Solaris and after I had set up the NIS+, DNS server, IP Address and completing the basic setting. I was using the pkg-get util from the freesunware.com

The utility was using wget and it was failing constantly. From the looks of it, it was very clear that the wget utility was unable to find the IP address from the name. Name resolution was not happening, while dig and nslookup was able to do the DNS lookup.

After searching for quite sometime all that I could see was, in one of the forums, \”Did you have NIS enabled?\”

That seemed interesting and thus I got the direction to look for where I can find the solution. And finally I found that in \”nsswitch.conf\” there were settings to find how the various lookups should happen.

For the host entry, I saw that after looking at the nis the lookup would end so I changed the sequence to look at \”files dns\” also and then quit. And it worked. Hope it helps you too 🙂

\"Enhanced

Solved — Errors with afraid-dyndns in Goddard (Fedora 13)

Since I updated to the Fedora 13, I was getting error from the Dynamic DNS client for afraid. I was not getting enough time to fix this, so finally I decided to fix this in the night itself 🙂

Problem:
On running

afraid-dyndns

I was getting the error:

Entity: line 100: parser error : Opening and ending tag mismatch: br line 99 and div

^
Entity: line 118: parser error : Entity \’copy\’ not defined
© 2010 DomainTools, LLC All rights reserved.
^
Entity: line 121: parser error : AttValue: \” or \’ expected
/link/?id=4668\’;} return(true);\”>\"\"\"\"

So here is the solution :

On further investigation I found that the issue was not with the afraid server but with getting the external IP. So I decided to use my own site to get the IP. And changed the following in the afraid-dyndns file:

Comment out the following code:

#$xml = get(\”http://ip-address.domaintools.com/myip.xml\”);
#die \”Failed fetching IP address!\” unless $xml;
#echo (\”Got IP:\”. $xml);

#$o = XMLin($xml);
#$extip = $o->{proxy_ip}; # external address

And add the following line just below the just commented lines:

$extip = get(\”http://amit-agarwal.co.in/mystuff/getip_txt.php\”);
$extip =~ s/\\n//;

This change be sufficient to get you going again.. 🙂

\"Reblog