The problem, as someone on the group suggested (thanks! although I
didn't see it immediately), is (I think) due to a bogus default gateway
being defined for device lo. Below I provide the "detective work"
and below the solution.
Using
strace -f /etc/rc.d/init.d/network start eth0
I found that the /etc/sysconfig/network-script/ifup script basically
ran twice, once for each of the lo and eth0 devices. I put in the
GATEWAY="xxx.xxx.xxx.xxx" line in the /etc/sysconfig/network file
with the intention that this gateway would be used to configure
eth0 via the 'route add default gw xxx.xxx.xxx.xxx dev eth0' command.
What I didn't realize was that the ifup script also used this
command to configure lo, the loopback device, via the commmand
'route add default gw xxx.xxx.xxx.xxx dev lo'. The series of command
which do the work for both devices is below the '. /etc/sysconfig/network'
line, and looks like this:
if [ "${GATEWAY}" != "" ]; then
if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
# set up default gateway
route add default gw ${GATEWAY} dev ${DEVICE}
DEFGW=${GATEWAY}
fi
fi
(The 'dev' keyword may be missing, I also added that.) Adding a default
gateway to a loopback device didn't make sense to me, so I put in an
extra if statement to only try and add a gateway if the device being
configured wasn't the lo device. Thus the fix to the problem is a
rewrite of the above lines to:
if [ "${GATEWAY}" != "" ]; then
if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
# set up default gateway
# ATD: do so only for devices other than lo
if [ "${DEVICE}" != lo ]; then
route add default gw ${GATEWAY} dev ${DEVICE}
DEFGW=${GATEWAY}
fi
fi
fi
Now when I do a '/etc/rc.d/init.d/network start eth0' I no longer get
the annoying "Invalid argument" message. The network seems to be working ok.
If there is any reason for preserving the 'route add default gw' command
for device lo, please let me know.
Thanks!
--
Andrew T. Duchowski office:444 Edwards Hall area code:864
Computer Science Dept., MS-1906 tel:656.7677 cel:982.5809 fax:656.0145
Clemson University mailto:and...@cs.clemson.edu
Clemson, SC 29634-1906 http://www.cs.clemson.edu/~andrewd/
Undefine the following variables in the file below GATEWAYDEV GATEWAY
That would be the proper way.
::::::::::::::
/etc/sysconfig/network
::::::::::::::
NETWORKING=yes
FORWARD_IPV4=no
HOSTNAME=xx.xx.xx.xx.nl
GATEWAYDEV=
GATEWAY=
Yeah, I thought about that, but I DO want a gateway when I set up eth0.
It seems to me that there should either be a /etc/sysconfig/network
file for each of the network devices you want (lo, eth0, etc.), or maybe
a way to just start one of the devices up---the way it is now (and I
don't claim to understand it fully), the /etc/sysconfig/network file
is read for both lo and eth0. Or, perhaps more appropriately, when
I say '/etc/rc.d/init.d/network start eth0', the script sets up both
lo and eth0. I'm not really sure whether I'm typing in the command
wrong, or whether lo is even needed...however I'm pretty sure that
both are being configured when really I think I just want eth0.
So in a nutshell, the above elimination of the GATEWAY var seems to
me to be an all-or-none solution, when instead I sometimes need a GATEWAY
(when I want dev eth0 set up), sometimes I don't (when setting up lo).
you wrote:
> >GATEWAYDEV=
> >GATEWAY=
>
> Yeah, I thought about that, but I DO want a gateway when I set up eth0.
> It seems to me that there should either be a /etc/sysconfig/network
> file for each of the network devices you want (lo, eth0, etc.), or maybe
As the script looks - as you wrote - following way:
> if [ "${GATEWAY}" != "" ]; then
> if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
> # set up default gateway
> route add default gw ${GATEWAY} dev ${DEVICE}
> DEFGW=${GATEWAY}
> fi
> fi
Setting GATEWAY to your default Gateway and GATWAYDEV to eth0 should be
ok. While setting up any other then the eth0-interface the the condition
of the second if-statement would be false and due the "route add" would
not be performed.
Malware