Scenario: VLANs. You use the vconfig program to create a VLAN on an interface. For example if you were to use VLAN ID 623 on eth0, you end up with the device eth0.623 to use. This is the device an IP address gets assigned to, as well as routing goes through that.
However, when the link is brought up, that has to be done on the eth0 device device, not eth0.623. If you try "ip link set eth0.623 up" while eth0 itself is down, you get the "SIOCSIFFLAGS: Network is down" error. The interface config file could be expanded with a LINK variable with a value of the actual interface to be up'ed and down'ed, rather than the interface the IP address gets assigned to. If LINK doesn't exist in the interface config file, assume LINK=$1 I've attached my modified ifup and ifdown scripts. These are from lfs-bootscripts-3.1.0. Diffs included too. -- Gerard Beekmans /* If Linux doesn't have the solution, you have the wrong problem */
ifdown
Description: application/shellscript
--- ifup 2004-12-20 23:45:11.000000000 -0700 +++ /etc/sysconfig/network-devices/ifup 2005-02-28 14:37:20.839603418 -0700 @@ -75,9 +75,13 @@ if [ -n "${SERVICE}" -a -x "${network_devices}/services/${SERVICE}" ] then - if ip link show ${1} > /dev/null 2>&1 + if [ -z "${LINK}" ] then - bring_link_up ${1} + LINK=${1} + fi + if ip link show ${LINK} > /dev/null 2>&1 + then + bring_link_up ${LINK} IFCONFIG=${file} ${network_devices}/services/${SERVICE} ${1} up else boot_mesg "Interface ${1} doesn't exist." ${WARNING}
ifup
Description: application/shellscript
--- ifdown 2004-12-30 22:23:29.000000000 -0700 +++ /etc/sysconfig/network-devices/ifdown 2005-02-28 14:43:42.589824673 -0700 @@ -87,13 +88,18 @@ if [ -z "${2}" ] then - link_status=`ip link show $1 2> /dev/null` + . ${file} + if [ -z "${LINK}" ] + then + LINK=${1} + fi + link_status=`ip link show $LINK 2> /dev/null` if [ -n "${link_status}" ] then if echo "${link_status}" | grep -q UP then - boot_mesg "Bringing down the ${1} interface..." - ip link set ${1} down + boot_mesg "Bringing down the ${LINK} interface..." + ip link set ${LINK} down evaluate_retval fi fi
-- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page