linux

centos teaming 티밍 - activebackup

sysman 2020. 12. 31. 18:10

 

[root@server1 ~]# nmcli con show

NAME                UUID                                  TYPE      DEVICE

ens33               dd621d94-b05d-49ab-9661-922f5abe8b6c  ethernet  ens33

Wired connection 1  9a1c9126-5892-3170-bade-f28fccc10c65  ethernet  ens37

Wired connection 2  7b4d58e7-6cc0-3cd5-8121-2344e7f88ecf  ethernet  ens38

 

[root@server1 ~]# ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000

    link/ether 00:0c:29:32:72:68 brd ff:ff:ff:ff:ff:ff

3: ens37: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000

    link/ether 00:0c:29:32:72:72 brd ff:ff:ff:ff:ff:ff

4: ens38: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000

    link/ether 00:0c:29:32:72:7c brd ff:ff:ff:ff:ff:ff

 

[root@server1 ~]# nmcli device status

DEVICE  TYPE      STATE      CONNECTION

ens33   ethernet  connected  ens33

ens37   ethernet  connected  Wired connection 1

ens38   ethernet  connected  Wired connection 2

lo      loopback  unmanaged  --

 

[root@server1 ~]# nmcli conn show

NAME                UUID                                  TYPE      DEVICE

ens33               dd621d94-b05d-49ab-9661-922f5abe8b6c  ethernet  ens33

Wired connection 1  9a1c9126-5892-3170-bade-f28fccc10c65  ethernet  ens37

Wired connection 2  7b4d58e7-6cc0-3cd5-8121-2344e7f88ecf  ethernet  ens38

 

 

티밍 설정

[root@server1 ~]# nmcli conn add con-name team0 type team ifname team0 config '{"runner":{"name":"activebackup"}}'

Connection 'team0' (0c591620-a989-47c0-93db-a54b58160a82) successfully added.

 

[root@server1 ~]# nmcli conn add con-name team0-port1 type team-slave ifname ens37 master team0

Connection 'team0-port1' (563b8598-c3a8-4f82-8f02-3d9d60054c7f) successfully added.

 

[root@server1 ~]# nmcli conn add con-name team0-port2 type team-slave ifname ens38 master team0

Connection 'team0-port2' (4cac070b-293c-4814-8ee6-5fa24f2c96cb) successfully added.

 

ip 설정

[root@server1 ~]# nmcli conn modify team0 ipv4.addresses 192.168.10.75/24 ipv4.method manual ipv4.gateway 192.168.10.1 ipv4.d

ipv4.dad-timeout                   ipv4.dhcp-timeout

ipv4.dhcp-client-id                ipv4.dhcp-vendor-class-identifier

ipv4.dhcp-fqdn                     ipv4.dns

ipv4.dhcp-hostname                 ipv4.dns-options

ipv4.dhcp-hostname-flags           ipv4.dns-priority

ipv4.dhcp-iaid                     ipv4.dns-search

ipv4.dhcp-send-hostname

 

[root@server1 ~]# nmcli conn modify team0 ipv4.addresses 192.168.10.75/24 ipv4.method manual ipv4.gateway 192.168.10.1 ipv4.dns 168.126.63.1

 

[root@server1 ~]# cd /etc/sysconfig/network-scripts/

[root@server1 network-scripts]# ls

ifcfg-ens33  ifcfg-team0  ifcfg-team0-port1  ifcfg-team0-port2

 

[root@server1 network-scripts]# cat ifcfg-team0

TEAM_CONFIG="{\"runner\":{\"name\":\"activebackup\"}}"

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=none

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=team0

UUID=0c591620-a989-47c0-93db-a54b58160a82

DEVICE=team0

ONBOOT=yes

DEVICETYPE=Team

IPADDR=192.168.10.75

PREFIX=24

GATEWAY=192.168.10.1

DNS1=168.126.63.1

 

[root@server1 network-scripts]# cat ifcfg-team0-port1

NAME=team0-port1

UUID=563b8598-c3a8-4f82-8f02-3d9d60054c7f

DEVICE=ens37

ONBOOT=yes

TEAM_MASTER=team0

DEVICETYPE=TeamPort

 

[root@server1 network-scripts]# cat ifcfg-team0-port2

NAME=team0-port2

UUID=4cac070b-293c-4814-8ee6-5fa24f2c96cb

DEVICE=ens38

ONBOOT=yes

TEAM_MASTER=team0

DEVICETYPE=TeamPort

 

 

[root@server1 network-scripts]# teamdctl team0 state

setup:

  runner: activebackup

runner:

  active port:

 

[root@server1 network-scripts]# systemctl restart NetworkManager

[root@server1 network-scripts]# systemctl restart network-online.target

[root@server1 network-scripts]# teamdctl team0 state

