Why could not use ifup bring up a device in bonding?

Hi,

Please excuse me, this is my first thread here.

Issue description: I setup a bond interface (bond0), which include two slave devices (eth0 and eth2). Then I executed command “ifdown” to bring down one of slave device, then I want to use “ifup” to bring up it again, it do not works.
Then I tried to use “ifconfig up”, it works.

System information:
[HTML]
Linux linux-vm1 3.0.58-0.6.6-default #1 SMP Tue Feb 19 11:07:00 UTC 2013 (1576ecd) x86_64 x86_64 x86_64 GNU/Linux
linux-vm1:~ # cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 2[/HTML]

Commons record:
[HTML]
linux-vm1:~ # ifstatus eth2
eth2 device: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 02)
eth2 is up
3: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
link/ether 08:00:27:2e:54:9d brd ff:ff:ff:ff:ff:ff
linux-vm1:~ # ifdown eth2
eth2 device: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 02)
linux-vm1:~ # ifstatus eth2
eth2 device: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 02)
eth2 is down
linux-vm1:~ # ifup eth2
eth2 device: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 02)
linux-vm1:~ # ifstatus eth2
eth2 device: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 02)
eth2 is down
linux-vm1:~ # ifconfig eth2 up
linux-vm1:~ # ifstatus eth2
eth2 device: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 02)
eth2 is up
3: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
link/ether 08:00:27:2e:54:9d brd ff:ff:ff:ff:ff:ff
[/HTML]

Message log:
[HTML]
Mar 15 16:08:48 linux-vm1 ifdown: eth2 device: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 02)
Mar 15 16:08:48 linux-vm1 kernel: [ 4025.861271] bonding: bond0: link status definitely down for interface eth2, disabling it
Mar 15 16:08:48 linux-vm1 kernel: [ 4025.861299] bonding: bond0: making interface eth0 the new active one.
Mar 15 16:09:31 linux-vm1 ifup: eth2 device: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 02)
Mar 15 16:10:24 linux-vm1 kernel: [ 4121.409163] e1000: eth2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Mar 15 16:10:24 linux-vm1 kernel: [ 4121.476075] bonding: bond0: link status definitely up for interface eth2, 1000 Mbps full duplex.
[/HTML]

So, my questions are :
What is difference between "ifup " and “ifconfig up”?

Why do not work with “ifup” when the device is a bonding slave?

Thanks!

==============================================================================
Best Regards!

Mengz You

Hi Mengz,

ifconfig works directly on the device, while ifup / ifdown etc are scripts that take configuration files into consideration as well (and used to call ifconfig).

I’d say that from ifup’s perspective you have the “bonding device” to act upon, with its config in /etc/sysconfig/network/ifcfg-bond0. eth0 and eth2 OTOH are physical interfaces in the back-end, not formally “interfaces” to ifup and thus cannot be operated by ifup - espacially as there aren’t even config files for those in /etc/sysconfig/network.

ifconfig operates on the device directly, thus can handle any (network) device that’s available to the system.

Regards,
Jens

Hi, Jens

Thanks for your answer!

But, I’m still confused. Actually, there are all configuration files (ifcfg-bond0, ifcfg-eth0, ifcfg-eth2) under /etc/sysconfig/network/ directory.
You said the ‘ifup’ and ‘ifdown’ need the configuration files,then will call ifconfig to operate on device right?
And, why do the ‘ifdown’ can bring down the device, but ‘ifup’ can not bring up?
Could it be when device is a slave of bonding, after the ‘ifdown’ it, the configuration file of it will be deleted? I need to do some test on it.

======================================
BRs

Mengz You

Hi Mengz,

[QUOTE=mzyou;12428]Hi, Jens

Thanks for your answer!

But, I’m still confused. Actually, there are all configuration files (ifcfg-bond0, ifcfg-eth0, ifcfg-eth2) under /etc/sysconfig/network/ directory.[/QUOTE]

ups - what’s in ifcfg-eth0, -eth2? Usually, the slaves are referenced in ifcfg-bond0 (or ifcfg-bond1 and so on) and need no own config file.

[QUOTE=mzyou;12428]You said the ‘ifup’ and ‘ifdown’ need the configuration files,then will call ifconfig to operate on device right?
And, why do the ‘ifdown’ can bring down the device, but ‘ifup’ can not bring up?[/QUOTE]
probably because there is no “complete” configuration in ifcfg-eth*? Just to be clear: there shouldn’t be any “complete” configuration in those files, the interfaces are simply enslaved by the bonding device. Those files may be mere left-overs of an earlier non-bonding configuration.

No, that should not happen - those script usually read, not write (and especially not delete) the config files :slight_smile:

I’d say from your description, everything is working as designed.

Regards,
Jens

PS: “ifconfig” is considered a deprecated interface, “ip” seems to be favored now - I’m too old-school to let go easily, but as far as I can tell, “ifup” and friends don’t actually call “ifconfig” anymore.

Hi, Jens

From your more explanation, I get more understanding.
And I think I should deep into the source code of ‘ifup/ifdown’.

Thank you very much!

BRs
Mengz You