Tuesday, December 16, 2014

CentOS 7 Teaming with VLANS


I'm not a Linux guru, but I wanted to share my experience (aka trouble) with implementing Linux Teaming for the first time. I'll also throw in some VLAN configuration on top of it.

After a quick Google search, I started off here. Seemed easy enough. Just like bonding (which I've done before), with some different statements in the ifcfg files.

Trouble was, it wasn't coming up correctly. The physical interfaces weren't being added to the team. After hours of troubleshooting, I decided to remove the line 'TYPE=ETHERNET' in the ifcfg-em1 and em2 files. Apparently it was conflicting with the 'DEVICETYPE=TeamPort' line; because after the change, the team and it's ports came up as expected!

Here are some quick config steps.

First, let's install teamd.

yum install teamd
Second, I'm not a big fan of NetworkManager, so let's remove it (or just disable if you'd like).

yum remove NetworkManager
OR

systemctl stop NetworkManager.service
systemctl disable NetworkManager.service

The VLAN module should be loaded by default, but you can double-check with the following command.

modprobe --first-time 8021q
And you should get this output:

modprobe: ERROR: could not insert '8021q': Module already in kernel
Now let's configure the main team interface. In our overall config, each vlan will have it's own IP address, so we don't configure any IP addresses on this interface. Obviously replace 'lacp' with whatever load-sharing/redundancy method you'll be using. Some people like to add "link_watch":{"name":"ethtool"} to the config as well; but that is the default, so we'll leave it out. Since we're doing lacp, ethtool is our only linkwatcher option anyway.

cd /etc/sysconfig/network-scripts
vi ifcfg-team0

DEVICE=team0
DEVICETYPE=Team
TEAM_CONFIG='{"runner":{"name":"lacp"}}'
ONBOOT=yes
BOOTPROTO=none

Let's configure each of the physical interfaces that will be used in the team. Remember, this is where we need to remove any line that says 'TYPE=ETHERNET'. The 'ONBOOT' parameter can be 'no'; as the main team0 interface will bring these ports up automatically.

vi ifcfg-interface

DEVICETYPE=TeamPort
TEAM_MASTER=team0
BOOTPROTO=none
ONBOOT=no

Now let's get each of the VLAN interfaces configured.

vi ifcfg-team0.vlan-id

DEVICE=team0.vlan-id
IPADDR=ip-address
NETMASK=subnet-mask
ONBOOT=static
VLAN=yes

Finally, restart the network. If this command throws an error, then just do a server reboot.

systemctl restart network
After networking is restarted, you can verify that the ports were successfully added to the team by using either of these commands:

teamnl team0 ports
teamdctl team0 state view

No comments:

Post a Comment