03 January, 2008

Ericsson W25 DNS tuning

After using the W25 for some time I wanted to add a correct domain handling and certain new names to the DNS services offered by the router.

Default behavior of the DNS system:

The W25 uses the DNS server called DNRD which is a simple caching, forwarding DNS server, with the additional feature of being able to resolve names from /etc/hosts file. This is used in the original SW to add every local client after requesting an address trough DHCP. The updating of the hosts file is done by the script /bin/updatehostsfile which in is called by the script /etc/udhcpd/udhcpdnotify. The name of the script to be called by the dhcp daemon is specified in /etc/udhcpd.conf.

Handling your internal domain with the W25:

To handle your internal domain correctly you need to do the following:

  1. Add your local domain to the DHCP messages
  2. Create an updated "updatehostfile" script to include your domain names and fix addresses to the /etc/hosts file
  3. Change the dhcpd configuration to call your updated "updatehostfile"
  4. Include a call to the "updatehostfile" script in your init sequence

Let's start with 2:

Copy /bin/updatehostsfile to /root/updatehostfile1 (or anything you like)

Change the line:

printf "%s \t%s %s\n" $localaddress $HOSTNAME $HOSTNAME".home" >> $HOSTFILETMP

to

printf "%s \t%s %s\n" $localaddress $HOSTNAME $HOSTNAME".my.domain" >> $HOSTFILETMP

after this line insert:

cat /root/hosts >> $HOSTFILETMP
echo >> $HOSTFILETMP

This will insert the copy of the file /root/hosts into the resulting /etc/hosts. Now by adding ip/name entries to the /root/hosts file you can add new machines to the DNS table (e.g. "192.168.1.150 myhomeserver.my.domain")

For 1 and 3 you have to edit the /etc/udhcpd.conf file:

Add to the end of the file:

opt domain laco.hu

change the notifyfile parameter to the following:

notify_file /root/updatehostfile1

For 4:

I hope that you can do this by yourself :-)

No comments: