cat > /etc/init.d/ethnet << "EOF"
#!/bin/sh
# Begin /etc/init.d/ethnet
#
# Main script by Gerard Beekmans - gerard@linuxfromscratch.org
# GATEWAY check by Jean-Franois Le Ray - jfleray@club-internet.fr
# "Specify which IF to use to reach default GATEWAY" by
#     Graham Cantin - gcantin@pacbell.net
#

#
# Include the functions declared in the /etc/init.d/functions file
# and the variables from the /etc/sysconfig/network file.
#

source /etc/init.d/functions
source /etc/sysconfig/network

case "$1" in
        start)

#
# Obtain all the network card configuration files
#

        for interface in $(/bin/ls /etc/sysconfig/nic-config/ifcfg* | \
            grep -v ifcfg-lo)
        do
#
# Load the variables from that file
#

            source $interface
#
# If the ONBOOT variable is set to yes, process this file and bring the
# interface up.
#

            if [ "$ONBOOT" == yes ]
            then
                echo -n "Bringing up the $DEVICE interface..."
                /sbin/ifconfig $DEVICE $IP broadcast $BROADCAST \
                    netmask $NETMASK
                evaluate_retval
            fi
        done

#
# If the /etc/sysconfig/network file contains a GATEWAY variable, set
# the default gateway and the interface through which the default
# gateway can be reached.
#

            if [ "$GATEWAY" != "" ]; then
                echo -n "Setting up routing for $GATEWAY_IF interface..."
                /sbin/route add default gateway $GATEWAY \
                        metric 1 dev $GATEWAY_IF
                evaluate_retval
            fi
                ;;

        stop)

#
# Obtain all the network card configuration files
#

        for interface in $(/bin/ls /etc/sysconfig/nic-config/ifcfg* | \
            grep -v ifcfg-lo)
        do
#
# Load the variables from that file
#

            source $interface
#
# If the ONBOOT variable is set, process the file and bring the
# interface down
#

            if [ $ONBOOT == yes ]
            then
                echo -n "Bringing down the $DEVICE interface..."
                /sbin/ifconfig $DEVICE down
                evaluate_retval
            fi
        done
                ;;

        restart)
                $0 stop
                sleep 1
                $0 start
                ;;
        *)
                echo "Usage: $0 {start|stop|restart}"
                exit 1
                ;;
esac

# End /etc/init.d/ethnet
EOF

cat >> /etc/sysconfig/network << "EOF"
GATEWAY=192.168.1.2
GATEWAY_IF=eth0
EOF

mkdir /etc/sysconfig/nic-config

cat > /etc/sysconfig/nic-config/ifcfg-eth0 << "EOF"
ONBOOT=yes
DEVICE=eth0
IP=192.168.1.1
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
EOF
