配置网卡绑卡 --RHEL7

配置网卡绑卡

1)网卡绑定(team方式)

# 创建组接口
nmcli connection add type team ifname team0 con-name team0 config '{"runner":{"name":"activebackup"}}' ipv4.addresses 192.168.10.166/24 ipv4.gateway 192.168.10.2 ipv4.method manual ipv4.dns "192.168.10.166,8.8.8.8" connection.autoconnect yes ipv6.method ignore

# nmcli connection modify team0 ipv6.method ignore

# 添加端口到组接口
#将网卡ens32加入team0
nmcli connection add ifname ens32 con-name team0-ens32 type team-slave master team0
#将网卡ens35加入team0  
nmcli connection add ifname ens35 con-name team0-ens35 type team-slave master team0

[root@template ~]# nmcli connection show
NAME UUID TYPE DEVICE
ens32 152beb06-47c5-c5e8-95a9-385590654382 802-3-ethernet ens32
team0 bded736d-659f-4aae-9e86-02ec4cae8cdd team team0
team0-ens35 0dcd5326-b3a9-43fe-ad5c-9d7598457457 802-3-ethernet ens35
team0-ens32 53c3a10d-6dc2-40da-ad53-cd8d4f35eb88 802-3-ethernet --
[root@template ~]#

#断开原本的ens32链接
nmcli device disconnect ens32
nmcli connection modify ens32 connection.autoconnect yes

##启用team0-ens32网络组设备
nmcli connection up team0-ens32


nmcli connection add type team ifname team1 con-name team1 config '{"runner":{"name":"activebackup"}}' ipv4.addresses 172.168.0.156/24 ipv4.method manual connection.autoconnect yes ipv6.method ignore

nmcli connection add ifname ens36 con-name team1-ens36 type team-slave master team1
nmcli connection add ifname ens37 con-name team1-ens37 type team-slave master team1

# 重启网络
systemctl restart network

teamdctl team0 state

 

2) 网卡绑定(bond方式)

nmcli con add type bond con-name bond0 ifname bond0 ip4 192.168.10.157/24 gw4 192.168.10.2 mode active-backup ipv6.method ignore connection.autoconnect yes
nmcli con add type bond-slave ifname ens32 master bond0
nmcli con add type bond-slave ifname ens35 master bond0

nmcli con up bond-slave-ens32
nmcli con up bond-slave-ens35

nmcli con up bond-bond0

nmcli con add type bond con-name bond1 ifname bond1 ip4 172.168.0.154/24 mode active-backup ipv6.method ignore connection.autoconnect yes
nmcli con add type bond-slave ifname ens36 master bond1
nmcli con add type bond-slave ifname ens37 master bond1

nmcli con up bond-slave-ens36
nmcli con up bond-slave-ens37

nmcli con up bond-bond1

systemctl restart network

posted @ 2018-03-29 12:22  KuBee  阅读(264)  评论(0编辑  收藏  举报