# HG changeset patch # User Christophe Lincoln # Date 1196422447 -3600 # Node ID e860c8bd2c5711d922d85759d82430bd49d5f1d6 # Parent 1ceb004d3c434651764a45e4a1886decd3954bfb Add network init script and config file diff -r 1ceb004d3c43 -r e860c8bd2c57 etc/init.d/network.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/etc/init.d/network.sh Fri Nov 30 12:34:07 2007 +0100 @@ -0,0 +1,32 @@ +#!/bin/sh +# /etc/init.d/network.sh - Network initialisation boot script. +# Config file is: /etc/network.conf +# +. /etc/init.d/rc.functions +. /etc/network.conf + +# Set hostname. +echo -n "Setting hostname... " +/bin/hostname -F /etc/hostname +status + +# Configure loopback interface. +echo -n "Configure loopback... " +/sbin/ifconfig lo 127.0.0.1 up +/sbin/route add 127.0.0.1 lo +status + +# For a dynamic IP with DHCP. +if [ "$DHCP" = "yes" ] ; then + echo "Starting udhcpc client on: $INTERFACE... " + /sbin/udhcpc -b -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid +fi + +# For a static IP. +if [ "$STATIC" = "yes" ] ; then + echo "Configuring static IP on $INTERFACE: $IP... " + /sbin/ifconfig $INTERFACE $IP netmask $NETMASK up + /sbin/route add default gateway $GATEWAY + echo "nameserver $DNS_SERVER" > /etc/resolv.conf +fi + diff -r 1ceb004d3c43 -r e860c8bd2c57 etc/network.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/etc/network.conf Fri Nov 30 12:34:07 2007 +0100 @@ -0,0 +1,25 @@ +# /etc/network.conf: SliTaz system wide networking configuration. +# Config file used by: /etc/init.d/network.sh +# + +# Set default interface. +INTERFACE="eth0" + +# Dynamic IP address. +# Enable/disable DHCP client at boot time. +DHCP="yes" + +# Static IP address. +# Enable/disable static IP at boot time. +STATIC="no" + +# Set IP address, and netmask for a static IP. +IP="192.168.0.6" +NETMASK="255.255.255.0" + +# Set route gateway for a static IP. +GATEWAY="192.168.0.1" + +# Set DNS server. for a static IP. +DNS_SERVER="192.168.0.1" +