Network Environment

From Bootable Cluster CD

This describes what is required and how to set up a simple network for BCCD.

Configuring a BCCD Host as a DNS Server

This is pretty simple at heart. By default, each BCCD image has it's own DNS server already installed. It's called "pdnsd". It is a caching DNS name server that can also take the contents of /etc/hosts and convert use it to answer DNS queries. If a DNS server is not assigned by your DHCP server, there are two DNS servers that are universally available, these are ns1.gnu.org (199.232.76.162) and ns2.gnu.org (195.68.21.199). Check /etc/resolv.conf to see what DNS servers are available to you.

Configuring a BCCD Host as a DHCP server

DHCP stands for Dynamic Host Configuration Protocol. As the name suggests, it is a way to dynamically configure the hosts within a local network. One of the most important components of a distributed environment is a coherent network. If you are playing around with your own computers connected together with a hub or a switch on an isolated network, or coming into some other type of environment where the network isn't exactly "plug-and-play," then you may want to utilize the first node that is booted up in the BCCD pool of hosts as a DHCP server.

A DHCP server can automate the configuration of the local systems by assigning distinct IP addresses, configuring the appropriate network mask, assinging the default gateway, and managing the role of pointing hosts to the appropriate DNS service. Some specifics of the DHCP server used for the BCCD are:

  • Networks: The DHCP server on the BCCD uses a 192.168.1.0/24 network.
  • IP Address: The server's IP address needs to fall in the network range of 192.168.1.0/24, so by default, you are encouraged to use the IP address of 192.168.1.1 for the server.
  • DHCP Range: IP's are assigned by the BCCD server in the range 192.168.1.2 to 192.168.1.199. If you assign static (manual) IP addresses to hosts within your network, use an IP address that does not fall inside of this range.
  • Restrictions: Setting up a DHCP server in the presence of a production network environment can be hazardous to everyone's health. To accomadate situations where the BCCD hosts are to participate along side of existing network services, the BCCD DHCP server will not assign addresses to non-BCCD computers by default!
    • The BCCD DHCP server looks for a specific flag defined in the client DHCP request. If a non-BCCD host sends out a DHCP request, the BCCD DHCP server will not respond to this request. This is to prevent any unintended network hijackings. The BCCD clients carry this field in their DHCP requests which allows them to be identified as BCCD clients.
    • If you have a functional DHCP server on your network already, this extra field is simply ignored by the traditional DHCP server. In this way, you can (and should) leverage exsiting DHCP services if they are available to you.

Step one: Specifying DHCP server roles at bootup

The first step in starting up the BCCD DHCP server occurs at the initial splash screen, or the "boot" prompt:

  • Indicating the use of the DHCP server at bootup:
 Make sure "startdhcp" is one of the arguments when first booting

When your system begins to boot from the BCCD image in the CD drive, you are given a "boot prompt" where you can specify kernel options, special boot parameters, or provided additional functionality to your BCCD image. To have the image start up the DHCP service automatically, you can boot up with the option startdhcp. Note that the "4" in the image above refers to the resolution specification, indicating a screen resolution of 1024x768 capable of supporting the X window environment.

Step two: Bypass automatic configuration, and configure your network manually

Here's the process in "snapshots"...just follow the simple directions listed below. If in doubt, just use all of the suggested "Example" entries in the following screens:

Say no to "Configure using DHCP":  Do not configure automatically
Say yes to "Configure Manually":  Do configure manually
Configure your IP address to 192.168.1.1:  Enter 192.168.1.1 when prompted for an IP Address
Configure your subnet to 255.255.255.0 (automatic):  Leave the default of 255.255.255.0 for the subnet
Specify the router as 192.168.1.254:  Enter 192.168.1.254 when prompted for the default router
Use 192.168.1.1 (this host) as the DNS server:  Enter 192.168.1.1 when prompted for the DNS server
The DHCP server should now have a host name of host1 or an IP of 192.168.1.1.
Great! You're done!  Great!  Your hostname has been set to host1, and /etc/hosts has been updated


Understanding DHCP

Each host that now successfully obtains an IP will be given a specific hostname corresponding to the range 2-199. For example, the first host to successfully DHCP with the server will get the name host199 and an ip of 192.168.1.199. To see how this is working, take a look at the file /etc/hosts on the DHCP server. Inside you'll see that it has all the names for the 192.168.1.0/24 network. pdnsd uses all of these to resolve hostnames. So this means that you need to have seen the "Great! You're done!" screen previously. If you saw the "some clustering applications may not work properly" message, revisit your process, or e-mail the bccd@bccd.cs.uni.edu list for help.

Finagling an outside network connection through your DHCP server

If your system that is serving up DHCP addresses can also reach an external network (e.g., the Internet), you can allow (or disallow when convenient) network access through the DHCP server. The process is a bit advanced, but the basic approach is encapsulated in the following script that you can tune to your local environment:

#-----------Begin Script---------------
#!/bin/bash
#This script (when run by a BCCD with startdhcp enabled) will enable itself and 
#all dhcp'd nodes to connect to the outside world.

#this must only be run by root!
WHOAMI=`whoami`
if test "x$WHOAMI" != "xroot" ; then 
        dialog --stdout --msgbox "You need to run this script as root.  Sorry!" 0 0
        exit -1
fi

#get OLDROUTER
for x in `netstat -rn | awk '{print $2}' | grep -v 0\.0\.0\.0` ; do if test `dotquad $x` ; then OLDROUTER=$x ;  fi ; done

#now we need to get a new host and router ip from the user
NEWIP=`dialog --stdout --inputbox "Specify a network routable IP address for this host:" 0 0 
`
NEWROUTER=`dialog --stdout --inputbox "Specify the network router:" 0 0 `
NEWDNSIP=`dialog --stdout --inputbox "Specify your outside dns server:" 0 0 `

#add a virtual interface
ifconfig eth0:0 $NEWIP

#muck with the routes!
route del default gw $OLDROUTER
route add default gw $NEWROUTER eth0:0

#let's enable ip forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

#changing pdnsd.conf
cat >> /etc/pdnsd.conf <<EOF
#STARTFOO -- INSERTED BY SCRIPTING FOO
server {
        ip="$NEWDNSIP";
        interval=30;
        timeout=60;
        caching=off;
}
#STOPFOO -- INSERTED BY SCRIPTING FOO
EOF

#restart pdnsd
/etc/init.d/pdnsd stop || /bin/true
/etc/init.d/pdnsd start || dialog --msgbox "Bad juju encountered.  Try restarting pdnsd manually" 0 0

# Clear out existing table?
iptables -t nat -F

#some iptables magic foo
iptables -t nat -A POSTROUTING -d ! 192.168.1.0/24 -j SNAT --to $NEWIP
#---------End of Script----------------

Watch for the bad juju.

Personal tools