配置聚合连接(链路聚合)

注:此试验主要介绍'activebackup' 网卡热备份模式

1、创建虚拟网卡组

     命令:nmcli connection add  type team 
                 con-name team0 ifname team0 
                 autoconnect yes  
                 config  '{"runner": {"name": "activebackup"}}'

      命令格式简单说明:nmcli connection  添加    类型为    team(组队)
                                          配置文件名   team0   网卡名  team0
                                         每次开机自动启用
                                         工作模式为     热备份

  可以使用man命令辅助:man teamd.conf

# man teamd.conf               #man帮助
EXAMPLES
       {
         "device": "team0",
         "runner": {"name": "roundrobin"},
         "ports": {"eth1": {}, "eth2": {}}
       }

       Very basic configuration.

       {
         "device": "team0",
         "runner": {"name": "activebackup"},
         "link_watch": {"name": "ethtool"},

# nmcli connection add type team con-name team0 ifname team0 autoconnect yes config '{"runner": {"name": "activebackup"}}'
Connection 'team0' (e29ceff9-4944-4a2f-b5db-f52bbb5c0263) successfully added.
# ifconfig team0    ###创建成功后查看
team0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether c6:8c:c4:9b:c6:1f  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 2.给组里添加成员

     命令:#nmcli connection add type  team-slave 
   con-name team0-2 ifname eth2  master team0

     命令简介:# nmcli connection 添加  类型   team-成员
     配置文件名为  team0-2  网卡名  eth2 主设备  为team0

# nmcli connection add type team-slave con-name team0-1 ifname eth0 master team0
Connection 'team0-1' (bf3afedf-0b07-488c-9215-29159b0b5f3a) successfully added.
########添加网卡eth0到team0
# nmcli connection add type team-slave con-name team0-2 ifname eth1 master team0
Connection 'team0-2' (068fe4ac-8463-4033-b82d-de0916b74103) successfully added.
########添加网卡eth1到team0

3. 为虚拟网卡team0配置IP地址

# nmcli connection modify team0 ipv4.method manual ipv4.addresses 192.168.1.1/24 connection.autoconnect yes

 4.激活配置

[root@server0 ~]# nmcli connection up team0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
# nmcli connection up team0-1
# nmcli connection up team0-2

5.测试效果

查看链路聚合状态的命令

# ifconfig  eth0  down             如果网卡1down掉
# teamdctl  team0 state         查看但前team0的状态

6.其他

#nmcli  connection  delete  team0     #删除team0配置

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值