# /etc/rc.net # Linux networking startup script. Should be run by /etc/rc.local at # boot time. Configures the interfaces and starts the deamons. # It assumes hostname has been set. # # echo -n "/etc/rc.net: " HOSTS=/etc/hosts INETD=/sbin/inetd NAMED=/sbin/named PORTMAP=/sbin/rpc.portmap NFSD=/sbin/rpc.nfsd MOUNTD=/sbin/rpc.mountd IPDEV=eth0 HOSTNAME=`hostname` # This needs more testing and more diagnostics. */ IPADDR=`grep "^[^#]*\b$HOSTNAME\b" $HOSTS | cut -f1` echo -n "$HOSTNAME($IPADDR)" # Router, get it from the /etc/hosts file ROUTER=`grep "^[^#]*\brouter\b" $HOSTS | cut -f1` # Net, get it from the /etc/HOSTNAME file NET=`grep "^[^#]*\bnetwork\b" $HOSTS | cut -f1` ifconfig lo 127.0.0.1 up netmask 255.255.255.0 route add 127.0.0.1 dev lo if [ "$IPADDR" != "" ]; then ifconfig $IPDEV $IPADDR up netmask 255.255.255.0 route add $IPADDR dev $IPDEV metric 1 # ifconfig plip1 192.0.3.131 # route add 192.0.3.132 dev plip1 fi if [ "" != "$NET" ]; then /sbin/route add network dev $IPDEV; fi if [ "" != "$ROUTER" ]; then /sbin/route add default gw router dev $IPDEV; fi if [ -x $PORTMAP ]; then echo -n ", `basename $PORTMAP`" $PORTMAP fi if [ -x $INETD ]; then echo -n ", `basename $INETD`" $INETD fi if [ -x $NAMED ]; then echo -n ", `basename $NAMED`" $NAMED fi if [ -x $NFSD ]; then echo -n ", `basename $NFSD`" $NFSD -f /etc/exports fi if [ -x $MOUNTD ]; then echo -n ", `basename $MOUNTD`" $MOUNTD fi echo ""