Linux系统与交换机聚合配置

1、Linux的bond模式

模式简称中文名称原理
bond0/mode0balance-rr轮询模式传输数据包顺序是依次传输,直到最后一个传输完毕
bond1/mode1active-backup主备模式只有一个设备处于活动状态。一个链路断开后,另一个马上由备份转换为主设备
bond2/mode2balance-xor负责均衡模式依据5元组进行hash,实现负载均衡
bond3/mode3Broadcast policy广播模式将所有数据包传输给所有设备
bond4/mode4802.3ad802.3ad动态链路聚合模式创建共享相同的速度和双工设置的聚合组,能实现负载均衡
bond5/mode5balance-tlb适配器传输负载均衡通道绑定不需要专用的交换机支持。发出的流量根据当前负载分给每一个设备。由当前设备处理接收,如果接受的设 备传不通就用另一个设备接管当前设备正在处理的mac地址
bond6/mode6balance-alb适配器负载均衡包括mode5,由 ARP 协商完成接收的负载。bonding驱动程序截获 ARP在本地系统发送出的请求,用其中之一的硬件地址覆盖从属设备的原地址。就像是在服务器上不同的人使用不同的硬件地址一样

– bond 0,bond 2 和 bond 3 上需要静态聚合方式,需要配置交换机
– bond 1,bond 5 和 bond 6 不需要交换机端的设置,网卡能自动聚合
– bond 4 需要支持 802.3ad,需要配置交换机

本文介绍bond1/bond2/bond4(mdoe1,mdoe2,mode4)三种方式分别进行介绍。
测试环境如下:(对server来说普通聚合和M-lag场景配置相同)
实验拓扑

2、bond1(mode1)模式

正常对接后通过 cat /proc/net/bonding/bond0 命令查看
在这里插入图片描述

1、ubuntu

1、对接H3C交换机

在当前场景下,可知活动的端口为 active slave interface :ens6f1

-----------------------非聚合场景------------------------------
1、交换机上配置非聚合端口状态,服务器与交换机G1/0/1和G1/0/2端口连接。
交换机配置:
#
vlan 168
 description TEST
#   
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
#
interface GigabitEthernet1/0/1
 port access vlan 168
#
interface GigabitEthernet1/0/2
 port access vlan 168
#
服务器聚合配置:
network:
  bonds:
    bond0:
      addresses:
      - 192.168.10.10/24
      gateway4: 192.168.10.1
      interfaces:
      - ens6f0
      - ens6f1
      nameservers:
        addresses:
        - 8.8.8.8
        search: []
      parameters:
        mii-monitor-interval: 10
        mode: active-backup
  ethernets:
    ens6f0: {}
    ens6f1: {}
  version: 2
~            
查看服务器聚合接口状态
yang@yang:/etc/netplan$ 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: ens6f1
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: ens6f1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 50:d3:3b:00:08:3d
Slave queue ID: 0

Slave Interface: ens6f0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 50:d3:3b:00:08:3c
Slave queue ID: 0

当前场景交换机上无需做聚合配置,服务器上只有一个活动端口,当活动端口故障时,非活动端口变为活动端口。

2、对接华为交换机

----------------------非聚合场景----------------------------------
#
vlan 168
 description TEST
#   
interface Vlanif168
 description TEST
 ip address 192.168.10.1 255.255.255.0
#
interface GigabitEthernet1/0/1
 port default vlan 168
#
interface GigabitEthernet1/0/2
 port default vlan 168
#
服务器聚合配置:
network:
  bonds:
    bond0:
      addresses:
      - 192.168.10.10/24
      gateway4: 192.168.10.1
      interfaces:
      - ens6f0
      - ens6f1
      nameservers:
        addresses:
        - 8.8.8.8
        search: []
      parameters:
        mii-monitor-interval: 10
        mode: active-backup
  ethernets:
    ens6f0: {}
    ens6f1: {}
  version: 2

  服务器上聚合配置显示状态与对接H3C交换机一致

2、redhat

1、对接H3C交换机

-----------------------非聚合场景------------------------------
1、交换机上配置非聚合端口状态,服务器与交换机G1/0/1和G1/0/2端口连接。
交换机配置:
#
vlan 168
 description TEST
#   
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
#
interface GigabitEthernet1/0/1
 port access vlan 168
#
interface GigabitEthernet1/0/2
 port access vlan 168
#

服务聚合配置:
yum install -y NetworkManager
systemctl enable NetworkManager
systemctl start NetworkManager
nmcli connection add type bond ifname bond0 mode active-backup
nmcli connection add type ethernet ifname ens6f0 master bond0
nmcli connection add type ethernet ifname ens6f1 master bond0
# nmcli connection add type bond-slave ifname ens6f0 master bond0  与上两行作用相同
# nmcli connection add type bond-slave ifname ens6f1 master bond0
nmcli connection modify bond0 \
    ipv4.addresses 192.168.10.10/24 \
    ipv4.gateway 192.168.10.1 \
    ipv4.dns 8.8.8.8 \
    ipv4.method manual \
    connection.autoconnect yes
 nmcli connection modify bond0 +ipv4.routes "192.168.0.0/16 192.168.10.1"
 nmcli connection up bond0

2、对接华为交换机

----------------------非聚合场景----------------------------------
#
vlan 168
 description TEST
