#! /bin/sh # rc.inet1 This shell script boots up the base INET system. # Version: @(#)/etc/rc.d/rc.inet1 2.00 10/06/1999 HOSTNAME=`cat /etc/HOSTNAME` # Attach the loopback device. /sbin/ifconfig lo 127.0.0.1 /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo ##### Configuration du reseau local intranet (eth0) ########### # Edit these values to set up a static IP address: IPADDR0="192.168.0.2" # Adresse IP du serveur sur le reseau interne IPADDR1="192.168.1.2" # Adresse IP du serveur vers le modem externe NETMASK="255.255.255.0" # Masque de reseau, ici 255 machines NETWORK="192.168.0.0" # REPLACE with YOUR network address! BROADCAST="192.168.0.255" # REPLACE with YOUR broadcast address GATEWAY="192.168.1.1" # La passerelle c'est le modem ethernet echo "Configuring eth0 as ${IPADDR0}..." /sbin/ifconfig eth0 ${IPADDR0} broadcast ${BROADCAST} netmask ${NETMASK} # If that didn't succeed, give the system administrator some hints: if [ ! $? = 0 ]; then cat << EOF Your ethernet card was not initialized properly. Here are some reasons why this may have happened, and the solutions: 1. Your kernel does not contain support for your card. Including all the network drivers in a Linux kernel can make it too large to even boot, and sometimes including extra drivers can cause system hangs. To support your ethernet, either edit /etc/rc.d/rc.modules to load the support at boottime, or compile and install a kernel that contains support. 2. You don't have an ethernet card, in which case you should comment out this section of /etc/rc.d/rc.inet1. (Unless you don't mind seeing this error...) EOF fi ##### Configuration du reseau local internet (eth1) ########### DHCP="yes" # Use DHCP ("yes" or "no") # Je laisse le script permettant le choix if [ "$DHCP" = "yes" ]; then # use DHCP to set everything up: echo "Attempting to configure eth1 by contacting a DHCP server..." /sbin/dhcpcd eth1 elif [ ! "$IPADDR1" = "127.0.0.1" ]; then # set up IP statically: # Set up the ethernet card: echo "Configuring eth1 as ${IPADDR1}..." /sbin/ifconfig eth1 ${IPADDR1} broadcast ${BROADCAST} netmask ${NETMASK} /sbin/ifconfig eth1 ${IPADDR1} broadcast 192.168.1.255 netmask 255.255.255.0 up # If there is a gateway defined, then set it up: if [ ! "$GATEWAY" = "" ]; then /sbin/route add default gw ${GATEWAY} netmask 0.0.0.0 metric 1 fi fi # End of rc.inet1