RHCE:配置链路聚合

配置链路聚合
Teamd可以使用的配置选项:
Broadcast:传输来自所有端口的每个包
Roundrobin:以轮循的方式传输来自每个端口的包
Activebackup:监视链路更改并选择活动端口进行数据传输
Loadbalance:监视流量并使用HASH函数以负载均衡的方式来进行数据传输
Lacp:这个需要交换机支持


添加网络组:
[root@foundation0 ~]# nmcli connection add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}'
Connection 'team0' (5d339c44-9c06-4a73-91d6-b8596458e1ca) successfully added.


为网络组team0添加IPV4地址:
[root@foundation0 ~]# nmcli connection modify team0 ipv4.addresses "192.168.2.69/16"
[root@foundation0 ~]# nmcli connection modify team0 ipv4.method manual
[root@foundation0 ~]# nmcli connection down team0
[root@foundation0 ~]# nmcli connection up team0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/15)


为网络组端口team0添加网卡接口:
为team0网络组添加网卡接口:
[root@foundation0 ~]# nmcli connection add type team-slave ifname eno67109424 master team0 
Connection 'team-slave-eno67109424' (4eb2f5bf-bc26-41a3-b962-4cf1a3067c92) successfully added.
[root@foundation0 ~]# nmcli connection add type team-slave ifname eno83886648 master team0 
Connection 'team-slave-eno83886648' (c292c983-6a3b-4ce4-a8cf-01e9931e437f) successfully added.


查看创建后的配置:
[root@foundation0 ~]# nmcli connection show
NAME                    UUID                                  TYPE            DEVICE         
team-slave-eno83886648  c292c983-6a3b-4ce4-a8cf-01e9931e437f  802-3-ethernet  eno83886648 
team-slave-eno67109424  4eb2f5bf-bc26-41a3-b962-4cf1a3067c92  802-3-ethernet  eno67109424 
team0                   5d339c44-9c06-4a73-91d6-b8596458e1ca  team            team0   


启用team0接口
[root@foundation0 ~]# nmcli connection up team0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/18)


查看team0是否配置成功:
[root@foundation0 ~]# nmcli connection show team0
connection.id:                          team0
connection.uuid:                        5d339c44-9c06-4a73-91d6-b8596458e1ca
connection.interface-name:              team0
connection.type:                        team
connection.autoconnect:                 yes
connection.timestamp:                   1513065535




查看网络组以及组接口配置情况:
[root@foundation0 ~]# teamdctl team0 state
setup:
  runner: loadbalance
ports:
  eno67109424
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
  eno83886648
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up


显示当前team0当前的JSON配置:
[root@foundation0 ~]# teamdctl team0 config dump
{
    "device": "team0",
    "ports": {
        "eno67109424": {
            "link_watch": {
                "name": "ethtool"
            }
        },
        "eno83886648": {
            "link_watch": {
                "name": "ethtool"
            }
        }
    },
    "runner": {
        "name": "loadbalance",
        "tx_hash": [
            "eth",
            "ipv4",
            "ipv6"
        ]
    }
}


列出team0网络组下面的端口:
[root@foundation0 ~]# teamnl team0 ports
 5: eno67109424: up 1000Mbit FD 
 6: eno83886648: up 1000Mbit FD 




网络组接口有配置IP地址,而网络组下面的端口没有配置IP地址:
[root@foundation0 ~]# ip addr show eno67109424 
5: eno67109424: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
    link/ether 00:0c:29:06:a4:4e brd ff:ff:ff:ff:ff:ff
[root@foundation0 ~]# ip addr show eno83886648 
6: eno83886648: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
    link/ether 00:0c:29:06:a4:4e brd ff:ff:ff:ff:ff:ff
[root@foundation0 ~]# ip addr show team0 
15: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether 00:0c:29:06:a4:4e brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.69/16 brd 192.168.255.255 scope global team0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe06:a44e/64 scope link tentative dadfailed 
       valid_lft forever preferred_lft forever


如果team0修改配置后,端口网卡的配置也要重新配置


