#!/bin/sh # /etc/rc.d/net: start/stop network # # Edit these values to set up a static IP address: IPADDR="192.168.1.104" # REPLACE with YOUR IP address! GATEWAY="192.168.1.1" # REPLACE with YOUR gateway address! DHCP="no" # Use DHCP ("yes" or "no") case $1 in start) /sbin/ifconfig lo 127.0.0.1 if [ "$DHCP" = "yes" ]; then # use DHCP to set everything up: echo "Attempting to configure eth0 by contacting a DHCP server..." /sbin/dhcpcd elif [ ! "$IPADDR" = "127.0.0.1" ]; then # set up IP statically: # Set up the ethernet card: echo "Configuring eth0 as ${IPADDR}..." /sbin/ifconfig eth0 ${IPADDR} # If there is a gateway defined, then set it up: if [ ! "$GATEWAY" = "" ]; then /sbin/route add default gw ${GATEWAY} fi fi ;; stop) /sbin/ifconfig lo down if [ ! "$IPADDR" = "127.0.0.1" ]; then /sbin/ifconfig eth0 down fi ;; restart) /etc/rc.d/net stop /etc/rc.d/net start ;; *) echo "usage: /etc/rc.d/net [start|stop|restart]" ;; esac # To use DHCP instead of a static IP, set this value to "yes": # OK, time to set up the interface: # End of /etc/rc.d/net