slitaz-boot-scripts rev 8
Add network init script and config file
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Nov 30 12:34:07 2007 +0100 (2007-11-30) |
parents | 1ceb004d3c43 |
children | a052c0a3dd7f |
files | etc/init.d/network.sh etc/network.conf |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/etc/init.d/network.sh Fri Nov 30 12:34:07 2007 +0100 1.3 @@ -0,0 +1,32 @@ 1.4 +#!/bin/sh 1.5 +# /etc/init.d/network.sh - Network initialisation boot script. 1.6 +# Config file is: /etc/network.conf 1.7 +# 1.8 +. /etc/init.d/rc.functions 1.9 +. /etc/network.conf 1.10 + 1.11 +# Set hostname. 1.12 +echo -n "Setting hostname... " 1.13 +/bin/hostname -F /etc/hostname 1.14 +status 1.15 + 1.16 +# Configure loopback interface. 1.17 +echo -n "Configure loopback... " 1.18 +/sbin/ifconfig lo 127.0.0.1 up 1.19 +/sbin/route add 127.0.0.1 lo 1.20 +status 1.21 + 1.22 +# For a dynamic IP with DHCP. 1.23 +if [ "$DHCP" = "yes" ] ; then 1.24 + echo "Starting udhcpc client on: $INTERFACE... " 1.25 + /sbin/udhcpc -b -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid 1.26 +fi 1.27 + 1.28 +# For a static IP. 1.29 +if [ "$STATIC" = "yes" ] ; then 1.30 + echo "Configuring static IP on $INTERFACE: $IP... " 1.31 + /sbin/ifconfig $INTERFACE $IP netmask $NETMASK up 1.32 + /sbin/route add default gateway $GATEWAY 1.33 + echo "nameserver $DNS_SERVER" > /etc/resolv.conf 1.34 +fi 1.35 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/etc/network.conf Fri Nov 30 12:34:07 2007 +0100 2.3 @@ -0,0 +1,25 @@ 2.4 +# /etc/network.conf: SliTaz system wide networking configuration. 2.5 +# Config file used by: /etc/init.d/network.sh 2.6 +# 2.7 + 2.8 +# Set default interface. 2.9 +INTERFACE="eth0" 2.10 + 2.11 +# Dynamic IP address. 2.12 +# Enable/disable DHCP client at boot time. 2.13 +DHCP="yes" 2.14 + 2.15 +# Static IP address. 2.16 +# Enable/disable static IP at boot time. 2.17 +STATIC="no" 2.18 + 2.19 +# Set IP address, and netmask for a static IP. 2.20 +IP="192.168.0.6" 2.21 +NETMASK="255.255.255.0" 2.22 + 2.23 +# Set route gateway for a static IP. 2.24 +GATEWAY="192.168.0.1" 2.25 + 2.26 +# Set DNS server. for a static IP. 2.27 +DNS_SERVER="192.168.0.1" 2.28 +