#   
interface Vlanif168
 description TEST
 ip address 192.168.10.1 255.255.255.0
#
interface GigabitEthernet1/0/1
 port default vlan 168
#
interface GigabitEthernet1/0/2
 port default vlan 168
#

服务器聚合配置
yum install -y NetworkManager
systemctl enable NetworkManager
systemctl start NetworkManager
nmcli connection add type bond ifname bond0 mode active-backup
nmcli connection add type ethernet ifname ens6f0 master bond0
nmcli connection add type ethernet ifname ens6f1 master bond0
# nmcli connection add type bond-slave ifname ens6f0 master bond0  与上两行作用相同
# nmcli connection add type bond-slave ifname ens6f1 master bond0
nmcli connection modify bond0 \
    ipv4.addresses 192.168.10.10/24 \
    ipv4.gateway 192.168.10.1 \
    ipv4.dns 8.8.8.8 \
    ipv4.method manual \
    connection.autoconnect yes
 nmcli connection modify bond0 +ipv4.routes "192.168.0.0/16 192.168.10.1"
 nmcli connection up bond0

3、bond0(mode0 balance-rr)

1、ubuntu

1、对接H3C交换机


#直接在原服务器上将activ-backup修改为balance-rr模式时,需要执行一下命令才能让新的模式生效
sudo ip link set bond0 down
sudo modprobe -r bonding
sudo modprobe bonding mode=balance-rr
sudo netplay apply 
--------------------------普通聚合状态-------------------------------
1、交换机上配置聚合端口状态,服务器与交换机G1/0/1和G1/0/2端口连接。
交换机配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
#
interface GigabitEthernet1/0/1
 port access vlan 168
 port link-aggregation group 101
#
interface GigabitEthernet1/0/2
 port access vlan 168
 port link-aggregation group 101
#
interface Bridge-Aggregation101
 description BOND_TEST
 port access vlan 168
#
--------------------------------交换机M-LAG配置----------------------------------
1、两台交换机上配置聚合端口状态,服务器与两天交换机G1/0/1端口连接,GE1/0/8,G1/0/9作为Peer-link链路
G1/0/10作为keepalive链路
在M-LAG双归接入三层网络的场景中,两台M-LAG设备需要同时作为三层网关,必须保证M-LAG设备上存在相同的IP地址和MAC地址的逻辑接口,以便实现
M-LAG系统中相互配置对的M-LAG接口的系统MAC地址必须相同,一般建议将系统mac配置为其中一台M-LAG设备的桥MAC地址
具有相同的M-LAG系统system priority
具有不同M-LAG设备的系统编号

交换机01-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpninstace keepalive
#
interface G1/0/10
port link-mode route
ip  banding vpn-instance keepalive
ip adddress 21.1.1.1
#
m-lag system-mac 2-2-2
m-lag role-priority 200  # 指定master角色
m-lag system-number 1
m-lag system-priority 123
m-lag standalone enable
m-lag keepalive ip vpn-instance destination 21.1.1.2 source 21.1.1.1
#
m-lag mad exclude interface G 1/0/10
m-lag mad exclude interface Vlan-interface168
#
interface bridge-aggregation 1
#
interface range G 1/0/8 G 1/0/9
port link-aggregation group 1
#
interface bridge-aggregation 1
port m-lag peer-link 1
#
interface bridge-aggregation 101
#
interface G 1/0/1
port link-aggregation group 101
#
interface bridge-aggregation 101
port m-lag group 1
port lacp system-priority 101
port link-type trunk
port trunk permit vlan 168
undo port trunk permit vlan 1
#
交换机02-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpninstace keepalive
#
interface G1/0/10
port link-mode route
ip  banding vpn-instance keepalive
ip adddress 21.1.1.2
#
m-lag system-mac 2-2-2
m-lag role-priority 100  # 指定master角色
m-lag system-number 2
m-lag system-priority 123
m-lag standalone enable
m-lag keepalive ip vpn-instance destination 21.1.1.1 source 21.1.1.2
#
m-lag mad exclude interface G 1/0/10
m-lag mad exclude interface Vlan-interface168
#
interface bridge-aggregation 1
link-aggregation mode dynamic
#
interface range G 1/0/8 G 1/0/9
port link-aggregation group 1
#
interface bridge-aggregation 1
port m-lag peer-link 1
#
interface bridge-aggregation 101
#
interface G 1/0/1
port link-aggregation group 101
#
interface bridge-aggregation 101
link-aggregation mode dynamic
port m-lag group 1
port lacp system-priority 100
port link-type trunk
port trunk permit vlan 168
undo port trunk permit vlan 1
#


服务器配置:
network:
  bonds:
    bond0:
      addresses:
      - 192.168.10.10/24
      gateway4: 192.168.10.1
      interfaces:
      - ens6f0
      - ens6f1
      nameservers:
        addresses:
        - 8.8.8.8
        search: []
      parameters:
        mii-monitor-interval: 10
        mode: balance-rr
  ethernets:
    ens6f0: {}
    ens6f1: {}
  version: 2
聚合接口状态如下:
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 10
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: ens6f1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 50:d3:3b:00:08:3d
Slave queue ID: 0

Slave Interface: ens6f0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 50:d3:3b:00:08:3c
Slave queue ID: 0

