centos7.x制作bond

nmcli的命令参考https://www.iyunv.com/thread-269695-1-1.html

bond的类型和centos6中的一致。

centos7.x制作bond如下:

1.查看网卡

[root@bogon ~]# nmcli connection show
NAME                UUID                                  TYPE            DEVICE 
Wired connection 1  c84ea813-4ac8-3a70-a7d2-3d9eca39f9fa  802-3-ethernet  ens37  
ens33               ae9ff038-a5d4-453a-aa8e-d8ccbb2ca0eb  802-3-ethernet  ens33 

2.设置bond

nmcli connection add con-name bond0 ifname bond0 type bond mode 0
nmcli con show
NAME                UUID                                  TYPE            DEVICE 
Wired connection 1  c84ea813-4ac8-3a70-a7d2-3d9eca39f9fa  802-3-ethernet  ens37  
bond0               f6c57a43-f5c4-4535-9324-60df81adc736  bond            bond0  
ens33               ae9ff038-a5d4-453a-aa8e-d8ccbb2ca0eb  802-3-ethernet  ens33 
ethtool bond0
Settings for bond0:
    Supported ports: [ ]
    Supported link modes:   Not reported
    Supported pause frame use: No
    Supports auto-negotiation: No
    Advertised link modes:  Not reported
    Advertised pause frame use: No
    Advertised auto-negotiation: No
    Speed: Unknown!
    Duplex: Unknown! (255)
    Port: Other
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: off
    Link detected: no

3.添加网卡进bond

nmcli connection add con-name slave-33 ifname ens33 type ethernet master bond0 
Connection 'slave-33' (33d98939-c472-49cc-842b-4904dd51e101) successfully added.
[root@bogon network-scripts]# nmcli connection add con-name slave-37 ifname ens37 type ethernet master bond0 
Connection 'slave-37' (b740df2f-66a8-49fc-8efa-5c90ec21f891) successfully added.
nmcli connection show
NAME                UUID                                  TYPE            DEVICE 
Wired connection 1  c84ea813-4ac8-3a70-a7d2-3d9eca39f9fa  802-3-ethernet  ens37  
bond0               f6c57a43-f5c4-4535-9324-60df81adc736  bond            bond0  
ens33               ae9ff038-a5d4-453a-aa8e-d8ccbb2ca0eb  802-3-ethernet  ens33  
slave-33            33d98939-c472-49cc-842b-4904dd51e101  802-3-ethernet  --     
slave-37            b740df2f-66a8-49fc-8efa-5c90ec21f891  802-3-ethernet  --  

4.配置bond0

这里可以使用nmcli命令来配置,也可以进入配置文件配置。

cat ifcfg-bond0 
DEVICE=bond0
BONDING_OPTS=mode=balance-rr
TYPE=Bond
BONDING_MASTER=yes
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
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=bond0
UUID=f6c57a43-f5c4-4535-9324-60df81adc736
ONBOOT=yes

5.重启网卡

systemctl restart network

6.查看bond

ethtool bond0
Settings for bond0:
    Supported ports: [ ]
    Supported link modes:   Not reported
    Supported pause frame use: No
    Supports auto-negotiation: No
    Advertised link modes:  Not reported
    Advertised pause frame use: No
    Advertised auto-negotiation: No
    Speed: 2000Mb/s
    Duplex: Full
    Port: Other
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: off
    Link detected: yes

7.网卡参数

[root@bogon network-scripts]# cat ifcfg-bond0 
DEVICE=bond0
BONDING_OPTS=mode=balance-rr
TYPE=Bond
BONDING_MASTER=yes
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
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=bond0
UUID=813f5d1c-265b-493e-b715-b2a38c4d5976
ONBOOT=yes
cat ifcfg-ens33
TYPE=Ethernet
NAME=ens33
UUID=eace0beb-3bef-4da4-885f-c12e497ca000
DEVICE=ens33
ONBOOT=yes
MASTER=bond0
SLAVE=yes

 

posted @ 2019-03-27 15:52  韩邯  阅读(1534)  评论(0编辑  收藏  举报