CentOS / RHEL : How to configure alias (virtual interface) of bond interface (bondx:y)

Configuring alias of a bonding interfaces is no different that configuring it for the normal interfaces like ethX. here is a short note on configuring alias of bonding interface. For the example setup, we have the bonding interface as bond0 as shown below :

# ip address show bond0
14: bond0: [BROADCAST,MULTICAST,MASTER,UP,LOWER_UP] mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 00:11:0a:6a:55:48 brd ff:ff:ff:ff:ff:ff
    inet 10.129.122.21/24 brd 10.129.122.0 scope global bond0
       valid_lft forever preferred_lft forever
    inet6 fe80::211:aff:fe6a:5548/64 scope link
       valid_lft forever preferred_lft forever

We will be configuring bond0:1 alias of the bonding interface.

Creating alias of bond interface bond0

1. Create a file named ifcfg-bond0:1 in /etc/sysconfig/network-scripts directory.

# touch /etc/sysconfig/network-scripts/ifcfg-bond0:1

2. Add below parameters into the configuration file of bonding alias – /etc/sysconfig/network-scripts/ifcfg-bond0:1.

# vi /etc/sysconfig/network-scripts/ifcfg-bond0:1
DEVICE=bond0:1
BOOTPROTO=none
IPADDR=10.129.122.22
NETMASK=255.255.255.0
USERCTL=no
TYPE=Ethernet
ONPARENT=yes

Change the parameter values IPADDR, NETMASK etc as per requirement.

Note : The BONDING_OPTS parameter is not needed in this file as the alias is not actually a bond interface, but merely a virtual interface of the underlying bond. Also note that instead of ONBOOT=yes, ONPARENT=yes parameter is added as this is a alias interface.

3. Once all this configuration is done , restart the network service:

# service network restart

If you have other networks running and do not want to disrupt their service, you can try bringing up the particular virtual interfaces configured on bond only.

# ifup bond0:1

Verify

Once you have restarted the network services or brought up the virtual interface manually, you can verify the configuration using below commands.

# ip address show
# ip link
Related Post