端口速率如下:
root@yang:/etc/netplan# ethtool bond0
Settings for bond0:
        Supported ports: [ ]
        Supported link modes:   Not reported
        Supported pause frame use: No
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 2000Mb/s
        Duplex: Full
        Port: Other
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: off
        Link detected: yes

2、对接华为交换机


#直接在原服务器上将activ-backup修改为balance-rr模式时,需要执行一下命令才能让新的模式生效
sudo ip link set bond0 down
sudo modprobe -r bonding
sudo modprobe bonding mode=balance-rr
sudo netplay apply 
--------------------------普通聚合状态-------------------------------
1、交换机上配置聚合端口状态,服务器与交换机G1/0/1和G1/0/2端口连接。
交换机配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
#
interface Eth-Trunk101
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 168
#
interface GE1/0/1
 eth-trunk 101
#
interface GE1/0/2
 eth-trunk 101
#
--------------------------------交换机M-LAG配置----------------------------------
1、两台交换机上配置聚合端口状态,服务器与两天交换机G1/0/1端口连接,GE1/0/8,G1/0/9作为Peer-link链路
G1/0/10作为keepalive链路
配置相同的dfs-group 编号即可

交换机01-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlanif 168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpn-instance DAD
 ipv4-family
  route-distinguisher 1:1
#
interface G1/0/10
undo portswitch
ip  banding vpn-instance DAD
ip adddress 21.1.1.1
m-lag unpaired-port reserved   # 配置为预留端口
#
stp mode rstp
stp v-stp enable
stp tc-protection
stp bpdu-protection
#
dfs-group 1
 priority 150
 dual-active detection source ip 21.1.1.1 vpn-instance DAD peer 21.1.1.2
#
interface Eth-Trunk0
 trunkport GE1/0/8
 trunkport GE1/0/9
 mode lacp-static
 peer-link 1
 port vlan exclude 1
#
interface Eth-Trunk101
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 168
 dfs-group 1 m-lag 1
#
interface GE1/0/1
 eth-trunk 101
#
交换机02-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlanif 168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpn-instance DAD
 ipv4-family
  route-distinguisher 1:1
#
interface G1/0/10
undo portswitch
ip  banding vpn-instance DAD
ip adddress 21.1.1.2
m-lag unpaired-port reserved   # 配置为预留端口
#
stp mode rstp
stp v-stp enable
stp tc-protection
stp bpdu-protection
#
dfs-group 1
 priority 100
 dual-active detection source ip 21.1.1.2 vpn-instance DAD peer 21.1.1.1
#
interface Eth-Trunk0
 trunkport GE1/0/8
 trunkport GE1/0/9
 peer-link 1
 port vlan exclude 1
#
interface Eth-Trunk101
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 168
 dfs-group 1 m-lag 1
#
interface GE1/0/1
 eth-trunk 101
#

服务器配置:
network:
  bonds:
    bond0:
      addresses:
      - 192.168.10.10/24
      gateway4: 192.168.10.1
      interfaces:
      - ens6f0
      - ens6f1
      nameservers:
        addresses:
        - 8.8.8.8
        search: []
      parameters:
        mii-monitor-interval: 10
        mode: balance-rr
  ethernets:
    ens6f0: {}
    ens6f1: {}
  version: 2
聚合接口状态如下:
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 10
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: ens6f1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 50:d3:3b:00:08:3d
Slave queue ID: 0

Slave Interface: ens6f0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 50:d3:3b:00:08:3c
Slave queue ID: 0

端口速率如下:
root@yang:/etc/netplan# ethtool bond0
Settings for bond0:
        Supported ports: [ ]
        Supported link modes:   Not reported
        Supported pause frame use: No
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 2000Mb/s
        Duplex: Full
        Port: Other
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: off
        Link detected: yes

2、redhat

1、对接H3C交换机

#直接在原服务器上将activ-backup修改为balance-rr模式时,需要执行一下命令才能让新的模式生效
sudo ip link set bond0 down
sudo modprobe -r bonding
sudo modprobe bonding mode=balance-rr
sudo netplay apply 
--------------------------普通聚合状态-------------------------------
1、交换机上配置聚合端口状态,服务器与交换机G1/0/1和G1/0/2端口连接。
交换机配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
#
interface GigabitEthernet1/0/1
 port access vlan 168
 port link-aggregation group 101
#
interface GigabitEthernet1/0/2
 port access vlan 168
 port link-aggregation group 101
#
interface Bridge-Aggregation101
 description BOND_TEST
 port access vlan 168
#
--------------------------------交换机M-LAG配置----------------------------------
1、两台交换机上配置聚合端口状态,服务器与两天交换机G1/0/1端口连接,GE1/0/8,G1/0/9作为Peer-link链路
G1/0/10作为keepalive链路
在M-LAG双归接入三层网络的场景中,两台M-LAG设备需要同时作为三层网关,必须保证M-LAG设备上存在相同的IP地址和MAC地址的逻辑接口,以便实现
M-LAG系统中相互配置对的M-LAG接口的系统MAC地址必须相同,一般建议将系统mac配置为其中一台M-LAG设备的桥MAC地址
具有相同的M-LAG系统system priority
具有不同M-LAG设备的系统编号

