Note to self: When you remove a NIC in ESX from a bond, and you don’t inform your switch of this change. Strange Things Occur.
This prompted me to write a little something describing how to set up NIC teaming in ESX Server. For the uninitiated, NIC teaming, also known as link aggregation or 802.3ad, is a way of grouping network interface cards to improve reliability (redundancy) and performance (transfer speed).
To make this work well, you need to do some configuring in ESX and also in your switch. Like always, my switch example will be for a Cisco IOS-based Catalyst, though the principles involved in 802.3ad are pretty simple and standardized so you should be able to apply it to any other switch with the 802.3ad capability.
Enable 802.3ad NIC teaming in VMware ESX Server
NOTE: This example involves using the ESX MUI; as of the current version of ESX and VirtualCenter, you are forced to use the MUI for these changes.
1) Login to the MUI and click Options. Click Network Connections.
2) Assuming you already have a virtual switch, add an unused outbound adapter to your virtual switch. This is pretty much all you need to do on the ESX end of things - you now have a bond. You can bond more than 2 NICs as well.
3) In your switch, you must configure a port channel (Cisco-speak for a 802.3ad team), and then assign specific hardware ethernet ports to it. You also need to set up trunking on the port channel, if you want to use VLANs in your VMs. Like so:
ZORAC# conf t
ZORAC(config)# int Port-channel1
ZORAC(config-if)# switchport trunk encapsulation dot1q
ZORAC(config-if)# switchport trunk allowed vlan 1,2
ZORAC(config-if)# switchport mode trunk
The above creates a port channel. Now we’ll assign ports GigabitEthernet0/1 and GigabitEthernet0/2 to the channel.
ZORAC# conf t
ZORAC(config)# int GigabitEthernet0/1
ZORAC(config-if)# switchport trunk encapsulation dot1q
ZORAC(config-if)# switchport trunk allowed vlan 1,2
ZORAC(config-if)# switchport mode trunk
ZORAC(config-if)# channel-group 1 mode on
ZORAC(config-if)# exit
ZORAC(config)# int GigabitEthernet0/2
ZORAC(config-if)# switchport trunk encapsulation dot1q
ZORAC(config-if)# switchport trunk allowed vlan 1,2
ZORAC(config-if)# switchport mode trunk
ZORAC(config-if)# channel-group 1 mode on
Now GigabitEthernet0/1 and 0/2 are in a 802.3ad team. You may also want to use the below snippet to configure how load balancing will work with your team:
ZORAC# conf t
ZORAC(config)# port-channel load-balance dst-ip
This will balance the traffic going into the server based on its destination IP address. Load balancing settings for traffic going out of the server are decided by ESX and are also configurable. The default is “out-mac”, where ESX load-balances based on the destination MAC address. Using out-ip instead can improve network performance for VMs that produce a lot of network traffic. Traffic gets distributed more evenly across all the links in a team. However, your network switch has to support this. If you’ve got a Catalyst configured as above, then you’ve got the support.
To change ESX’s load balancing to out-ip, do the following:
1) Determine what the name of your team, or, bond is. The easiest way I’ve found to do this is to run this in the service console:
[root@esx root]# cat /etc/vmware/hwconfig | grep bond
You’ll see a few lines appear, mentioning either bond0, bond1 or something similar. Remember which bond it is.
2) Add the following line to /etc/vmware/hwconfig. Check to see if you already have a similar line - I didn’t but you might if you’ve attempted something like this before:
nicteam.bond0.load_balance_mode = "out-ip"
Be sure to put in the correct value for “bond0″.
Now here’s the catch: changes to /etc/vmware/hwconfig are not read until you reboot, and no one wants to reboot an ESX Server. You can activate the change immediately by typing the following command into the service console. Again, replace bond0 with the name of your bond:
echo "nicteaming load-balance out-ip" > /proc/vmware/net/bond0/config
It took a lot of googling for me to figure out exactly what you had to echo into config to make the change immediately. Hopefully this post will make the answer easier to find :)
That’s all! You’ve now got an 802.3ad NIC team running with IP-based load balancing on incoming and outgoing traffic. VMware has published a white paper about this subject, which you can view for more information.