setup:

  runner: activebackup

runner:

  active port:

 

[root@server1 network-scripts]# ifdown team0

Connection 'team0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)

 

[root@server1 network-scripts]# ifup team0

Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)

 

[root@server1 network-scripts]# teamdctl team0 state

setup:

  runner: activebackup

runner:

  active port:

 

[root@server1 network-scripts]#

[root@server1 ~]# teamdctl team0 state

setup:

  runner: activebackup

ports:

  ens37

    link watches:

      link summary: up

      instance[link_watch_0]:

        name: ethtool

        link: up

        down count: 0

  ens38

    link watches:

      link summary: up

      instance[link_watch_0]:

        name: ethtool

        link: up

        down count: 0

runner:

  active port: ens37

[root@server1 ~]#

 

 

test

다른곳에서 해당서버로 ping 날리기

 

nmcli dev disconnect ens37

nmcli dev connect ens37

teamdctl team0 state

teamnl team0 ports   // team port 확인

teamnl team0 getoption activeport   //active port 확인

[root@server1 ~]# teamnl team0 setoption activeport 4

[root@server1 ~]# teamnl team0 setoption activeport 3

[root@server1 ~]# teamdctl team0 state

setup:

  runner: activebackup

ports:

  ens37

    link watches:

      link summary: up

      instance[link_watch_0]:

        name: ethtool

        link: up

        down count: 0

  ens38

    link watches:

      link summary: up

      instance[link_watch_0]:

        name: ethtool

        link: up

        down count: 0

runner:

  active port: ens38

[root@server1 ~]# teamnl getoption activeport

Unknown command "activeport".

 

teamnl [options] teamdevname command [command args]

        -h --help                Show this help

        -p --port_name           team slave port name

        -a --array_index         team option array index

Commands:

        ports

        options

        getoption OPT_NAME

        setoption OPT_NAME OPT_VALUE

        monitor OPT_STYLE

[root@server1 ~]# teamnl team0 getoption activeport

3

[root@server1 ~]# teamnl team0 setoption activeport 4

[root@server1 ~]# teamnl team0 getoption activeport

4

[root@server1 ~]# teamdctl team0 state

setup:

  runner: activebackup

ports:

  ens37

    link watches:

      link summary: up

      instance[link_watch_0]:

        name: ethtool

        link: up

        down count: 0

  ens38

    link watches:

      link summary: up

      instance[link_watch_0]:

        name: ethtool

        link: up

        down count: 0

runner:

  active port: ens38

[root@server1 ~]# teamnl team0 ports

 3: ens37: up 1000Mbit FD

 4: ens38: up 1000Mbit FD

[root@server1 ~]# teamnl team0 setoption activeport 3

[root@server1 ~]# teamdctl team0 state

setup:

  runner: activebackup

ports:

  ens37

    link watches:

      link summary: up

      instance[link_watch_0]:

        name: ethtool

        link: up

        down count: 0

  ens38

    link watches:

      link summary: up

      instance[link_watch_0]:

        name: ethtool

        link: up

        down count: 0

runner:

  active port: ens38

[root@server1 ~]# teamnl team setoption activeport 3

Netdevice "team" not found.

Command failed: No such device

[root@server1 ~]# teamnl team0 setoption activeport 3

[root@server1 ~]# teamnl team0 options

 queue_id (port:ens37) 0

 priority (port:ens37) 0

 user_linkup_enabled (port:ens37) false

 user_linkup (port:ens37) true

 enabled (port:ens37) false

 queue_id (port:ens38) 0

 priority (port:ens38) 0

 user_linkup_enabled (port:ens38) false

 user_linkup (port:ens38) true

 enabled (port:ens38) true

 activeport 3

 mcast_rejoin_interval 0

 mcast_rejoin_count 1

 notify_peers_interval 0

 notify_peers_count 1

 mode activebackup

[root@server1 ~]#

 

 

runner - mode

1) activebackup :링크 변경을 감시하고 active port 다운시 backup으로 넘어감

 

2) loadbalance : 트래픽을 모니터링하고 패킷 전송에 대한 포트를 선택할 때 완변학 균형에 도달하기 위해 hash function을 사용

 

3) lacp : 802.3ad 링크 표준 loadbalance runner와 동일한 전송

 

4) broadcast : simple한 runner로 이것은 모든 포트로 부터 각각의 패킷을 전송

 

5) roundrobin : simple한 runner로 이것은 각 포트에서 라운드 로빈 방식으로 각각의 패킷을 전송

'linux' 카테고리의 다른 글

centos - multipath + iscsi 설정  (0) 2021.01.02
centos - vlan 설정  (0) 2020.12.31
centos - 초기세팅  (0) 2020.12.30
Centos -backup  (0) 2020.12.29
centos - postfix  (0) 2020.12.28