交换机01-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpninstace keepalive
#
interface G1/0/10
port link-mode route
ip  banding vpn-instance keepalive
ip adddress 21.1.1.1
#
m-lag system-mac 2-2-2
m-lag role-priority 200  # 指定master角色
m-lag system-number 1
m-lag system-priority 123
m-lag standalone enable
m-lag keepalive ip vpn-instance destination 21.1.1.2 source 21.1.1.1
#
m-lag mad exclude interface G 1/0/10
m-lag mad exclude interface Vlan-interface168
#
interface bridge-aggregation 1
link-aggregation mode dynamic
#
interface range G 1/0/8 G 1/0/9
port link-aggregation group 1
#
interface bridge-aggregation 1
port m-lag peer-link 1
#
interface bridge-aggregation 101
#
interface G 1/0/1
port link-aggregation group 101
#
interface bridge-aggregation 101
link-aggregation mode dynamic
port m-lag group 1
port lacp system-priority 101
port link-type trunk
port trunk permit vlan 168
undo port trunk permit vlan 1
#
交换机02-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpninstace keepalive
#
interface G1/0/10
port link-mode route
ip  banding vpn-instance keepalive
ip adddress 21.1.1.2
#
m-lag system-mac 2-2-2
m-lag role-priority 100  # 指定master角色
m-lag system-number 2
m-lag system-priority 123
m-lag standalone enable
m-lag keepalive ip vpn-instance destination 21.1.1.1 source 21.1.1.2
#
m-lag mad exclude interface G 1/0/10
m-lag mad exclude interface Vlan-interface168
#
interface bridge-aggregation 1
link-aggregation mode dynamic
#
interface range G 1/0/8 G 1/0/9
port link-aggregation group 1
#
interface bridge-aggregation 1
port m-lag peer-link 1
#
interface bridge-aggregation 101
#
interface G 1/0/1
port link-aggregation group 101
#
interface bridge-aggregation 101
link-aggregation mode dynamic
port m-lag group 1
port lacp system-priority 100
port link-type trunk
port trunk permit vlan 168
undo port trunk permit vlan 1
#

服务配置
------------------------使用nmcli命令----------------------------------
yum install NetworkManager
nmcli connection add type bond ifname bond0 mode balance-rr
nmcli connection add type ethernet ifname ens6f0 master bond0
nmcli connection add type ethernet ifname ens6f1 master bond0
# nmcli connection add type bond-slave ifname ens6f0 master bond0
# nmcli connection add type bond-slave ifname ens6f1 master bond0
nmcli connection modify bond0 ipv4.addresses 192.168.10.10/24 ipv4.gateway 192.168.10.1 ipv4.dns 8.8.8.8 ipv4.method manual connection.autoconnect yes
nmcli connection modify bond0 +ipv4.routes "192.168.0.0/16 192.168.10.1"
nmcli connection up bond0

2、对接华为交换机

#直接在原服务器上将activ-backup修改为balance-rr模式时,需要执行一下命令才能让新的模式生效
sudo ip link set bond0 down
sudo modprobe -r bonding
sudo modprobe bonding mode=balance-rr
sudo netplay apply 
--------------------------普通聚合状态-------------------------------
1、交换机上配置聚合端口状态,服务器与交换机G1/0/1和G1/0/2端口连接。
交换机配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
#
interface Eth-Trunk101
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 168
#
interface GE1/0/1
 eth-trunk 101
#
interface GE1/0/2
 eth-trunk 101
#
--------------------------------交换机M-LAG配置----------------------------------
1、两台交换机上配置聚合端口状态,服务器与两天交换机G1/0/1端口连接,GE1/0/8,G1/0/9作为Peer-link链路
G1/0/10作为keepalive链路
配置相同的dfs-group 编号即可

交换机01-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlanif 168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpn-instance DAD
 ipv4-family
  route-distinguisher 1:1
#
interface G1/0/10
undo portswitch
ip  banding vpn-instance DAD
ip adddress 21.1.1.1
m-lag unpaired-port reserved   # 配置为预留端口
#
stp mode rstp
stp v-stp enable
stp tc-protection
stp bpdu-protection
#
dfs-group 1
 priority 150
 dual-active detection source ip 21.1.1.1 vpn-instance DAD peer 21.1.1.2
#
interface Eth-Trunk0
 trunkport GE1/0/8
 trunkport GE1/0/9
 mode lacp-static
 peer-link 1
 port vlan exclude 1
#
interface Eth-Trunk101
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 168
 mode lacp-static
 dfs-group 1 m-lag 1
#
interface GE1/0/1
 eth-trunk 101
#
交换机02-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlanif 168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpn-instance DAD
 ipv4-family
  route-distinguisher 1:1
#
interface G1/0/10
undo portswitch
ip  banding vpn-instance DAD
ip adddress 21.1.1.2
m-lag unpaired-port reserved   # 配置为预留端口
#
stp mode rstp
stp v-stp enable
stp tc-protection
stp bpdu-protection
#
dfs-group 1
 priority 100
 dual-active detection source ip 21.1.1.2 vpn-instance DAD peer 21.1.1.1
#
interface Eth-Trunk0
 trunkport GE1/0/8
 trunkport GE1/0/9
 mode lacp-static
 peer-link 1
 port vlan exclude 1
#
interface Eth-Trunk101
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 168
 mode lacp-static
 dfs-group 1 m-lag 1
#
interface GE1/0/1
 eth-trunk 101
#

