next up previous contents index
Next: Where are we? Up: Setting up an own Previous: Compiling udhcp-0.9.8   Contents   Index


Setting up automatic DNS

Up to now, we don't have to set up any clients for using our SEGA Dreamcast as gateway or as nameserver. But we have to set up the gaming console itself with the given nameserver in /etc/resolv.conf and in /usr/yaku-ns/yaku-ns.conf. In this section, we'll modify some scripts to let the SEGA Dreamcast do this job.

The first file is /usr/yaku-ns/yaku-ns.conf.in:

# cd ..
# cd usr/yaku-ns
# cat <<. >yaku-ns.conf.in
acl dns.allow 192.168.1.
acl dns.deny $
nameserver __NAMESERVER__
.
# chmod 644 yaku-ns.conf.in

As you see, we've change the real nameserver address with a wildcard. Now, we have to edit /usr/sbin/adsl-connect for filling up this wildcard. Please add the following lines directly after

echo "$!" > $PPPD_PIDFILE

in the while loop:

    .
    .
    .

    # Dynmaic nameserver implementation
    # Read given nameserver
    head -n1 /etc/ppp/resolv.conf | \
     sed s/nameserver\ // > /tmp/nameserver 2> /dev/null
    NAMESERVER=`cat /tmp/nameserver`
    
    # Ensure, $NAMESERVER is non-zero for 
    # avoiding to kill the nameserver
    if [ ! -z $NAMESERVER ]; then
        # Alter yaku-ns configuration
        cat /usr/yaku-ns/yaku-ns.conf.in | \
         sed s/__NAMESERVER__/$NAMESERVER/ > \
         /usr/yaku-ns/yaku-ns.conf

        # Exist a yaku-ns process?
        pidof yaku-ns 2>&1 > /dev/null
        if [ "$?" == "0" ]; then
            # Inform yaku-ns of the 
            # configuration change.
            kill -SIGHUP `pidof yaku-ns`
        else
	    # yaku-ns process doesn't exist. 
	    # So, we have to restart the nameserver.
            /usr/yaku-ns/yaku-ns -c \
             /usr/yaku-ns/yaku-ns.conf \
             -l /usr/yaku-ns/yaku-ns.log \
             -u yaku -d
        fi
    fi
    
    rm -f /tmp/nameserver

    .
    .
    .

This script fragment reads the first given nameserver and replaces the wildcard in the configuration of yaku-ns. Finally, it sends a signal to the yaku-ns process forcing the local nameserver to re-read its configuration.

For testing your installation, you can create and transfer a new image file for your SEGA Dreamcast using cook.sh. Please refer to chapter four and chapter two.


next up previous contents index
Next: Where are we? Up: Setting up an own Previous: Compiling udhcp-0.9.8   Contents   Index
Christian Berger 2004-10-19