centos 7.5配置网卡bonding

centos 7.5配置网卡bonding

iso== CentOS-7-x86_64-DVD-1804

HW==vmware WK10.0.1 build-1379776

----------------------------

检查系统版本

cat /etc/redhat-release

查看网卡信息

备份网卡配置文件

[hql@localhost network-scripts]$ mkdir /tmp/nic_bak
[hql@localhost network-scripts]$ cp ifcfg-*/tmp/nic_bak
cp: missing destination file operand after ‘ifcfg-*/tmp/nic_bak’
Try 'cp --help' for more information.
[hql@localhost network-scripts]$ cp ifcfg-*/tmp/nic_bak/
cp: missing destination file operand after ‘ifcfg-*/tmp/nic_bak/’
Try 'cp --help' for more information.
[hql@localhost network-scripts]$ cp ifcfg-* /tmp/nic_bak/
[hql@localhost network-scripts]$ ls /tmp/nic_bak
ifcfg-ens33 ifcfg-ens34 ifcfg-lo
[hql@localhost network-scripts]$ ^C
[hql@localhost network-scripts]$

使用nmcli命令配置bond

[hql@localhost network-scripts]$ nmcli connection add type bond ifname bond0 mode 1
Connection 'bond-bond0' (3a7f635b-87ed-4b73-8665-bea879ebd5ab) successfully added.
[hql@localhost network-scripts]$


[hql@localhost network-scripts]$ nmcli connection add type bond-slave ifname ens33 master bond0
Connection 'bond-slave-ens33' (465404c3-0522-4932-a639-f8ef9aee312a) successfully added.
[hql@localhost network-scripts]$ nmcli connection add type bond-slave ifname ens34 master bond0
Connection 'bond-slave-ens34' (b392ceaa-f48f-40d3-9192-d3809e170d2b) successfully added.
[hql@localhost network-scripts]$


[hql@localhost network-scripts]$ ls ifcfg-bond-*
ifcfg-bond-bond0 ifcfg-bond-slave-ens33 ifcfg-bond-slave-ens34

ONDING_OPTS=mode=active-backup
TYPE=Bond
BONDING_MASTER=yes
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=bond-bond0
UUID=3a7f635b-87ed-4b73-8665-bea879ebd5ab
DEVICE=bond0
ONBOOT=yes
IPADDR=192.168.189.251
NETMASK=255.255.255.0
GATEWAY=192.168.189.2
~

[root@localhost network-scripts]# service network restart
Restarting network (via systemctl): [ OK ]
[root@localhost network-scripts]#


[root@localhost network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens33
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: ens33
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 00:0c:29:7d:97:ec
Slave queue ID: 0

Slave Interface: ens34
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 00:0c:29:7d:97:f6
Slave queue ID: 0
[root@localhost network-scripts]#

---------------------------

经典文章

https://www.cnblogs.com/huangweimin/articles/6527058.html   linux下网卡bonding配置

https://www.cnblogs.com/wglee/p/6807212.html  centos7.x网卡bond配置 nmcli

https://blog.csdn.net/weixin_34357962/article/details/94659623  Centos 7.6 双网卡绑定实现高可用

猜你喜欢

转载自www.cnblogs.com/robin415972/p/11890959.html