服务配置
------------------------使用nmcli命令----------------------------------
yum install NetworkManager
nmcli connection add type bond ifname bond0 mode balance-rr
nmcli connection add type ethernet ifname ens6f0 master bond0
nmcli connection add type ethernet ifname ens6f1 master bond0
# nmcli connection add type bond-slave ifname ens6f0 master bond0
# nmcli connection add type bond-slave ifname ens6f1 master bond0
nmcli connection modify bond0 ipv4.addresses 192.168.10.10/24 ipv4.gateway 192.168.10.1 ipv4.dns 8.8.8.8 ipv4.method manual connection.autoconnect yes
nmcli connection modify bond0 +ipv4.routes "192.168.0.0/16 192.168.10.1"
nmcli connection up bond0

4、bond4(mode4 802.3ad)

1、ubuntu

1、对接H3C交换机

--------------------------普通聚合状态-------------------------------
#直接在原服务器上将balance-rr修改为802.3ad模式时,需要执行一下命令才能让新的模式生效
sudo ip link set bond0 down
sudo modprobe -r bonding
sudo modprobe bonding mode=802.3ad
sudo netplay apply 
1、交换机上配置聚合端口状态,服务器与交换机G1/0/1和G1/0/2端口连接。
交换机配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
#
interface GigabitEthernet1/0/1
 port access vlan 168
 port link-aggregation group 101
#
interface GigabitEthernet1/0/2
 port access vlan 168
 port link-aggregation group 101
#
interface Bridge-Aggregation101
 description BOND_TEST
 port access vlan 168
 link-aggregation mode dynamic
#
--------------------------------交换机M-LAG配置----------------------------------
1、两台交换机上配置聚合端口状态,服务器与两天交换机G1/0/1端口连接,GE1/0/8,G1/0/9作为Peer-link链路
G1/0/10作为keepalive链路
在M-LAG双归接入三层网络的场景中,两台M-LAG设备需要同时作为三层网关,必须保证M-LAG设备上存在相同的IP地址和MAC地址的逻辑接口,以便实现
M-LAG系统中相互配置对的M-LAG接口的系统MAC地址必须相同,一般建议将系统mac配置为其中一台M-LAG设备的桥MAC地址
具有相同的M-LAG系统system priority
具有不同M-LAG设备的系统编号

交换机01-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpninstace keepalive
#
interface G1/0/10
port link-mode route
ip  banding vpn-instance keepalive
ip adddress 21.1.1.1
#
m-lag system-mac 2-2-2
m-lag role-priority 200  # 指定master角色
m-lag system-number 1
m-lag system-priority 123
m-lag standalone enable
m-lag keepalive ip vpn-instance destination 21.1.1.2 source 21.1.1.1
#
m-lag mad exclude interface G 1/0/10
m-lag mad exclude interface Vlan-interface168
#
interface bridge-aggregation 1
link-aggregation mode dynamic
#
interface range G 1/0/8 G 1/0/9
port link-aggregation group 1
#
interface bridge-aggregation 1
port m-lag peer-link 1
#
interface bridge-aggregation 101
#
interface G 1/0/1
port link-aggregation group 101
#
interface bridge-aggregation 101
link-aggregation mode dynamic
port m-lag group 1
port lacp system-priority 101
port link-type trunk
port trunk permit vlan 168
undo port trunk permit vlan 1
#
交换机02-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpninstace keepalive
#
interface G1/0/10
port link-mode route
ip  banding vpn-instance keepalive
ip adddress 21.1.1.2
#
m-lag system-mac 2-2-2
m-lag role-priority 100  # 指定master角色
m-lag system-number 2
m-lag system-priority 123
m-lag standalone enable
m-lag keepalive ip vpn-instance destination 21.1.1.1 source 21.1.1.2
#
m-lag mad exclude interface G 1/0/10
m-lag mad exclude interface Vlan-interface168
#
interface bridge-aggregation 1
link-aggregation mode dynamic
#
interface range G 1/0/8 G 1/0/9
port link-aggregation group 1
#
interface bridge-aggregation 1
port m-lag peer-link 1
#
interface bridge-aggregation 101
#
interface G 1/0/1
port link-aggregation group 101
#
interface bridge-aggregation 101
link-aggregation mode dynamic
port m-lag group 1
port lacp system-priority 100
port link-type trunk
port trunk permit vlan 168
undo port trunk permit vlan 1
#

服务器配置:
network:
  bonds:
    bond0:
      addresses:
      - 192.168.10.10/24
      gateway4: 192.168.10.1
      interfaces:
      - ens6f0
      - ens6f1
      nameservers:
        addresses:
        - 8.8.8.8
        search: []
      parameters:
        mii-monitor-interval: 10
        mode: 802.3ad
        lacp-rate: fast
  ethernets:
    ens6f0: {}
    ens6f1: {}
  version: 2
  查看聚合接口状态
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 10
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

802.3ad info
LACP rate: fast
Min links: 0
Aggregator selection policy (ad_select): stable
System priority: 65535
System MAC address: da:36:33:0d:87:6d
Active Aggregator Info:
        Aggregator ID: 1
        Number of ports: 2
        Actor Key: 9
        Partner Key: 1
        Partner Mac Address: bc:31:e2:17:a2:1b

Slave Interface: ens6f1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: 50:d3:3b:00:08:3d
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 1
Partner Churned Count: 1
details actor lacp pdu:
    system priority: 65535
    system mac address: da:36:33:0d:87:6d
    port key: 9
    port priority: 255
    port number: 1
    port state: 63
