[CentOS] How to create a virtual bonded interface?

Thu Sep 18 17:21:29 UTC 2008
John Horne <john.horne at plymouth.ac.uk>

Hello,

I have a server with 4 NICS running CentOS 5.2. I have bonded the
interfaces together such that 'bond0' consists of eth0-3. This is not a
problem, and works fine.

However, I now need to create a virtual interface. In a non-bonded
server I would just create something like eth0:1, but with a bonded
interface I am a bit confused. I have created bond0:1 simple by copying
the /etc/sysconfig/network-scripts/ifcfg-bond0 file, calling it
'bond0:1' and setting the DEVICE appropriately. Then I ran 'ifup
bond0:1'. The interface came up, and seems to be working okay. I have
not tested yet if the bonding failover works with bond0:1 because I am
doing this remotely at the moment. Tomorrow I should be able to test
that.

My question is, is creating a virtual bonded interface that simple or
have I missed something? Have I done this the right way, or should I
instead have created a second bonded interface ('bond1') and made it
consist of eth0:1, eth1:1, eth2:1 and eth3:1? Admittedly this would have
involved about 8 or so interfaces in total for the server! Secondly, I
added nothing to the /etc/modprobe.conf file. Should I have added
anything like 'alias bond0:1 bonding'? I also did not add any static
routes, yet if I use 'ping' to send packets out through the virtual IP
address ping says it is doing so (so again it all seems to be working).

My concern is that while it seems to be fine at the moment, and even
after rebooting, I may have missed something that will cause it to fail
at some point.

For info, 'ifconfig' output shows:

=============================================================
bond0     Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet addr:141.163.yy.a  Bcast:141.163.yy.yy  
          Mask:255.255.255.224
          inet6 addr: abcd::abcd:abcd:abcd:abcd/64
          Scope:Link                  
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500 
          Metric:1          
          RX packets:88468 errors:0 dropped:0 overruns:0
          frame:0             
          TX packets:59486 errors:0 dropped:0 overruns:0
          carrier:0  collisions:0 txqueuelen:0      
          RX bytes:80654540 (76.9 MiB)  TX bytes:5847688 (5.5
MiB)           

bond0:1   Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet addr:141.163.yy.b  Bcast:141.163.yy.yy 
          Mask:255.255.255.224
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
=============================================================


The 'netstat -rn' output shows:

=============================================================
Kernel IP routing table
Destination     Gateway     Genmask         Flags MSS Window  irtt Iface
141.163.yy.0    0.0.0.0     255.255.255.224   U   0   0         0  bond0
169.254.0.0     0.0.0.0     255.255.0.0       U   0   0         0  bond0
0.0.0.0         141.163.yy.30  0.0.0.0        UG  0   0         0  bond0
=============================================================

Shouldn't 'bond0:1' appear there somewhere?


Anyone notice if I missed anything?


Thanks,

John.

-- 
---------------------------------------------------------------
John Horne, University of Plymouth, UK  Tel: +44 (0)1752 587287
E-mail: John.Horne at plymouth.ac.uk       Fax: +44 (0)1752 587001