修改teamd的运行模式: 将activebackup修改成roundrobin
方法一:修改配置文件:
[root@foundation0 ~]# nmcli device disconnect team0 #停止team0
[root@foundation0 ~]# vim /etc/sysconfig/network-scripts/ifcfg-team0  #修改网卡配置文件
DEVICE=team0
TEAM_CONFIG="{\"runner\":{\"name\":\"roundrobin\"}}" #将activebackup修改成roundrobin
DEVICETYPE=Team
BOOTPROTO=none
DEFROUTE=yes


[root@foundation0 ~]# nmcli connection load /etc/sysconfig/network-scripts/ifcfg-team0 #重新加载配置文件


重新激活网络组配置文件:
[root@foundation0 ~]# nmcli connection up team0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/24)
重新激活端口配置文件:
[root@foundation0 ~]# nmcli connection up team-slave-eno83886648
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/25)
[root@foundation0 ~]# nmcli connection up team-slave-eno67109424
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/26)
查看是否配置成功:
[root@foundation0 ~]# teamdctl team0 state
setup:
  runner: roundrobin
ports:
  eno67109424
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
  eno83886648
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up


[root@foundation0 ~]# teamdctl team0 config dump
{
    "device": "team0",
    "ports": {
        "eno67109424": {
            "link_watch": {
                "name": "ethtool"
            }
        },
        "eno83886648": {
            "link_watch": {
                "name": "ethtool"
            }
        }
    },
    "runner": {
        "name": "roundrobin"
    }
}


查看使用teamnl 命令显示要调整的选项:
[root@foundation0 ~]# teamnl team0 options
 queue_id (port:eno67109424) 0 
 priority (port:eno67109424) 0 
 user_linkup_enabled (port:eno67109424) false 
 user_linkup (port:eno67109424) true 
 enabled (port:eno67109424) true 
 queue_id (port:eno83886648) 0 
 priority (port:eno83886648) 0 
 user_linkup_enabled (port:eno83886648) false 
 user_linkup (port:eno83886648) true 
 enabled (port:eno83886648) true 
 mcast_rejoin_interval 0 
 mcast_rejoin_count 0 
 notify_peers_interval 0 
 notify_peers_count 0 
 mode roundrobin 


方法二:通过命令来修改:
[root@foundation0 ~]# nmcli device disconnect team0 #先关闭接口后修改
[root@foundation0 ~]# nmcli connection modify team0 team.config '{"runner":{"name":"activebackup"}}' #将roundrobin修改成activebackup


查看配置文件是否修改成功
[root@foundation0 ~]# cat /etc/sysconfig/network-scripts/ifcfg-team0
DEVICE=team0
TEAM_CONFIG="{\"runner\":{\"name\":\"activebackup\"}}"
DEVICETYPE=Team
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=team0
UUID=5d339c44-9c06-4a73-91d6-b8596458e1ca
ONBOOT=yes
IPADDR0=192.168.2.69
PREFIX0=16
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes


重新连接team0
[root@foundation0 ~]# nmcli connection up team0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/27)
查看team0下面的端口,因修改了配置,所以,以前所有的端口都没有生效。
[root@foundation0 ~]# teamdctl team0 state
setup:
  runner: activebackup
runner:
  active port:
将team0下面的两个端口重新激活生效:
[root@foundation0 ~]# nmcli connection up team-slave-eno83886648
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/28)
[root@foundation0 ~]# nmcli connection up team-slave-eno67109424
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/29)


查看是否配置成功
[root@foundation0 ~]# teamdctl team0 state
setup:
  runner: activebackup
ports:
  eno67109424
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
  eno83886648
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
runner:
  active port: eno83886648


查看详细的参数:
[root@foundation0 ~]# teamnl team0 options
 queue_id (port:eno67109424) 0 
 priority (port:eno67109424) 0 
 user_linkup_enabled (port:eno67109424) false 
 user_linkup (port:eno67109424) true 
 enabled (port:eno67109424) false 
 queue_id (port:eno83886648) 0 
 priority (port:eno83886648) 0 
 user_linkup_enabled (port:eno83886648) false 
 user_linkup (port:eno83886648) true 
 enabled (port:eno83886648) true 
 activeport 6 
 mcast_rejoin_interval 0 
 mcast_rejoin_count 1 
 notify_peers_interval 0 
 notify_peers_count 1 
 mode activebackup 
分割线
感谢打赏
江西数库信息技术有限公司
YWSOS.COM 平台代运维解决方案
 评论
 发表评论
姓   名:

Powered by AKCMS