details partner lacp pdu:
    system priority: 32768
    system mac address: bc:31:e2:17:a2:1b
    oper key: 1
    port priority: 32768
    port number: 2
    port state: 61

Slave Interface: ens6f0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 50:d3:3b:00:08:3c
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 0
Partner Churned Count: 1
details actor lacp pdu:
    system priority: 65535
    system mac address: da:36:33:0d:87:6d
    port key: 9
    port priority: 255
    port number: 2
    port state: 63
details partner lacp pdu:
    system priority: 32768
    system mac address: bc:31:e2:17:a2:1b
    oper key: 1
    port priority: 32768
    port number: 1
    port state: 61

查看接口速率
root@yang:/home/yang# ethtool  bond0
Settings for bond0:
        Supported ports: [ ]
        Supported link modes:   Not reported
        Supported pause frame use: No
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 2000Mb/s
        Duplex: Full
        Port: Other
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: off
        Link detected: yes

2、对接华为交换机

#直接在原服务器上将activ-backup修改为balance-rr模式时,需要执行一下命令才能让新的模式生效
sudo ip link set bond0 down
sudo modprobe -r bonding
sudo modprobe bonding mode=balance-rr
sudo netplay apply 
--------------------------普通聚合状态-------------------------------
1、交换机上配置聚合端口状态,服务器与交换机G1/0/1和G1/0/2端口连接。
交换机配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
#
interface Eth-Trunk101
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 168
#
interface GE1/0/1
 eth-trunk 101
#
interface GE1/0/2
 eth-trunk 101
#
--------------------------------交换机M-LAG配置----------------------------------
1、两台交换机上配置聚合端口状态,服务器与两天交换机G1/0/1端口连接,GE1/0/8,G1/0/9作为Peer-link链路
G1/0/10作为keepalive链路
配置相同的dfs-group 编号即可

交换机01-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlanif 168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpn-instance DAD
 ipv4-family
  route-distinguisher 1:1
#
interface G1/0/10
undo portswitch
ip  banding vpn-instance DAD
ip adddress 21.1.1.1
m-lag unpaired-port reserved   # 配置为预留端口
#
stp mode rstp
stp v-stp enable
stp tc-protection
stp bpdu-protection
#
dfs-group 1
 priority 150
 dual-active detection source ip 21.1.1.1 vpn-instance DAD peer 21.1.1.2
#
interface Eth-Trunk0
 trunkport GE1/0/8
 trunkport GE1/0/9
 mode lacp-static
 peer-link 1
 port vlan exclude 1
#
interface Eth-Trunk101
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 168
 mode lacp-static
 dfs-group 1 m-lag 1
#
interface GE1/0/1
 eth-trunk 101
#
交换机02-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlanif 168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpn-instance DAD
 ipv4-family
  route-distinguisher 1:1
#
interface G1/0/10
undo portswitch
ip  banding vpn-instance DAD
ip adddress 21.1.1.2
m-lag unpaired-port reserved   # 配置为预留端口
#
stp mode rstp
stp v-stp enable
stp tc-protection
stp bpdu-protection
#
dfs-group 1
 priority 100
 dual-active detection source ip 21.1.1.2 vpn-instance DAD peer 21.1.1.1
#
interface Eth-Trunk0
 trunkport GE1/0/8
 trunkport GE1/0/9
 mode lacp-static
 peer-link 1
 port vlan exclude 1
#
interface Eth-Trunk101
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 168
 mode lacp-static
 dfs-group 1 m-lag 1
#
interface GE1/0/1
 eth-trunk 101
#

服务器配置:
network:
  bonds:
    bond0:
      addresses:
      - 192.168.10.10/24
      gateway4: 192.168.10.1
      interfaces:
      - ens6f0
      - ens6f1
      nameservers:
        addresses:
        - 8.8.8.8
        search: []
      parameters:
        mii-monitor-interval: 10
        mode: 802.3ad
        lacp-rate: fast
  ethernets:
    ens6f0: {}
    ens6f1: {}
  version: 2
  查看聚合接口状态
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 10
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

802.3ad info
LACP rate: fast
Min links: 0
Aggregator selection policy (ad_select): stable
System priority: 65535
System MAC address: da:36:33:0d:87:6d
Active Aggregator Info:
        Aggregator ID: 1
        Number of ports: 2
        Actor Key: 9
        Partner Key: 1
        Partner Mac Address: bc:31:e2:17:a2:1b

Slave Interface: ens6f1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: 50:d3:3b:00:08:3d
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 1
Partner Churned Count: 1
details actor lacp pdu:
    system priority: 65535
    system mac address: da:36:33:0d:87:6d
    port key: 9
    port priority: 255
    port number: 1
    port state: 63
details partner lacp pdu:
    system priority: 32768
    system mac address: bc:31:e2:17:a2:1b
    oper key: 1
    port priority: 32768
    port number: 2
    port state: 61

Slave Interface: ens6f0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 50:d3:3b:00:08:3c
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 0
Partner Churned Count: 1
details actor lacp pdu:
    system priority: 65535
    system mac address: da:36:33:0d:87:6d
    port key: 9
    port priority: 255
    port number: 2
    port state: 63
