云平台的主机上有两个网卡,为了充分利用网卡的带宽,决定把两个网卡做bond。然后在上面设置vlan。目前分到3个vlan。vlan82对应ip段为10.10.82.0/24,vlan201对应的ip端为192.168.138.0/24,vlan202对应的ip端为192.168.139.0/24。三者分别为组件内部通信、云主机固定ip、云主机浮动ip。
双网卡制作bond的过程如下
安装包
#bond
apt-get install ifenslave
#vlan
apt-get install vlan
加载模块
修改内核加载设备模块需要的配置文件
echo "8021q" >> /etc/modules/
echo "bonding" >> /etc/modules/
修改网卡配置文件
编辑/etc/network/interfaces
auto loiface lo
inet loopback
auto bond0
iface bond0 inet manual
bond-mode 4
bond-miimon 100
bond_xmit_hash_policy layer2+3
bond_lacp_rate slow
slaves eth0 eth1
auto vlan82
iface vlan82 inet static
vlan_raw_device bond0
address 10.10.82.230
netmask 255.255.255.0
gateway 10.10.82.254
auto vlan201
iface vlan201 inet static
vlan_raw_device bond0
address 192.168.139.230
netmask 255.255.255.0
auto vlan202
iface vlan202 inet static
vlan_raw_device bond0
address 192.168.138.230
netmask 255.255.255.0
重启搞定