DNS and Routing Setup

Here are some general tips on setting up ones connection to a network. One may or may not have to use everything listed here. Just pick out what you need for your system.

  1. Set a netmask. Do this in the file: /etc/config/ifconfig-1.options On my system, I have the single line: arp netmask 255.255.255.224 However, my network is sub netted into 8 subnets, so one will probably need to use something else. Check the man page for `ifconfig' for details.
    (Sample equation for subnetting: last byte= !( (256/# subnets) -1 ) )

  2. Set up one's routes. IF you have a PROPERLY configured network, the default of having `routed' chkconfig'ed on will work. However, a lot of people do NOT have PROPERLY configured networks, so they have to set up static routes. I've seen THREE ways of doing this and I've done it the first two ways listed below, but I'm currently only using the `gated' method (b. below), because it has some advantages over old way I was doing things.

    1. Create static routes by creating the file /etc/init.d/network.local with the following symbolic links to it: /etc/rc0.d/K39network & /etc/rc2.d/S31network My network.local file looks something like this:

      ---------------------- Start of network.local ----------------------
      #! /bin/sh
      #
      # Since the routers don't work correctly, we have to turn routed off and
      #   add static routes.
      #
      #   Brent L. Bates  9508.22
      #
      
      if /etc/chkconfig routed; then :
            exit
      fi
      
      case "$1" in
         'start')
            echo "Adding Static Routes"
            route add net default `IP address or name of router' 0
            route add net `another network' `IP address or name of router' 1
            ;;
         'stop')
            echo "Deleting Static Routes"
            route delete net default `IP address or name of router'
            route delete net `another network' `IP address or name of router'
            ;;
         *)
            echo "usage: $0 {start|stop}"
            ;;
      esac
      
      ----------------------- End of network.local -----------------------

      Either list IP addresses above or use the router name AND have the router name listed in your /etc/hosts file.

      Don't forget to do `chkconfig routed off', or the above script will NOT be run. Also see resolv.conf info below. For the other networks, if you have multiple routers/routes, either use the IP address or put the name and address in the file /etc/networks. Here are some sample lines from my /etc/networks file:

      ------------------------- Start of networks -------------------------
      nsf             128.150         national-science-foun-net
      larcnet         128.155         NASA-Langley-Net LaRCNET LaRCNET-Backbone
      lerc            128.156         NASA-Lewis-Net
      
      -------------------------- End of networks --------------------------

    2. The other way is to create a file /etc/gated.conf and turn on gated. I have this working fine on one machine and it is suppose to have some advantages over the other way of creating static routes. The sample file someone posted looked like this:

        (Note: on the `defaultgateway' line below, `passive' may need to be changed to `active'. I've seen people use it both ways and work, so I'm not sure what the differences are. `passive' seems to work fine on my system.)

      ----------------------- Start of gated.conf -----------------------
      # gated.conf
      #
      #
      # The information in the file is identified by the keywords which commence
      # at the start of a new line. Any text to the right of a # is a comment.
      # To change initialization info after egpup is running, kill the process
      # (which will initiate the correct cease message exchange) and restart it.
      
      # Trace options
      #traceflags general
      
      # Don't use any of the fancy routing
      # protocols - just install some static routes
      
      RIP     no
      HELLO   no
      EGP     no
      
      defaultgateway		`IP address or name' rip	metric 0 passive
      net `IP or name'	gateway `IP or name'		metric 1 rip
      
      ------------------------ End of gated.conf ------------------------

    3. The last way only allows one route, requires the proper patch on IRIX 6.2 systems, and uses the file /var/config/static-route.options. This file should look like this:
      $ROUTE $QUIET add net default xxx.xxx.xxx.xxx
      
  3. The final item is to make sure your names are getting resolved properly. Here are my notes on that:

    For IRIX < 6.5, I have 3 types of lines in my /etc/resolv.conf file. The `hostresorder' line isn't used for IRIX >= 6.5 and the file /etc/nsswitch.conf replaces this lines functionality.

    hostresorder local bind
    domain `your_domain_name_hear'
    nameserver `IP address of name server'
    

    Use one's domain name in the second line. On the first line the `local' MUST be first. If one is also running NIS (Yellow pages), then one wants `nis' before `bind' but AFTER `local'. One can have up to 3 nameserver lines. It checks them in the order they are listed. If a server is down or doesn't resolve the name, it goes to the next name server. Make sure all the name servers listed still work. If a name server is permanently out, delete it from the list or one could have problems. Some old software looks for the resolv.conf file in a different directory so put a symbolic link in /usr/etc/resolv.conf pointing to /etc/resolv.conf. (The last sentence isn't needed for IRIX 6.2 or greater. Just have the file in /etc.)

    For IRIX >= 6.5, make sure one has a line in their /etc/nsswitch.conf file that looks like this:

    hosts:                  files dns
    

    The same rules listed above for the `hostresorder' line also apply to this line as well (`local' is replaced with `files' and `bind' is replaced with `dns'). If one isn't using NIS at all, delete all references to `nis' in this file. If one is using NIS, then `nis' should be AFTER `files' but before `dns'. I also have the following in the /etc/config/nsd.options file:

    	-a nis_security=local -a wait_for_server=true -a negative_timeout=0
       

    One also needs at least a minimal /etc/hosts file. One needs at a MINIMUM two lines in their /etc/hosts file. One like the following:

    127.0.0.1       localhost loopback loghost me
    

    and one with YOUR machines IP address, the FQDN, and maybe some other aliases. One MUST use the FQDN AND it MUST be listed as the FIRST name with in that line. I would ALSO add entries for a few local hosts that one wants to get to even if the network connections are lost to all the name servers. This includes machines one mounts/shares NFS mounts with. The file /etc/sys_id should have the short alias name and not the FQDN.

    If one is having intermittent DNS problems, instead of rebooting, one might want to try using `nsadmin restart'. Every once in a while, I'll see DNS time out on a lot of look ups. After a `nsadmin restart', DNS works fine. The `nslookup' command does not go through `nsd', it only uses the /etc/resolv.conf, so one can use this to test name servers with out going through `nsd'.

I hope this is of some help.


If you have any comments on any of my pages, please email me at: blbates@vigyan.com, thanks.

Total number of accesses to this page since its creation :

Last update: August 19, 2002