details partner lacp pdu:
    system priority: 32768
    system mac address: bc:31:e2:17:a2:1b
    oper key: 1
    port priority: 32768
    port number: 1
    port state: 61

查看接口速率
root@yang:/home/yang# ethtool  bond0
Settings for bond0:
        Supported ports: [ ]
        Supported link modes:   Not reported
        Supported pause frame use: No
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 2000Mb/s
        Duplex: Full
        Port: Other
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: off
        Link detected: yes

2、redhat

1、对接H3C交换机

--------------------------普通聚合状态-------------------------------
1、交换机上配置聚合端口状态,服务器与交换机G1/0/1和G1/0/2端口连接。
交换机配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
#
interface GigabitEthernet1/0/1
 port access vlan 168
 port link-aggregation group 101
#
interface GigabitEthernet1/0/2
 port access vlan 168
 port link-aggregation group 101
#
interface Bridge-Aggregation101
 description BOND_TEST
 port access vlan 168
 link-aggregation mode dynamic
#
--------------------------------交换机M-LAG配置----------------------------------
1、两台交换机上配置聚合端口状态,服务器与两天交换机G1/0/1端口连接,GE1/0/8,G1/0/9作为Peer-link链路
G1/0/10作为keepalive链路
在M-LAG双归接入三层网络的场景中,两台M-LAG设备需要同时作为三层网关,必须保证M-LAG设备上存在相同的IP地址和MAC地址的逻辑接口,以便实现
M-LAG系统中相互配置对的M-LAG接口的系统MAC地址必须相同,一般建议将系统mac配置为其中一台M-LAG设备的桥MAC地址
具有相同的M-LAG系统system priority
具有不同M-LAG设备的系统编号

交换机01-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpninstace keepalive
#
interface G1/0/10
port link-mode route
ip  banding vpn-instance keepalive
ip adddress 21.1.1.1
#
m-lag system-mac 2-2-2
m-lag role-priority 200  # 指定master角色
m-lag system-number 1
m-lag system-priority 123
m-lag standalone enable
m-lag keepalive ip vpn-instance destination 21.1.1.2 source 21.1.1.1
#
m-lag mad exclude interface G 1/0/10
m-lag mad exclude interface Vlan-interface168
#
interface bridge-aggregation 1
link-aggregation mode dynamic
#
interface range G 1/0/8 G 1/0/9
port link-aggregation group 1
#
interface bridge-aggregation 1
port m-lag peer-link 1
#
interface bridge-aggregation 101
#
interface G 1/0/1
port link-aggregation group 101
#
interface bridge-aggregation 101
link-aggregation mode dynamic
port m-lag group 1
port lacp system-priority 101
port link-type trunk
port trunk permit vlan 168
undo port trunk permit vlan 1
#
交换机02-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpninstace keepalive
#
interface G1/0/10
port link-mode route
ip  banding vpn-instance keepalive
ip adddress 21.1.1.2
#
m-lag system-mac 2-2-2
m-lag role-priority 100  # 指定master角色
m-lag system-number 2
m-lag system-priority 123
m-lag standalone enable
m-lag keepalive ip vpn-instance destination 21.1.1.1 source 21.1.1.2
#
m-lag mad exclude interface G 1/0/10
m-lag mad exclude interface Vlan-interface168
#
interface bridge-aggregation 1
link-aggregation mode dynamic
#
interface range G 1/0/8 G 1/0/9
port link-aggregation group 1
#
interface bridge-aggregation 1
port m-lag peer-link 1
#
interface bridge-aggregation 101
#
interface G 1/0/1
port link-aggregation group 101
#
interface bridge-aggregation 101
link-aggregation mode dynamic
port m-lag group 1
port lacp system-priority 100
port link-type trunk
port trunk permit vlan 168
undo port trunk permit vlan 1
#


服务器配置:
---------------------bond_port01配置文件-------------------------
[root@yang network-scripts]# cat ifcfg-bond0_port_1
TYPE=Ethernet
HWADDR=50:D3:3B:00:08:3C
NAME="bond0 port 1"
UUID=afa06332-3aef-4298-abff-c637e1e8acd0
DEVICE=ens6f0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
--------------------bond_port02配置文件-----------------------------
[root@yang network-scripts]# cat ifcfg-bond0_port_2
TYPE=Ethernet
HWADDR=50:D3:3B:00:08:3D
NAME="bond0 port 2"
UUID=df59a7b5-6c45-428a-ba48-38934c6f517c
DEVICE=ens6f1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
-----------------------bond配置文件-----------------------------------
[root@yang network-scripts]# cat ifcfg-Bond_connection_1 
BONDING_OPTS="mode=802.3ad downdelay=0 miimon=10 updelay=0"
TYPE=Bond
BONDING_MASTER=yes
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPADDR=192.168.10.10
PREFIX=24
GATEWAY=192.168.10.1
DNS1=8.8.8.8
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=Bond01
UUID=15a0ed6e-425b-4928-91d1-91f744a5d333
DEVICE=bond0
ONBOOT=yes

