[CCP14 Home: (Frames | No Frames)]
CCP14 Mirrors: [UK] | [CA] | [US] | [AU]

(This Webpage Page in No Frames Mode)

Collaborative Computational Project Number 14

for Single Crystal and Powder Diffraction

CCP14

Setting up Virtual IP Addresses in Linux

The CCP14 Homepage is at http://www.ccp14.ac.uk

[Back to CCP14 Web/Config Main Page] | [Moving IP addresses to a redundant secondary server]

Why note this info down

(Many internet HOW-To's on this subject are not applicable to Redhat 7.3 in using the route command)

Because this is done once in a blue moon and is non-obvious.

Also, most of the information about this on the Internet seems to be wrong - at least it is not applicable for Redhat 7.3.


Put the following in your /etc/rc.d/rc.local file to work in startup (many Linux tutorials on this seem to not be applicable to Redhat 7.3)

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

#Start sshd secureshell deamon

echo "Starting sshd secureshell deamon - startup in /etc/rc.d/rc.local"

/usr/local/sbin/sshd

#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

#Not working on Redhat 7.3 (did on 7.2)
# Make the Atapi  CD-ROM and DVDRAM look like a SCSI Device
# so you can then write to the DVDRAM using cdrecord:
# SuSE Linux 7.0: Writing CDs with ATAPI writers
# http://sdb.suse.de/en/sdb/html/mkrapp-cdwriting-7.0.html
# Latest CDrecord with DVD support
# http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/cdrecord.html
#/sbin/modprobe ide-scsi

#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

ping -vc1 -w 2 193.61.35.93

     if [  $? -eq 1 ]; then
           echo "ping 193.61.35.93 dldata.cryst.bbk.ac.uk is not alive and pingable - continue with ccp14live script"
        else
           echo "warning 193.61.35.93 dldata.cryst.bbk.ac.uk is alive and pingable! - exiting ccp14live script"
             exit 127
        fi


ping -vc1 -w 2 193.61.32.164

     if [  $? -eq 1 ]; then
           echo "ping 193.61.32.164 debian.ccp14.cryst.bbk.ac.uk is not pingable - continue with ccp14live script"
        else
           echo "warning 193.61.32.164 debian.ccp14.cryst.bbk.ac.uk is alive and pingable! - exiting ccp14live script"
             exit 127
        fi

ping -vc1 -w 2 193.61.32.162

     if [  $? -eq 1 ]; then
           echo "ping 193.61.32.162 ftp.ccp14.cryst.bbk.ac.uk is not pingable - continue with ccp14live script"
        else
           echo "warning 193.61.32.162 ftp.ccp14.cryst.bbk.ac.uk is alive and pingable! - exiting ccp14live script"
             exit 127
        fi

ping -vc1 -w 2 193.61.32.163

     if [  $? -eq 1 ]; then
           echo "ping 193.61.32.163 redhat.ccp14.cryst.bbk.ac.uk is not pingable - continue with ccp14live script"
        else
           echo "warning 193.61.32.163 redhat.ccp14.cryst.bbk.ac.uk is alive and pingable! - exiting ccp14live script"
             exit 127
        fi

ping -vc1 -w 2 193.61.32.165

     if [  $? -eq 1 ]; then
           echo "ping 193.61.32.165 freebsd.ccp14.cryst.bbk.ac.uk is not pingable - continue with ccp14live script"
        else
           echo "warning 193.61.32.165 freebsd.ccp14.cryst.bbk.ac.uk is alive and pingable! - exiting ccp14live script"
             exit 127
        fi

ping -vc1 -w 2 193.61.32.166

     if [  $? -eq 1 ]; then
           echo "ping 193.61.32.166 cerebus.ccp14.cryst.bbk.ac.uk is not pingable - continue with ccp14live script"
        else
           echo "warning 193.61.32.166 cerebus.ccp14.cryst.bbk.ac.uk is alive and pingable! - exiting ccp14live script"
             exit 127
        fi

ping -vc1 -w 2 193.61.32.167

     if [  $? -eq 1 ]; then
           echo "ping 193.61.32.167 ccp14dev.ccp14.cryst.bbk.ac.uk is not pingable - continue with ccp14live script"
        else
           echo "warning 193.61.32.167 ccp14dev.ccp14.cryst.bbk.ac.uk is alive and pingable! - exiting ccp14live script"
             exit 127
        fi

#setting up IP alias interfaces

echo "Setting up IP Aliases - script in /etc/rc.d/rc.local"

echo "Internal network aliases"

#mill.cryst.bbk.ac.uk is eth0 (Internal network)
#dldata.cryst.bbk.ac.uk
echo "Setting dldata.cryst.bbk.ac.uk 193.61.35.93 IP Aliases internal network"
/sbin/ifconfig eth0:1 193.61.35.93  netmask 255.255.254.0
# /sbin/route add -host 193.61.35.93  dev eth0:1

echo "Ping the gateways and DNS once to clear the ARP cache"

sleep 1

ping -vc1 -w 3 -I 193.61.35.93 193.61.34.245
ping -vc1 -w 3 -I 193.61.35.93 193.61.32.245
ping -vc1 -w 3 -I 193.61.35.93 193.61.34.17
ping -vc1 -w 3 -I 193.61.35.93 193.61.35.38

echo "Ping the internal and external broadcast address once to clear the ARP cache"

sleep 1

ping -vc1 -b -w 3 -I 193.61.35.93 193.61.35.255
ping -vc1 -b -w 3 -I 193.61.35.93 193.61.32.255

sleep 1

#debian.ccp14.cryst.bbk.ac.uk
#This is the important one that all the web virtual addresses use
echo "Setting debian.ccp14.cryst.bbk.ac.uk 193.61.32.164 IP Aliases"
echo "This is the important one that all the web virtual addresses use"
/sbin/ifconfig eth1:1 193.61.32.164
# /sbin/route add -host 193.61.32.164  dev eth1:1

echo "Ping the gateways and DNS once to clear the ARP cache"

sleep 1

ping -vc1 -w 3 -I 193.61.32.164 193.61.34.245
ping -vc1 -w 3 -I 193.61.32.164 193.61.32.245
ping -vc1 -w 3 -I 193.61.32.164 193.61.34.17
ping -vc1 -w 3 -I 193.61.32.164 193.61.35.38

echo "Ping the internal and external broadcast address once to clear the ARP cache"

sleep 1

ping -vc1 -b -w 3 -I 193.61.32.164 193.61.35.255
ping -vc1 -b -w 3 -I 193.61.32.164 193.61.32.255

sleep 1


#hume.cryst.bbk.ac.uk is eth1 (external network)
#ftp.ccp14.cryst.bbk.ac.uk
echo "Setting ftp.ccp14.cryst.bbk.ac.uk 193.61.32.162 IP Aliases"
/sbin/ifconfig eth1:2 193.61.32.162
# /sbin/route add -host 193.61.32.162  dev eth1:2

echo "Ping the gateways and DNS once to clear the ARP cache"

sleep 1

ping -vc1 -w 3 -I 193.61.32.162 193.61.34.245
ping -vc1 -w 3 -I 193.61.32.162 193.61.32.245
ping -vc1 -w 3 -I 193.61.32.162 193.61.34.17
ping -vc1 -w 3 -I 193.61.32.162 193.61.35.38

echo "Ping the internal and external broadcast address once to clear the ARP cache"

sleep 1

ping -vc1 -b -w 3 -I 193.61.32.162 193.61.35.255
ping -vc1 -b -w 3 -I 193.61.32.162 193.61.32.255

sleep 1

#redhat.ccp14.cryst.bbk.ac.uk
echo "Setting redhat.ccp14.cryst.bbk.ac.uk 193.61.32.163 IP Aliases"
/sbin/ifconfig eth1:3 193.61.32.163
# /sbin/route add -host 193.61.32.163  dev eth1:3

echo "Ping the gateways and DNS once to clear the ARP cache"

sleep 1

ping -vc1 -w 3 -I 193.61.32.163 193.61.34.245
ping -vc1 -w 3 -I 193.61.32.163 193.61.32.245
ping -vc1 -w 3 -I 193.61.32.163 193.61.34.17
ping -vc1 -w 3 -I 193.61.32.163 193.61.35.38

echo "Ping the internal and external broadcast address once to clear the ARP cache"

sleep 1

ping -vc1 -b -w 3 -I 193.61.32.163 193.61.35.255
ping -vc1 -b -w 3 -I 193.61.32.163 193.61.32.255

sleep 1

#freebsd.ccp14.cryst.bbk.ac.uk
echo "Setting freebsd.ccp14.cryst.bbk.ac.uk 193.61.32.165 IP Aliases"
/sbin/ifconfig eth1:4 193.61.32.165
# /sbin/route add -host 193.61.32.165  dev eth1:4

echo "Ping the gateways and DNS once to clear the ARP cache"

sleep 1

ping -vc1 -w 3 -I 193.61.32.165 193.61.34.245
ping -vc1 -w 3 -I 193.61.32.165 193.61.32.245
ping -vc1 -w 3 -I 193.61.32.165 193.61.34.17
ping -vc1 -w 3 -I 193.61.32.165 193.61.35.38

echo "Ping the internal and external broadcast address once to clear the ARP cache"

sleep 1

ping -vc1 -b -w 3 -I 193.61.32.165 193.61.35.255
ping -vc1 -b -w 3 -I 193.61.32.165 193.61.32.255

sleep 1

#cerebus.ccp14.cryst.bbk.ac.uk
echo "Setting cerebus.ccp14.cryst.bbk.ac.uk 193.61.32.166 IP Aliases"
/sbin/ifconfig eth1:5 193.61.32.166
# /sbin/route add -host 193.61.32.166  dev eth1:5

echo "Ping the gateways and DNS once to clear the ARP cache"

sleep 1

ping -vc1 -w 3 -I 193.61.32.166 193.61.34.245
ping -vc1 -w 3 -I 193.61.32.166 193.61.32.245
ping -vc1 -w 3 -I 193.61.32.166 193.61.34.17
ping -vc1 -w 3 -I 193.61.32.166 193.61.35.38

echo "Ping the internal and external broadcast address once to clear the ARP cache"

sleep 1

ping -vc1 -b -w 3 -I 193.61.32.166 193.61.35.255
ping -vc1 -b -w 3 -I 193.61.32.166 193.61.32.255

sleep 1

#ccp14dev.ccp14.cryst.bbk.ac.uk
echo "Setting ccp14dev.ccp14.cryst.bbk.ac.uk 193.61.32.167 IP Aliases"
/sbin/ifconfig eth1:6 193.61.32.167
# /sbin/route add -host 193.61.32.167  dev eth1:6

echo "Ping the gateways and DNS once to clear the ARP cache"

sleep 1

ping -vc1 -w 3 -I 193.61.32.167 193.61.34.245
ping -vc1 -w 3 -I 193.61.32.167 193.61.32.245
ping -vc1 -w 3 -I 193.61.32.167 193.61.34.17
ping -vc1 -w 3 -I 193.61.32.167 193.61.35.38

echo "Ping the internal and external broadcast address once to clear the ARP cache"

sleep 1

ping -vc1 -b -w 3 -I 193.61.32.167 193.61.35.255
ping -vc1 -b -w 3 -I 193.61.32.167 193.61.32.255

sleep 1

#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

#Start samba smbd nmbd

echo "Starting samba smbd nmbd deamon - startup in /etc/rc.d/rc.local"
echo "config file for samba in /usr/local/samba/lib/"

/usr/local/samba/bin/smbd -D
/usr/local/samba/bin/nmbd -D

#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

#Start Apache 2 webserver

echo "Starting apache webserver - startup in /etc/rc.d/rc.local"

/usr/local/apache2/bin/apachectl  start


#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

#Start Proftpd ftp server ftp deamon

echo "Starting apache webserver - startup in /etc/rc.d/rc.local"

/usr/local/sbin/proftpd

#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

#Start rsync server deamon

echo "Starting rsync server deamon - startup in /etc/rc.d/rc.local"

/usr/local/bin/rsync --daemon


Using netstat -rn you should have something like the following:

[ccp14@mill rc.d]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
193.61.32.0     0.0.0.0         255.255.255.0   U        40 0          0 eth1
193.61.34.0     0.0.0.0         255.255.254.0   U        40 0          0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U        40 0          0 lo
0.0.0.0         193.61.32.245   0.0.0.0         UG       40 0          0 eth1


After enabling this, you should get the following after you type ifconfig -a

mill 2% ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:02:B3:63:EF:43
          inet addr:193.61.35.89  Bcast:193.61.35.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1166 errors:0 dropped:0 overruns:0 frame:0
          TX packets:268 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:104255 (101.8 Kb)  TX bytes:19936 (19.4 Kb)
          Interrupt:5 Base address:0x2000

eth0:1    Link encap:Ethernet  HWaddr 00:02:B3:63:EF:43
          inet addr:193.61.35.93  Bcast:193.61.35.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:5 Base address:0x2000

eth1      Link encap:Ethernet  HWaddr 00:02:B3:63:EF:35
          inet addr:193.61.32.160  Bcast:193.61.32.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:846 errors:0 dropped:0 overruns:0 frame:0
          TX packets:131 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:79710 (77.8 Kb)  TX bytes:6622 (6.4 Kb)
          Interrupt:10 Base address:0x4000

eth1:1    Link encap:Ethernet  HWaddr 00:02:B3:63:EF:35
          inet addr:193.61.32.164  Bcast:193.61.32.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:10 Base address:0x4000

eth1:2    Link encap:Ethernet  HWaddr 00:02:B3:63:EF:35
          inet addr:193.61.32.162  Bcast:193.61.32.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:10 Base address:0x4000

eth1:3    Link encap:Ethernet  HWaddr 00:02:B3:63:EF:35
          inet addr:193.61.32.163  Bcast:193.61.32.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:10 Base address:0x4000

eth1:4    Link encap:Ethernet  HWaddr 00:02:B3:63:EF:35
          inet addr:193.61.32.165  Bcast:193.61.32.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:10 Base address:0x4000

eth1:5    Link encap:Ethernet  HWaddr 00:02:B3:63:EF:35
          inet addr:193.61.32.166  Bcast:193.61.32.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:10 Base address:0x4000

eth1:6    Link encap:Ethernet  HWaddr 00:02:B3:63:EF:35
          inet addr:193.61.32.167  Bcast:193.61.32.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:10 Base address:0x4000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:31 errors:0 dropped:0 overruns:0 frame:0
          TX packets:31 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3080 (3.0 Kb)  TX bytes:3080 (3.0 Kb)

/usr/local/bin/ccp14dead script - refer Moving IP addresses and services to a redundant secondary internet server under Linux


/usr/local/bin/ccp14live script - refer Moving IP addresses and services to a redundant secondary internet server under Linux


Other commands

http://www.geocities.com/SiliconValley/Foothills/7626/net.html

shutdown -r -t 5 now blah

ifconfig lo down
ifconfig lo up

ifconfig eth0 down
ifconfig eth0 up

ifconfig eth1 down
ifconfig eth1 up

ifconfig eth0 193.61.32.160 up

route add default gw 193.61.32.245

#delete route and IP for dldata.cryst.bbk.ac.uk 193.61.35.93
/sbin/route del -host 193.61.35.93 dev eth0:1
/sbin/ifconfig -v eth0:1 del  193.61.35.93

/sbin/route del -host 193.61.32.164 dev eth1:1
/sbin/ifconfig -v eth1:1 del  193.61.32.164


[Back to CCP14 Web/Config Main Page] | [Moving IP addresses to a redundant secondary server]

[CCP14 Home: (Frames | No Frames)]
CCP14 Mirrors: [UK] | [CA] | [US] | [AU]

(This Webpage Page in No Frames Mode)

If you have any queries or comments, please feel free to contact the CCP14