環境:ubuntu16.04 LTS 四個萬兆光纖網口,搭建ceph集羣,ceph集羣網綁定兩個網卡,ceph公共網綁定兩個網卡,綁定模式mode=4,交換機用華爲萬兆S6720
一、配置服務端網口配置文件
1、安裝ifenslave
apt-get install ifenslave-2.6
2、網口配置文件如下
# The primary network interface
auto enP2p1s0f1
iface enP2p1s0f1 inet manual
bond-master bond0
iface enP2p1s0f2 inet manual
bond-master bond0
auto enP2p1s0f3
iface enP2p1s0f3 inet manual
bond-master bond1
auto enP2p1s0f4
iface enP2p1s0f4 inet manual
bond-master bond1
auto bond0
iface bond0 inet static
address 10.33.0.40
netmask 255.255.0.0
network 10.33.0.0
broadcast 10.33.255.255
gateway 10.33.0.254
dns-nameservers 172.16.2.1
bond-mode 4
bond-miimon 100
bond-lacp-rate 1
bond-slaves enP2p1s0f1 enP2p1s0f2
auto bond1
iface bond1 inet static
address 192.168.3.40
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
bond-mode 4
bond-miimon 100
bond-lacp-rate 1
bond-slaves enP2p1s0f3 enP2p1s0f4
3、重啓網絡
systemctl restart networking
4、查看網絡狀態
用ip addr可以看到bond0和bond1也slave網卡有相同的mac地址。
5、查看綁定網卡狀態
cat /proc/net/bonding/bond0
cat /proc/net/bonding/bond1
如果配置正確的話在輸出內容中可以看到網卡是up狀態。
參考 https://help.ubuntu.com/community/UbuntuBonding
二、交換機配置
1、交換機需要使能lacp功能,並配置trunk,其中一個端口配置如下:
interface Eth-Trunk1
port link-type access
port default vlan 330
mode lacp