* [gentoo-dev] Problem with net.eth1 startup script
@ 2002-03-07 7:05 Todd Punderson
2002-03-07 11:08 ` Martin Schlemmer
0 siblings, 1 reply; 3+ messages in thread
From: Todd Punderson @ 2002-03-07 7:05 UTC (permalink / raw
To: gentoo-dev
Hello,
After doing a update --world to upgrade about 2 months worth of
packages, I ran into this problem. I was following the directions to set
up multiple network cards. Here is what I have done so far and some
snippets of my config files.
I edited /etc/conf.d/net to look like this: (edited for clarity, the
rest of the file is commented lines)
iface_eth0="192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0"
iface_eth1="dhcp"
dhcpcd_eth1="-R"
NOTE: eth0 configures correctly on bootup. The drivers for the network
card are also loaded properly. If I run dhcpcd manually, it works fine.
I copied net.eth0 to net.eth1 as per the directions.
From net.eth1:
if [ "`eval echo "\$\{iface_${IFACE}\}"`" != "dhcp" ]
then
eval /sbin/ifconfig "$IFACE" "\$iface_$IFACE" >/dev/null 2>&1 || return $?
else
eval /sbin/dhcpcd "\$\{dhcpcd_${IFACE}\}" "$IFACE" >/dev/null 2>&1 || return $?
fi
The problem is that net.eth1 will not start up as dhcp. I edited the
net.eth1 to see what it was trying to do by throwing some echo's in just
to see where it was...Everytime no matter what the setting is in
conf.d/net, it will only hit the "then" off that if statement. I hacked
the script to look like this:
if [ "`eval echo "\$\{iface_${IFACE}\}"`" != "dhcp" ]
then
eval /sbin/dhcpcd -R eth1 >/dev/null 2>&1 || return $?
else
eval /sbin/ifconfig "$IFACE" "\$iface_$IFACE" >/dev/null 2>&1 || return $?
fi
This works for the time being, but I'd like to correct the root cause of
the problem. While starting up, it says "Bringing eth1 up" so I know
$IFACE has the correct value. But I am stumped as to why the rest isn't
working.
Any help is appreciated!
--
Todd Punderson <todd@doonga.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-dev] Problem with net.eth1 startup script
2002-03-07 7:05 [gentoo-dev] Problem with net.eth1 startup script Todd Punderson
@ 2002-03-07 11:08 ` Martin Schlemmer
2002-03-07 17:45 ` Todd Punderson
0 siblings, 1 reply; 3+ messages in thread
From: Martin Schlemmer @ 2002-03-07 11:08 UTC (permalink / raw
To: gentoo-dev; +Cc: todd
[-- Attachment #1: Type: text/plain, Size: 2168 bytes --]
On Thu, 2002-03-07 at 09:05, Todd Punderson wrote:
> Hello,
> After doing a update --world to upgrade about 2 months worth of
> packages, I ran into this problem. I was following the directions to set
> up multiple network cards. Here is what I have done so far and some
> snippets of my config files.
>
> I edited /etc/conf.d/net to look like this: (edited for clarity, the
> rest of the file is commented lines)
>
> iface_eth0="192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0"
> iface_eth1="dhcp"
> dhcpcd_eth1="-R"
>
> NOTE: eth0 configures correctly on bootup. The drivers for the network
> card are also loaded properly. If I run dhcpcd manually, it works fine.
>
> I copied net.eth0 to net.eth1 as per the directions.
> >From net.eth1:
> if [ "`eval echo "\$\{iface_${IFACE}\}"`" != "dhcp" ]
> then
> eval /sbin/ifconfig "$IFACE" "\$iface_$IFACE" >/dev/null 2>&1 || return $?
> else
> eval /sbin/dhcpcd "\$\{dhcpcd_${IFACE}\}" "$IFACE" >/dev/null 2>&1 || return $?
> fi
>
> The problem is that net.eth1 will not start up as dhcp. I edited the
> net.eth1 to see what it was trying to do by throwing some echo's in just
> to see where it was...Everytime no matter what the setting is in
> conf.d/net, it will only hit the "then" off that if statement. I hacked
> the script to look like this:
>
> if [ "`eval echo "\$\{iface_${IFACE}\}"`" != "dhcp" ]
> then
> eval /sbin/dhcpcd -R eth1 >/dev/null 2>&1 || return $?
> else
> eval /sbin/ifconfig "$IFACE" "\$iface_$IFACE" >/dev/null 2>&1 || return $?
> fi
>
> This works for the time being, but I'd like to correct the root cause of
> the problem. While starting up, it says "Bringing eth1 up" so I know
> $IFACE has the correct value. But I am stumped as to why the rest isn't
> working.
>
> Any help is appreciated!
Hiya there
Looks like I made a slight "type-o" when I was fixing up the form of the
scripts. Anyhow, try the attatched version, and let me know.
Greetings,
--
Martin Schlemmer
Gentoo Linux Developer, Desktop Team
Cape Town, South Africa
[-- Attachment #2: net.eth0 --]
[-- Type: text/plain, Size: 2274 bytes --]
#!/sbin/runscript
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/net.eth0,v 1.9 2002/02/15 04:35:43 azarah Exp $
#NB: Config is in /etc/conf.d/net
#for pcmcia users. note that pcmcia must be added to the same
#runlevel as the net.* script that needs it.
depend() {
use pcmcia
}
checkconfig() {
if [ -z "`eval echo \$\{iface_${IFACE}\}`" ]
then
eerror "Please make sure that /etc/conf.d/net has \$iface_$IFACE set"
return 1
fi
}
start() {
checkconfig || return 1
local iface_args="`eval echo \$\{iface_${IFACE}\}`"
local dhcp_args="`eval echo \$\{dhcpcd_${IFACE}\}`"
local retval=0
ebegin "Bringing ${IFACE} up"
if [ "`eval echo \$\{iface_${IFACE}\}`" != "dhcp" ]
then
/sbin/ifconfig "$IFACE" "$iface_args" >/dev/null 2>&1 || {
retval=$?
eend $retval
return $retval
}
else
/sbin/dhcpcd "$dhcp_args" "$IFACE" >/dev/null 2>&1 || {
retval=$?
eend $retval
return $?
}
fi
if [ -n "`eval echo \$\{alias_${IFACE}\}`" ]
then
local x=""
local num=0
for x in `eval echo \$\{alias_${IFACE}\}`
do
/sbin/ifconfig "${IFACE}:${num}" "$x" >/dev/null 2>&1
num=$((num + 1))
done
save_options alias "`eval echo \$\{alias_${IFACE}\}`"
fi
if [ -n "$gateway" ] && [ "${gateway%/*}" = "$IFACE" ]
then
/sbin/route add -net default gw "${gateway#*/}" dev "${gateway%/*}" \
netmask 0.0.0.0 metric 1 >/dev/null 2>&1 || {
local error=$?
ifconfig "${IFACE}" down >/dev/null 2>&1
eend ${error}
return ${error}
}
fi
#enabling rp_filter causes wacky packets to be auto-dropped by
#the kernel
if [ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter ]
then
echo 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
eend
}
stop() {
local myalias="`get_options alias`"
ebegin "Bringing ${IFACE} down"
#do some cleanup in case the amount of aliases change
if [ -n "$myalias" ]
then
local x=""
local num=0
for x in $myalias
do
/sbin/ifconfig "${IFACE}:${num}" down >/dev/null 2>1
num=$((num + 1))
done
fi
/sbin/ifconfig "$IFACE" down >/dev/null 2>&1
eend $?
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-dev] Problem with net.eth1 startup script
2002-03-07 11:08 ` Martin Schlemmer
@ 2002-03-07 17:45 ` Todd Punderson
0 siblings, 0 replies; 3+ messages in thread
From: Todd Punderson @ 2002-03-07 17:45 UTC (permalink / raw
To: gentoo-dev
Worked great!
Thanks very much.
Todd
On 07 Mar 2002 13:08:27 +0200
Martin Schlemmer <azarah@gentoo.org> wrote:
> On Thu, 2002-03-07 at 09:05, Todd Punderson wrote:
> > Hello,
> > After doing a update --world to upgrade about 2 months worth of
> > packages, I ran into this problem. I was following the directions to set
> > up multiple network cards. Here is what I have done so far and some
> > snippets of my config files.
> >
> > I edited /etc/conf.d/net to look like this: (edited for clarity, the
> > rest of the file is commented lines)
> >
> > iface_eth0="192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0"
> > iface_eth1="dhcp"
> > dhcpcd_eth1="-R"
> >
> > NOTE: eth0 configures correctly on bootup. The drivers for the network
> > card are also loaded properly. If I run dhcpcd manually, it works fine.
> >
> > I copied net.eth0 to net.eth1 as per the directions.
> > >From net.eth1:
> > if [ "`eval echo "\$\{iface_${IFACE}\}"`" != "dhcp" ]
> > then
> > eval /sbin/ifconfig "$IFACE" "\$iface_$IFACE" >/dev/null 2>&1 || return $?
> > else
> > eval /sbin/dhcpcd "\$\{dhcpcd_${IFACE}\}" "$IFACE" >/dev/null 2>&1 || return $?
> > fi
> >
> > The problem is that net.eth1 will not start up as dhcp. I edited the
> > net.eth1 to see what it was trying to do by throwing some echo's in just
> > to see where it was...Everytime no matter what the setting is in
> > conf.d/net, it will only hit the "then" off that if statement. I hacked
> > the script to look like this:
> >
> > if [ "`eval echo "\$\{iface_${IFACE}\}"`" != "dhcp" ]
> > then
> > eval /sbin/dhcpcd -R eth1 >/dev/null 2>&1 || return $?
> > else
> > eval /sbin/ifconfig "$IFACE" "\$iface_$IFACE" >/dev/null 2>&1 || return $?
> > fi
> >
> > This works for the time being, but I'd like to correct the root cause of
> > the problem. While starting up, it says "Bringing eth1 up" so I know
> > $IFACE has the correct value. But I am stumped as to why the rest isn't
> > working.
> >
> > Any help is appreciated!
>
> Hiya there
>
> Looks like I made a slight "type-o" when I was fixing up the form of the
> scripts. Anyhow, try the attatched version, and let me know.
>
>
> Greetings,
>
> --
> Martin Schlemmer
> Gentoo Linux Developer, Desktop Team
> Cape Town, South Africa
--
Todd Punderson <todd@doonga.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-03-07 17:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-07 7:05 [gentoo-dev] Problem with net.eth1 startup script Todd Punderson
2002-03-07 11:08 ` Martin Schlemmer
2002-03-07 17:45 ` Todd Punderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox