linux配置聚合链路 linux配置聚合链路

linux配置聚合链路

版权声明: https://blog.csdn.net/zhydream77/article/details/82383862

聚合连接(team):指的是网络连接的捆绑/组队,通过将多个实际网卡(team-slave)整和为逻辑上的单个连接,实现负载均衡,热备份等单块网卡难以完成的特殊功能。

聚合连接的类型:热备份activebackup,轮询负载均衡roundrobin

定义聚合连接的类型配置时,采用JSON语法,主要特点如下:

标记一个对象–(对象)

每个对象  —名称:值

每个字符串—“字符串”

热备份-聚合连接(activebackup)

[root@zhuhaiyan ~]# ifconfig 

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 52:54:00:b7:f8:8d  txqueuelen 1000  (Ethernet)
        RX packets 10906  bytes 567630 (554.3 KiB)
        RX errors 0  dropped 16  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 52:54:00:ff:92:36  txqueuelen 1000  (Ethernet)
        RX packets 10906  bytes 567630 (554.3 KiB)
        RX errors 0  dropped 16  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@zhuhaiyan ~]# nmcli connection add con-name team0 type team ifname team0 config ‘{“runner”:{“name”:”activebackup”}}’;
连接“team0”(5c80f42f-5cec-4f5a-8a05-4b83d8bc7fab) 已成功添加。
[root@zhuhaiyan ~]# nmcli con modify team0 ipv4.method manual ipv4.addresses 172.16.3.20/24 connection.autoconnect yes
[root@zhuhaiyan ~]# nmcli con add con-name team0-p1 type team-slave ifname eth1 master team0
连接“team0-p1”(4b565f4d-c02c-42e7-8b40-62c76db0b2c0) 已成功添加。
[root@zhuhaiyan ~]# nmcli con add con-name team0-p2 type team-slave ifname eth2 master team0
连接“team0-p2”(1e8f123c-f407-44d7-8be2-2dbb029b1ec0) 已成功添加。
[root@zhuhaiyan ~]# nmcli connection up team0
成功激活(主服务器等待从服务器)连接(D-Bus 激活路径:/org/freedesktop/NetworkManager/ActiveConnection/11)
[root@zhuhaiyan ~]# nmcli connection up team0-p1
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/14)
[root@zhuhaiyan ~]# nmcli connection up team0-p2
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/15)

扫描二维码关注公众号,回复: 3106290 查看本文章

查看聚合连接地址
[root@zhuhaiyan ~]# ifconfig team0
team0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.16.3.20  netmask 255.255.255.0  broadcast 172.16.3.255
        inet6 fe80::b531:8bf1:a293:311e  prefixlen 64  scopeid 0x20<link>
        ether 72:82:3b:2b:7f:00  txqueuelen 1000  (Ethernet)
        RX packets 31  bytes 1178 (1.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 92  bytes 10348 (10.1 KiB)
        TX errors 0  dropped 2 overruns 0  carrier 0  collisions 0

查看聚合连接运行状态

[root@zhuhaiyan ~]# teamdctl team0 state
setup:
  runner: activebackup      //运行模式/类型
ports:
  eth1                      //成员网卡1
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
  eth2                //成员网卡2
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
runner:
  active port: eth1     //当前活动的成员网卡
 

版权声明: https://blog.csdn.net/zhydream77/article/details/82383862

聚合连接(team):指的是网络连接的捆绑/组队,通过将多个实际网卡(team-slave)整和为逻辑上的单个连接,实现负载均衡,热备份等单块网卡难以完成的特殊功能。

聚合连接的类型:热备份activebackup,轮询负载均衡roundrobin

定义聚合连接的类型配置时,采用JSON语法,主要特点如下:

标记一个对象–(对象)

每个对象  —名称:值

每个字符串—“字符串”

热备份-聚合连接(activebackup)

[root@zhuhaiyan ~]# ifconfig 

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 52:54:00:b7:f8:8d  txqueuelen 1000  (Ethernet)
        RX packets 10906  bytes 567630 (554.3 KiB)
        RX errors 0  dropped 16  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 52:54:00:ff:92:36  txqueuelen 1000  (Ethernet)
        RX packets 10906  bytes 567630 (554.3 KiB)
        RX errors 0  dropped 16  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@zhuhaiyan ~]# nmcli connection add con-name team0 type team ifname team0 config ‘{“runner”:{“name”:”activebackup”}}’;
连接“team0”(5c80f42f-5cec-4f5a-8a05-4b83d8bc7fab) 已成功添加。
[root@zhuhaiyan ~]# nmcli con modify team0 ipv4.method manual ipv4.addresses 172.16.3.20/24 connection.autoconnect yes
[root@zhuhaiyan ~]# nmcli con add con-name team0-p1 type team-slave ifname eth1 master team0
连接“team0-p1”(4b565f4d-c02c-42e7-8b40-62c76db0b2c0) 已成功添加。
[root@zhuhaiyan ~]# nmcli con add con-name team0-p2 type team-slave ifname eth2 master team0
连接“team0-p2”(1e8f123c-f407-44d7-8be2-2dbb029b1ec0) 已成功添加。
[root@zhuhaiyan ~]# nmcli connection up team0
成功激活(主服务器等待从服务器)连接(D-Bus 激活路径:/org/freedesktop/NetworkManager/ActiveConnection/11)
[root@zhuhaiyan ~]# nmcli connection up team0-p1
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/14)
[root@zhuhaiyan ~]# nmcli connection up team0-p2
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/15)

查看聚合连接地址
[root@zhuhaiyan ~]# ifconfig team0
team0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.16.3.20  netmask 255.255.255.0  broadcast 172.16.3.255
        inet6 fe80::b531:8bf1:a293:311e  prefixlen 64  scopeid 0x20<link>
        ether 72:82:3b:2b:7f:00  txqueuelen 1000  (Ethernet)
        RX packets 31  bytes 1178 (1.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 92  bytes 10348 (10.1 KiB)
        TX errors 0  dropped 2 overruns 0  carrier 0  collisions 0

查看聚合连接运行状态

[root@zhuhaiyan ~]# teamdctl team0 state
setup:
  runner: activebackup      //运行模式/类型
ports:
  eth1                      //成员网卡1
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
  eth2                //成员网卡2
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
runner:
  active port: eth1     //当前活动的成员网卡
 

猜你喜欢

转载自blog.csdn.net/weixin_41909810/article/details/82491849