FS#9239 - [initscripts] net: network stop doesn't work on two cards bonding two ips
Attached to Project:
Arch Linux
Opened by Daniel YC Lin (dlin) - Thursday, 17 January 2008, 02:28 GMT
Last edited by Tom Gundersen (tomegun) - Saturday, 04 June 2011, 18:17 GMT
Opened by Daniel YC Lin (dlin) - Thursday, 17 January 2008, 02:28 GMT
Last edited by Tom Gundersen (tomegun) - Saturday, 04 June 2011, 18:17 GMT
|
Details
Description:
ref: http://wiki.archlinux.org/index.php/Configuring_network#multiple_ip_on_multiple_card I setting my pc eth0, eth1 bonding with two ip. When one card failed, the other will take over. And both ip is still available. But, I found, when I setting 'two ip on same interface' the /etc/rc.d/network Additional info: * package version(s) 2007.11-2 * config and/or log files etc. Steps to reproduce: 1. Set "two ip on one card" or "two ip on two card". 2. /etc/rc.d/network start # this should be OK 3. /etc/rc.d/network stop # this would be failed |
This task depends upon
Closed by Tom Gundersen (tomegun)
Saturday, 04 June 2011, 18:17 GMT
Reason for closing: No response
Additional comments about closing: Use (or file bug against) netcfg.
Saturday, 04 June 2011, 18:17 GMT
Reason for closing: No response
Additional comments about closing: Use (or file bug against) netcfg.
vi /etc/rc.d/network
# add following function
bond_down()
{
for ifline in ${BOND_INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
eval bondcfg="\$bond_${ifline}"
/sbin/ifenslave -d $ifline $bondcfg || error=1
fi
done
}
# modify the stop) section on line ~ 230-242, change the ifdown section to
R_IFACE=() # use reversed order
for ifline in ${INTERFACES[@]}; do
R_IFACE=("$ifline $R_IFACE")
done
for ifline in ${R_IFACE[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
if [ "$ifline" = "bond0" ]; then
bond_down
fi
ifdown $ifline || error=1
fi
done
TODO: modify the total network script, all stop should better change the stop order to reversed.
Tomorrow on my job I will continue the same work, and I'm going to install Arch on VMware server there to test & try to fix those bonding configurations (VMware Server allows up to 4 ethernet interfaces which is enought to test pretty different bonding configs).
It required to shutdown network in REVERSE order when multiple interface attached.(especial the bond)
real life, lack of time and laziness...
Back on topic:
the problem turned out to be very simple, and has nothing to do with real bonding.
suppose we have this in rc.conf (one card - two IP addresses):
eth0="eth0 ..."
eth1="eth0:1 ..."
INTERFACES=(eth0 eth1)
`/etc/rc.d/network stop` will try to stop eth0 *_and_eth1_* which does not exist,
(if you run ifconfig with the configuration above - you'll see eth and eth:0 but no eth1)
thus /etc/rc.d/network prints FAIL, though eth0 and eth0:1 are stopped correctly.
The solution is either don't FAIL on inability to remove existing device,
or improve the way this type of configurations is defined:
eth0=("eth0 ..."
"eth0:1 ...")
I think slaves should be unbonded first before shutting down the master interface.
Otherwise in my bonding situation. It can only 'network start' but 'network stop'
eth1="dhcp"
eth1_1="eth1:1 192.168.1.200 netmask 255.255.255.0 broadcast 192.168.1.255"
eth1_2="eth1:2 192.168.1.201 netmask 255.255.255.0 broadcast 192.168.1.255"
eth1_3="eth1:3 192.168.1.202 netmask 255.255.255.0 broadcast 192.168.1.255"
INTERFACES=(eth1 eth1_1 eth1_2 eth1_3)
The problem still exists in initscripts whether it be bonding or ip aliasing. Has there been any progress on this at all?
Thanks,
--- network-orig 2009-12-06 13:35:15.000000000 -0500
+++ network 2009-12-06 20:19:41.000000000 -0500
@@ -19,8 +19,6 @@
return 1
fi
- /sbin/ifconfig $1 up
-
wi_up $1 || return 1
eval ifcfg="\$${1}"
@@ -65,7 +63,11 @@
fi
fi
# Always bring the interface itself down
- /sbin/ifconfig ${1} down >/dev/null 2>&1
+ # Ignore aliases
+ `echo ${1} | grep -q '_'`
+ if [ $? -gt 0 ]; then
+ /sbin/ifconfig ${1} down >/dev/null 2>&1
+ fi
return $?
}
Also I think its a good idea to ignore aliased interfaces all together since bringing down the parent interface will automatically remove the aliased interfaces.
Thanks