3. The servers

3.1. Name servers

Precise4 and precise2 will be name servers. Precise1 will serve the client side and precise1 the server side. Installing a name server on a Linux machine is easy, but the configuration requires some thinking. I solved that problem before and made a Perl script that I just recycle here.

That makes the setup.precise2.sh simple:



echo '*********************************************************'
echo '*********************************************************'
echo '*********************************************************'
echo '* Setup precise2 start *'
echo '*********************************************************'
echo '*********************************************************'
echo '*********************************************************'

# SHELL
function aptget {
    DEBIAN_FRONTEND=noninteractive apt-get -y \
     -o Dpkg::Options::="--force-confdef" \
     -o Dpkg::Options::="--force-confold" \
     $@
}

aptget -y update
aptget -y upgrade

ifconfig eth1 10.128.2.100 netmask 255.255.255.0 up
route add -net 10.128.0.0 netmask 255.255.0.0 gw 10.128.2.1

ifconfig
netstat -rn

echo '*********************************************************'
echo '* precise2: install bind *'
echo '*********************************************************'

aptget install bind9
aptget install dnsutils

cd /etc/bind

cp /vagrant/client /vagrant/make_config.perl .
perl make_config.perl client

/etc/init.d/bind9 restart

The file client contains the hosts that the name server must resolve:
gateway	10.128.1.1
win10   10.128.1.100
dnsgw   10.128.2.1
dns     10.128.2.100
proxy   10.128.4.100

The script is in the appendix.

The script for precise4 is the same, with the exception that the file is called server and not client. The file server contains:
proxy 10.128.4.100
web   10.128.5.100
dns   10.128.6.100

3.2. The web server

As a web server, we're not looking for anything special. Just serving a page will do. So we'll use lighthttpd.
echo '*********************************************************'
echo '*********************************************************'
echo '*********************************************************'
echo '*           Setup precise3 start                        *'
echo '*********************************************************'
echo '*************WEB SERVER**********************************'
echo '*********************************************************'
  # SHELL
function aptget {
	DEBIAN_FRONTEND=noninteractive apt-get -y \
	   -o Dpkg::Options::="--force-confdef" \
	   -o Dpkg::Options::="--force-confold" \
	    $@
}
aptget -y update
aptget -y upgrade
ifconfig eth1 10.128.5.100 netmask 255.255.255.0 up
route add -net 10.128.0.0 netmask 255.255.0.0 gw 10.128.5.1
ifconfig
netstat -rn
aptget install lighthttpd

And lo and behold, we can get the default page on the IP address of the web server.

http-direct.png>