推荐使用nmci命令进行配置,配置命令如下:
yum install NetworkManager
nmcli connection add type bond ifname bond0 mode 802.3ad
nmcli connection add type ethernet ifname ens6f0 master bond0
nmcli connection add type ethernet ifname ens6f1 master bond0
# nmcli connection add type bond-slave ifname ens6f0 master bond0
# nmcli connection add type bond-slave ifname ens6f1 master bond0
nmcli connection modify bond0 ipv4.addresses 192.168.10.10/24 ipv4.gateway 192.168.10.1 ipv4.dns 8.8.8.8 ipv4.method manual connection.autoconnect yes
nmcli connection modify bond0 +ipv4.routes "192.168.0.0/16 192.168.10.1"
nmcli connection up bond0

2、对接华为交换机

#直接在原服务器上将activ-backup修改为balance-rr模式时,需要执行一下命令才能让新的模式生效
sudo ip link set bond0 down
sudo modprobe -r bonding
sudo modprobe bonding mode=balance-rr
sudo netplay apply 
--------------------------普通聚合状态-------------------------------
1、交换机上配置聚合端口状态,服务器与交换机G1/0/1和G1/0/2端口连接。
交换机配置:
#
vlan 168
 description TEST
#
interface Vlan-interface168
 description TEST
 ip address 192.168.10.1 255.255.255.0
#
interface Eth-Trunk101
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 168
#
interface GE1/0/1
 eth-trunk 101
#
interface GE1/0/2
 eth-trunk 101
#
--------------------------------交换机M-LAG配置----------------------------------
1、两台交换机上配置聚合端口状态,服务器与两天交换机G1/0/1端口连接,GE1/0/8,G1/0/9作为Peer-link链路
G1/0/10作为keepalive链路
配置相同的dfs-group 编号即可

交换机01-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlanif 168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpn-instance DAD
 ipv4-family
  route-distinguisher 1:1
#
interface G1/0/10
undo portswitch
ip  banding vpn-instance DAD
ip adddress 21.1.1.1
m-lag unpaired-port reserved   # 配置为预留端口
#
stp mode rstp
stp v-stp enable
stp tc-protection
stp bpdu-protection
#
dfs-group 1
 priority 150
 dual-active detection source ip 21.1.1.1 vpn-instance DAD peer 21.1.1.2
#
interface Eth-Trunk0
 trunkport GE1/0/8
 trunkport GE1/0/9
 mode lacp-static
 peer-link 1
 port vlan exclude 1
#
interface Eth-Trunk101
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 168
 mode lacp-static
 dfs-group 1 m-lag 1
#
interface GE1/0/1
 eth-trunk 101
#
交换机02-M-LAG配置:
#
vlan 168
 description TEST
#
interface Vlanif 168
 description TEST
 ip address 192.168.10.1 255.255.255.0
 mac-address 0002-2222-2222
#
ip vpn-instance DAD
 ipv4-family
  route-distinguisher 1:1
#
interface G1/0/10
undo portswitch
ip  banding vpn-instance DAD
ip adddress 21.1.1.2
m-lag unpaired-port reserved   # 配置为预留端口
#
stp mode rstp
stp v-stp enable
stp tc-protection
stp bpdu-protection
#
dfs-group 1
 priority 100
 dual-active detection source ip 21.1.1.2 vpn-instance DAD peer 21.1.1.1
#
interface Eth-Trunk0
 trunkport GE1/0/8
 trunkport GE1/0/9
 mode lacp-static
 peer-link 1
 port vlan exclude 1
#
interface Eth-Trunk101
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 168
 mode lacp-static
 dfs-group 1 m-lag 1
#
interface GE1/0/1
 eth-trunk 101
#

服务器配置:
---------------------bond_port01配置文件-------------------------
[root@yang network-scripts]# cat ifcfg-bond0_port_1
TYPE=Ethernet
HWADDR=50:D3:3B:00:08:3C
NAME="bond0 port 1"
UUID=afa06332-3aef-4298-abff-c637e1e8acd0
DEVICE=ens6f0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
--------------------bond_port02配置文件-----------------------------
[root@yang network-scripts]# cat ifcfg-bond0_port_2
TYPE=Ethernet
HWADDR=50:D3:3B:00:08:3D
NAME="bond0 port 2"
UUID=df59a7b5-6c45-428a-ba48-38934c6f517c
DEVICE=ens6f1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
-----------------------bond配置文件-----------------------------------
[root@yang network-scripts]# cat ifcfg-Bond_connection_1 
BONDING_OPTS="mode=802.3ad downdelay=0 miimon=10 updelay=0"
TYPE=Bond
BONDING_MASTER=yes
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPADDR=192.168.10.10
PREFIX=24
GATEWAY=192.168.10.1
DNS1=8.8.8.8
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=Bond01
UUID=15a0ed6e-425b-4928-91d1-91f744a5d333
DEVICE=bond0
ONBOOT=yes

推荐使用nmci命令进行配置,配置命令如下:
yum install NetworkManager
nmcli connection add type bond ifname bond0 mode 802.3ad
nmcli connection add type ethernet ifname ens6f0 master bond0
nmcli connection add type ethernet ifname ens6f1 master bond0
# nmcli connection add type bond-slave ifname ens6f0 master bond0
# nmcli connection add type bond-slave ifname ens6f1 master bond0
nmcli connection modify bond0 ipv4.addresses 192.168.10.10/24 ipv4.gateway 192.168.10.1 ipv4.dns 8.8.8.8 ipv4.method manual connection.autoconnect yes
nmcli connection modify bond0 +ipv4.routes "192.168.0.0/16 192.168.10.1"
nmcli connection up bond0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值