1. 程式人生 > >bond網卡綁定(centos6.5 + centos 7)

bond網卡綁定(centos6.5 + centos 7)

onf mas cti 網卡 cin tde res 綁定 scrip

----------------------CentOS 6.5-------------------------------

1.添加bond內核模塊

modprobe bonding

2.添加四塊網卡

3.編輯網卡進行配置

eth0:

vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
USERCTL=no
MASTER=bond0
SLAVE=yes

eth1:
vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1


ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
USERCTL=no
MASTER=bond0
SLAVE=yes

eth2:
vim /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
USERCTL=no
MASTER=bond0
SLAVE=yes

eth3:
vim /etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE=eth3
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
USERCTL=no


MASTER=bond0
SLAVE=yes

4.編輯bond虛擬主網卡
vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
USERCTL=no
PEERDNS=yes
IPV6INIT=no
IPADDR=192.168.187.200
NETMASK=255.255.255.0
BROADCAST=192.168.187.255
GATEWAY=192.168.187.2
BONDING_OPTS="miimon=20 mode=6"

//表示這裏配置的工作模式是mode6(adaptive load balancing), miimon表示監視網絡鏈接的頻度 (毫秒), 我們設置的是100毫秒, 根據你的需求也可以指定mode成其它的負載模式。

5.創建一個加載bonding的專屬設定文件/etc/modprobe.d/bonding.conf

echo "alias netdev-bond0 bonding" > /etc/modprobe.d/bonding.conf

cat /proc/net/bonding/bond0

ethtool bond0

6.重啟系統

reboot




-------------------CentOS 7---------------------------------------------

nmcli connection add type bond ifname bond0 mode 6
nmcli connection add type bond-slave ifname ens33 master bond0
nmcli connection add type bond-slave ifname ens37 master bond0
nmcli connection add type bond-slave ifname ens38 master bond0
nmcli connection add type bond-slave ifname ens39 master bond0
systemctl restart network
cat /proc/net/bonding/bond0
ethtool bond0

bond網卡綁定(centos6.5 + centos 7)