CCL Home Page
Up Directory CCL network.txt
#! /bin/bash
#
# network       Bring up/down networking
#
# chkconfig: 2345 10 90
# description: Activates/Deactivates all network interfaces configured to \
#              start at boot time.
# probe: true

INET_ADDRESS[0]=215.252.93.210   # Static addresses assigned by your ISP
INET_ADDRESS[1]=215.252.93.129
INET_ADDRESS[2]=215.252.93.130
INET_ADDRESS[3]=215.252.93.131
INET_ADDRESS[4]=215.252.93.132

INET_NET=215.252.93.0       # NET ADDRESS (usually replace last octet with 0)
INET_NETMASK=255.255.255.0   # NETMASK (here for class C address)
INET_BRDCST=215.252.93.255  # BROADCAST address (usually ends with 255).
INET_GATEWAY=215.252.93.1   # GATEWAY address you got from your ISP
INET_IFACE=eth0              # Interface (where you plug your DSL modem)

LAN_ADDRESS=192.168.0.1     # Address of your LAN side interface
LAN_NET=192.168.0.0         # NET ADDRESS (usually replace last octet with 0)
LAN_NETMASK=255.255.255.0   # NETMASK (here for class C address)
LAN_BRDCST=192.168.0.255    # BROADCAST address (usually ends with 255).
LAN_GATEWAY=192.168.0.1     # Put your LAN card address here
LAN_IFACE=eth1              # Interface (where you plug your DSL modem)

DMZ_ADDRESS=192.168.1.1     # Address of your DMZ side interface
DMZ_NET=192.168.1.0         # NET ADDRESS (usually replace last octet with 0)
DMZ_NETMASK=255.255.255.0   # NETMASK (here for class C address)
DMZ_BRDCST=192.168.1.255    # BROADCAST address (usually ends with 255).
DMZ_GATEWAY=192.168.1.1     # Put your DMZ card address here
DMZ_IFACE=eth2              # Interface (where you plug your DSL modem)

# See how we were called.
case "$1" in
  start)
       /sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.0
       /sbin/route add -host 127.0.0.1 dev lo
       /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 dev lo
       /sbin/ifconfig ${INET_IFACE} ${INET_ADDRESS[0]} \
            arp broadcast ${INET_BRDCST} netmask ${INET_NETMASK} 
       if [ ! $? = 0 ] ; then
          cat << EOF
Your ethernet card on ${INET_IFACE} does not work correctly. Check your
/etc/modules.conf file, and keep correcting it until you can load all
needed ethernet card modules and they show-up in kernel.
    depmod -a
    lsmod
EOF
       fi

       let count=1
       while (( $count < ${#INET_ADDRESS[*]} ))
       do
          /sbin/ifconfig ${INET_IFACE}:${count} ${INET_ADDRESS[count]}
          let count="count + 1"
       done

       /sbin/ifconfig ${LAN_IFACE} ${LAN_ADDRESS} \
            arp broadcast ${LAN_BRDCST} netmask ${LAN_NETMASK}

       if [ ! $? = 0 ] ; then
          cat << EOF
Your ethernet card on ${LAN_IFACE} does not work correctly. Check your
/etc/modules.conf file, and keep correcting it until you can load all
needed ethernet card modules and they show-up in kernel.
    depmod -a
    lsmod
EOF
       fi

       /sbin/ifconfig ${DMZ_IFACE} ${DMZ_ADDRESS} \
            arp broadcast ${DMZ_BRDCST} netmask ${DMZ_NETMASK}

       if [ ! $? = 0 ] ; then
          cat << EOF
Your ethernet card on ${DMZ_IFACE} does not work correctly. Check your
/etc/modules.conf file, and keep correcting it until you can load all
needed ethernet card modules and they show-up in kernel.
    depmod -a
    lsmod
EOF
       fi

       /sbin/route add default gw ${INET_GATEWAY}

       touch /var/lock/subsys/network
       ;;
  stop)

       /sbin/ifconfig lo down

       /sbin/ifconfig ${INET_IFACE} down

       /sbin/ifconfig ${LAN_IFACE} down

       /sbin/ifconfig ${DMZ_IFACE} down

        
        rm -f /var/lock/subsys/network
        ;;
  *)
        echo $"Usage: $0 {start|stop}"
        exit 1
esac

exit 0
Modified: Tue Dec 11 01:54:26 2001 GMT
Page accessed 11870 times since Tue Dec 11 21:04:10 2001 GMT