天天看點

Centos7 網卡綁定

作者:自若晚風Jr

1、切換到指定目錄

#備份網卡資料

cd /etc/sysconfig/network-scripts

cp ifcfg-enp5s0f0 ifcfg-enp5s0f0.bak

cp ifcfg-enp5s0f1 ifcfg-enp5s0f1.bak

2、編輯網卡檔案enp5s0f0和enp5s0f1

vim ifcfg-enp5s0f0

TYPE=Ethernet

BOOTPROTO=none

MASTER=bond0

NAME=enp5s0f0

DEVICE=enp5s0f0

ONBOOT=yes

UUID=0ffe822f-ac45-43c7-b384-eeaa9b31d693

剩下的可以使用#注釋掉或者删除。

ifcfg-enp5s0f1 配置跟ifcfg-enp5s0f0相同

TYPE=Ethernet

BOOTPROTO=none

MASTER=bond0

NAME=enp5s0f1

DEVICE=enp5s0f1

ONBOOT=yes

UUID=0ffe822f-ac45-43c7-b384-eeaa9b31d693

Centos7 網卡綁定

3、建立bond0網卡,并配置IP位址

vim ifcfg-bond0

DEVICE=bond0

BOOTPROTO=none

BONDING_OPTS=miimon=100 mode=1

ONBOOT=yes

IPADDR=10.10.10.2

NETMASK=255.255.255.0

GATEWAY=10.10.10.1

DNS1=8.8.8.8

BONDING_MASTER=yes

Centos7 網卡綁定
  1. 将需求mode配置在系統檔案中

vim /etc/modprobe.d/bond.conf

alias bond0 bonding

options bond0 miimon=100 mode=1

#加載子產品,讓系統支援bonding

#鍊路檢查時間100ms 模式為1

# linux網卡bonging的備份模式實驗在真實機器上做完全沒問題(前提是linux核心支援),但是在vmware workstation虛拟中做就會出現一些問題。

Centos7 網卡綁定
  1. 重新開機網卡

systemctl start network

  1. 檢視速率

ethtool bond0

Centos7 網卡綁定
  1. 檢視工作bond0狀态

cat /proc/net/bonding/bond0

Centos7 網卡綁定

nmcli con sh 這個指令檢視網卡

繼續閱讀