集約リンク(NICバインド)の構成

3601 ワード

集約リンクの主な役割:ネットワークカードをバックアップし、単一の障害を防止し、1つのネットワークカードの障害の場合、2番目のネットワークカードを自動的に有効にします.
——ホットバックアップ(activebackup)、接続冗長
1、まず2つ以上のネットワークカード設備があること
eth1: flags=4163  mtu 1500
        ether 52:54:00:f8:86:c1  txqueuelen 1000  (Ethernet)
        RX packets 4934  bytes 272982 (266.5 KiB)
        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

eth2: flags=4163  mtu 1500
        ether 52:54:00:38:79:d9  txqueuelen 1000  (Ethernet)
        RX packets 4937  bytes 273272 (266.8 KiB)
        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、仮想NIC team 0の作成
[root@server0 ~]# nmcli connection add type team con-name team0 ifname team0 autoconnect yes config '{"runner": {"name" : "activebackup"}}'
Connection 'team0' (dd59fba1-9719-433a-ab44-ba0b38fb08b6) successfully added.

3、team 0メンバーの追加(NICデバイス)
[root@server0 ~]# nmcli connection add type team-slave con-name team0-1 ifname eth1 master team0
Connection 'team0-1' (406dd316-98be-4a3d-b8d7-249e4992220b) successfully added.
[root@server0 ~]# nmcli connection add type team-slave con-name team0-2 ifname eth2 master team0 
Connection 'team0-2' (d0c0b497-7409-4cd6-87ae-f4c2be2aa545) successfully added.

4、team 0 NIC ipの配置
[root@server0 ~]# nmcli connection modify team0 ipv4.method manual ipv4.addresses 192.168.1.1/24 connection.autoconnect yes

5、すべての構成をアクティブにする
[root@server0 ~]# nmcli connection up team0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
[root@server0 ~]# nmcli connection up team0-1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
[root@server0 ~]# nmcli connection up team0-2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)

通信のテスト:
別のデバイス上で上記の手順に従ってip 192.168.1.2の集約リンクを構成し、通信可能かどうかをテストする.実行中のNICをオフにし、通信可能かどうかをテストし、通信可能であれば構成に成功します.
[root@desktop0 ~]# ping -c 3 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.393 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.408 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.553 ms

--- 192.168.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.393/0.451/0.553/0.074 ms
[root@server0 ~]# ifconfig eth1 down
[root@server0 ~]# teamdctl team0 state
setup:
  runner: activebackup
ports:
  eth1
    link watches:
      link summary: down
      instance[link_watch_0]:
        name: ethtool
        link: down
  eth2
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
runner:
  active port: eth2
[root@desktop0 ~]# ping -c 3 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.285 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.300 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.529 ms

--- 192.168.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.285/0.371/0.529/0.112 ms