Why VLAN bonding interface bondX.YY is not getting down using "ifconfig ... down" command?

Solution Verified - Updated -

Environment

Red Hat Enterprise Linux 6

Issue

  • There is VLAN interface with an alias configured on top of a bonding interface like this: bond0 -> bond0.4 -> bond0.4:0
  • This VLAN interface is brought down by using "ifconfig ... down" commands and "ifcfg-bond0.4*" files related to it are removed from "/etc/sysconfig/network-scripts" directory
  • This VLAN interface is still up after "service network restart" and is pingable

Resolution

There are 2 ways to resolve:

1. Remove or rename "ifcfg-bond0.4*" files after the network is shutdown but before it is back up. In this case "bond0.4" interface is correctly removed when the network shuts down.
PLEASE, NOTE! Networking will be unavailable after stopping it, so you have to run these commands from the server console!

# service network stop
# cd /etc/sysconfig/network-scripts
# mv ifcfg-bond0.4 ifcfg-bond0.4:0 /tmp/
# service network start

2. Use "ifdown" command instead of "ifconfig ... down" command. "ifdown" command performs the cleanups needed.

# ifdown bond0.4:0
# ifdown bond0.4
# cd /etc/sysconfig/network-scripts
# mv ifcfg-bond0.4 ifcfg-bond0.4:0 /tmp/
# service network restart

Root Cause

VLAN interface which is left up after removing its config files and the networking restart is not an error. "ifconfig ... down" is just a wrong command to use in this case, as it is not doing some cleanups which should be done. 'ifconfig' command is deprecated and should not be used, please, use 'ip' command instead.

After doing "ifconfig bond0.4:0 down; ifconfig bond0.4 down" there are still traces of "bond0.4" interface in the system and "service network restart" brings "bond0.4" back up, as there are no "ifcfg-bond0.4*" files to bring it down correctly.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments