Saturday, 23 January 2010

Adding local DNS entries to a Netgear DG834

There is a program running on your DG834 called dnsmasq, which is used to forward DNS requests to the appropriate servers. The program can optionally use one or more local hosts files, so if you are hosting a webserver at home, for example, you can add it to the hosts file, and any LAN requests will return the LAN ip address, rather than the internet one.

By default, at least on the DG834Gv5, the option to add your own entries is not enabled.

Log into your netgear with telnet.


With a web browser, connect to http://your-modem/setup.cgi?todo=debug
Telnet to your modem: telnet

Create a new hosts file with local addresses:

mkdir /var/etc
cp /etc/hosts /var/etc/hosts
echo "192.168.1.10 www.myinternalwebserver.com" >> /var/etc/hosts

To check it works, restart the DNS Masquerade program:

killall dnsmasq
dnsmasq -h -n -c 0 -N -i br0 -r /tmp/resolv.conf -u r -H /var/etc/hosts

Making things permanent:

Now, there is a problem making this permanent as the root filesystem is 100% full, but what you would need to do is:

Mount the root disk read/write: mount / -o rw,remount
Copy the hosts file over: cp /var/etc/hosts /etc/hosts
Reboot

1 comments:

Anonymous said...

It would appear that on DG834Gv4 dnsmasq is not even present; dnrd is used instead, that also uses the /etc/hosts file as dnsmasq.

To check if it works use
killall dnrd

dnrd -a yourLANrouterAddress -m hosts -c off -b -s dnsServer1 -s dnsServer2
or wathever command line your router is using as found by
cat /proc/PIDofDNRD/cmdline

where PIDofDNR can be found using ps | grep dnrd

Regards
Alan

Post a Comment

Blog Archive