[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: network startup script



On Wed, 15 Apr 1998, Hamish Moffatt wrote:

> Can anyone suggest why this script doesn't seem to work on 2.1.90?
> It's my /etc/init.d/network. I added the netmask on the route line
> for lo because it seemed to help, but I still get some other errors,
> and ifconfig seems to hang.
> 
> #!/bin/sh
> ifconfig lo 127.0.0.1
> route add -net 127.0.0.0 netmask 255.0.0.0
> 
> IPADDR=203.14.18.11
> NETMASK=255.255.255.128
> NETWORK=203.14.18.0
> BROADCAST=203.14.18.127
> GATEWAY=203.14.18.1
> 
> ifconfig eth0 ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
> route add -net ${NETWORK}
> route add default gw ${GATEWAY} metric 1

The 2.1.x series kernels automagically add the net routes by default.  If
you need to override them, you need to provide the netmask and other
information as well, it isn't extrapolated anymore.  I've edited my
/etc/init.d/network as follows (it might be good for the netconfig stuff
from hamm to do something similar):

--- snip ---
#!      /bin/sh
ifconfig lo 127.0.0.1

# 2.1.x kernels don't need this and emit harmless but annoying errors
if [ `/sbin/kernelversion` = "2.0" ] ; then
        route add -net 127.0.0.0
fi

IPADDR=xxx.xxx.xxx.xxx
NETMASK=255.255.255.0
NETWORK=xxx.xxx.xxx.0
BROADCAST=xxx.xxx.xxx.255
GATEWAY=xxx.xxx.xxx.1
ifconfig eth0 ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}

# 2.1.x kernels don't need this and emit harmless but annoying errors
if [ `/sbin/kernelversion` = "2.0" ] ; then
        route add -net ${NETWORK}
fi

[ "${GATEWAY}" ] && route add default gw ${GATEWAY} metric 1
--- snip ---

-- 
Scott K. Ellis <storm@gate.net>                 http://www.gate.net/~storm/


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: