🌽

Debian 12 の bonding を試す(2)

に公開

環境

の続き。
Linuxの Active-Stanby の bonding をもう少し試す。

Ciscoスイッチの設定

VLAN10 と VLAN20について、HSRP で冗長化する。
Vlan10 のアクテイブスイッチ。Vlan20 のスタンバイスイッチにしたい。

ESW1の基本設定

vlanは設定済み

ESW1#show vlan-s

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/0, Fa1/1, Fa1/2, Fa1/3
                                                Fa1/4, Fa1/5, Fa1/6, Fa1/7
                                                Fa1/8, Fa1/9, Fa1/10, Fa1/11
                                                Fa1/12, Fa1/13, Fa1/14, Fa1/15
10   vlan0010                         active    
20   vlan0020                         active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        1002   1003
10   enet  100010     1500  -      -      -        -    -        0      0   
20   enet  100020     1500  -      -      -        -    -        0      0   
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0   
1005 trnet 101005     1500  -      -      1        ibm  -        0      0   

VTPサーバモード設定

vtp domain cisco
vtp password ccna

確認

ESW1#show vtp status 
VTP Version                     : 2
Configuration Revision          : 2
Maximum VLANs supported locally : 36
Number of existing VLANs        : 7
VTP Operating Mode              : Server
VTP Domain Name                 : cisco
VTP Pruning Mode                : Disabled
VTP V2 Mode                     : Disabled
VTP Traps Generation            : Disabled
MD5 digest                      : 0xB2 0x21 0xD1 0xF6 0x44 0x2D 0xF9 0x14 
Configuration last modified by 0.0.0.0 at 3-1-02 00:01:21
Local updater ID is 0.0.0.0 (no valid interface found)

ESW2との間でトランク接続する。

int range fa1/14 - 15
switchport trunk encapsulation dot1q
switchport mode trunk
channel-group 1 mode on

int po1
switchport trunk encapsulation dot1q
switchport mode trunk

アクセスポート設定。

int range fa1/0 - 3
switchport mode access
switchport access vlan 10

int range fa1/4 - 7
switchport mode access
switchport access vlan 20

確認

ESW1#show vlan-s

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/8, Fa1/9, Fa1/10, Fa1/11
                                                Fa1/12, Fa1/13
10   vlan0010                         active    Fa1/0, Fa1/1, Fa1/2, Fa1/3
20   vlan0020                         active    Fa1/4, Fa1/5, Fa1/6, Fa1/7
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        1002   1003
10   enet  100010     1500  -      -      -        -    -        0      0   
20   enet  100020     1500  -      -      -        -    -        0      0   
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0   
1005 trnet 101005     1500  -      -      1        ibm  -        0      0   
ESW1#show etherchannel summary 
Flags:  D - down        P - in port-channel
        I - stand-alone s - suspended
        R - Layer3      S - Layer2
        U - in use
Group Port-channel  Ports
-----+------------+-----------------------------------------------------------
1     Po1(SU)     Fa1/14(P)  Fa1/15(P)  

ESW1#show int trunk 

Port      Mode         Encapsulation  Status        Native vlan
Po1       on           802.1q         trunking      1

Port      Vlans allowed on trunk
Po1       1-4094

Port      Vlans allowed and active in management domain
Po1       1,10,20

Port      Vlans in spanning tree forwarding state and not pruned
Po1       1,10,20

vlan10 と vlan20 にアドレスを設定。

int vlan 10
ip address 10.2.10.252 255.255.255.0

int vlan 20
ip address 10.2.20.252 255.255.255.0

確認

ESW1#show ip int bri
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES NVRAM  administratively down down    
FastEthernet0/1            unassigned      YES NVRAM  administratively down down    
FastEthernet1/0            unassigned      YES unset  up                    up      
FastEthernet1/1            unassigned      YES unset  up                    up      
FastEthernet1/2            unassigned      YES unset  up                    down    
FastEthernet1/3            unassigned      YES unset  up                    down    
FastEthernet1/4            unassigned      YES unset  up                    up      
FastEthernet1/5            unassigned      YES unset  up                    up      
FastEthernet1/6            unassigned      YES unset  up                    up      
FastEthernet1/7            unassigned      YES unset  up                    down    
FastEthernet1/8            unassigned      YES unset  up                    down    
FastEthernet1/9            unassigned      YES unset  up                    down    
FastEthernet1/10           unassigned      YES unset  up                    down    
FastEthernet1/11           unassigned      YES unset  up                    down    
FastEthernet1/12           unassigned      YES unset  up                    down    
FastEthernet1/13           unassigned      YES unset  up                    down    
FastEthernet1/14           unassigned      YES unset  up                    up      
FastEthernet1/15           unassigned      YES unset  up                    up      
Port-channel1              unassigned      YES unset  up                    up      
Vlan1                      unassigned      YES NVRAM  administratively down down    
Vlan10                     10.2.10.252     YES manual up                    up      
Vlan20                     10.2.20.252     YES manual up                    up      

ESW2の基本設定

VTPクライアントモード設定

vtp mode client
vtp domain cisco
vtp password ccna

ESW1 との間でトランク接続する

int range fa1/14 - 15
switchport trunk encapsulation dot1q
switchport mode trunk
channel-group 1 mode on

int po1
switchport trunk encapsulation dot1q
switchport mode trunk

確認

ESW2#show vtp status
VTP Version                     : 2
Configuration Revision          : 0
Maximum VLANs supported locally : 36
Number of existing VLANs        : 5
VTP Operating Mode              : Client
VTP Domain Name                 : cisco
VTP Pruning Mode                : Disabled
VTP V2 Mode                     : Disabled
VTP Traps Generation            : Disabled
MD5 digest                      : 0x56 0x0E 0x79 0x44 0xC4 0xD2 0x41 0xDD 
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00

降ってこなかったら設定し直す。

vtp mode transparent 
vtp mode client 

確認

ESW2#show vtp status
VTP Version                     : 2
Configuration Revision          : 2
Maximum VLANs supported locally : 36
Number of existing VLANs        : 7
VTP Operating Mode              : Client
VTP Domain Name                 : cisco
VTP Pruning Mode                : Disabled
VTP V2 Mode                     : Disabled
VTP Traps Generation            : Disabled
MD5 digest                      : 0xB2 0x21 0xD1 0xF6 0x44 0x2D 0xF9 0x14 
Configuration last modified by 0.0.0.0 at 3-1-02 00:01:21
ESW2#show vlan-s

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/0, Fa1/1, Fa1/2, Fa1/3
                                                Fa1/4, Fa1/5, Fa1/6, Fa1/7
                                                Fa1/8, Fa1/9, Fa1/10, Fa1/11
                                                Fa1/12, Fa1/13
10   vlan0010                         active    
20   vlan0020                         active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        1002   1003
10   enet  100010     1500  -      -      -        -    -        0      0   
20   enet  100020     1500  -      -      -        -    -        0      0   
1002 fddi  101002     1500  -      0      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0   
1005 trnet 101005     1500  -      -      1        ibm  -        0      0   
ESW2#show etherchannel summary 
Flags:  D - down        P - in port-channel
        I - stand-alone s - suspended
        R - Layer3      S - Layer2
        U - in use
Group Port-channel  Ports
-----+------------+-----------------------------------------------------------
1     Po1(SU)     Fa1/14(P)  Fa1/15(P)  

ESW2#show int trunk

Port      Mode         Encapsulation  Status        Native vlan
Po1       on           802.1q         trunking      1

Port      Vlans allowed on trunk
Po1       1-4094

Port      Vlans allowed and active in management domain
Po1       1,10,20

Port      Vlans in spanning tree forwarding state and not pruned
Po1       1,10,20

アクセスポート設定

int range fa1/0 - 3
switchport mode access
switchport access vlan 10

int range fa1/4 - 7
switchport mode access
switchport access vlan 20

確認

ESW2#show vlan-s

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/8, Fa1/9, Fa1/10, Fa1/11
                                                Fa1/12, Fa1/13
10   vlan0010                         active    Fa1/0, Fa1/1, Fa1/2, Fa1/3
20   vlan0020                         active    Fa1/4, Fa1/5, Fa1/6, Fa1/7
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        1002   1003
10   enet  100010     1500  -      -      -        -    -        0      0   
20   enet  100020     1500  -      -      -        -    -        0      0   
1002 fddi  101002     1500  -      0      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0   
1005 trnet 101005     1500  -      -      1        ibm  -        0      0   

vlan10 と vlan20 にアドレスを設定。

int vlan 10
ip address 10.2.10.253 255.255.255.0

int vlan 20
ip address 10.2.20.253 255.255.255.0

確認

ESW2#show ip int bri
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES NVRAM  administratively down down    
FastEthernet0/1            unassigned      YES NVRAM  administratively down down    
FastEthernet1/0            unassigned      YES unset  up                    up      
FastEthernet1/1            unassigned      YES unset  up                    up      
FastEthernet1/2            unassigned      YES unset  up                    up      
FastEthernet1/3            unassigned      YES unset  up                    down    
FastEthernet1/4            unassigned      YES unset  up                    up      
FastEthernet1/5            unassigned      YES unset  up                    up      
FastEthernet1/6            unassigned      YES unset  up                    down    
FastEthernet1/7            unassigned      YES unset  up                    down    
FastEthernet1/8            unassigned      YES unset  up                    down    
FastEthernet1/9            unassigned      YES unset  up                    down    
FastEthernet1/10           unassigned      YES unset  up                    down    
FastEthernet1/11           unassigned      YES unset  up                    down    
FastEthernet1/12           unassigned      YES unset  up                    down    
FastEthernet1/13           unassigned      YES unset  up                    down    
FastEthernet1/14           unassigned      YES unset  up                    up      
FastEthernet1/15           unassigned      YES unset  up                    up      
Port-channel1              unassigned      YES unset  up                    up      
Vlan1                      unassigned      YES NVRAM  administratively down down    
Vlan10                     10.2.10.253     YES manual up                    up      
Vlan20                     10.2.20.253     YES manual up                    up      

HSRP 設定

ESW1の設定

int fa0/0
ip addr 10.2.0.253 255.255.255.252
no shut

int vlan 10
standby 10 ip 10.2.10.254
standby 10 priority 105
standby 10 preempt

int vlan 20
standby 20 ip 10.2.20.254
standby 20 preempt

ESW2の設定

int fa0/0
ip addr 10.2.1.253 255.255.255.252
no shut

int vlan 10
standby 10 ip 10.2.10.254
standby 10 preempt

int vlan 20
standby 20 ip 10.2.20.254
standby 20 priority 105
standby 20 preempt

確認

ESW1#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Vl10        10   105 P Active  local           10.2.10.253     10.2.10.254
Vl20        20   100 P Standby 10.2.20.253     local           10.2.20.254
ESW1#show standby       
Vlan10 - Group 10
  State is Active
    2 state changes, last state change 00:05:29
  Virtual IP address is 10.2.10.254
  Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.012 secs
  Preemption enabled
  Active router is local
  Standby router is 10.2.10.253, priority 100 (expires in 9.224 sec)
  Priority 105 (configured 105)
  Group name is "hsrp-Vl10-10" (default)
Vlan20 - Group 20
  State is Standby
    4 state changes, last state change 00:01:20
  Virtual IP address is 10.2.20.254
  Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.060 secs
  Preemption enabled
  Active router is 10.2.20.253, priority 105 (expires in 9.040 sec)
  Standby router is local
  Priority 100 (default 100)
  Group name is "hsrp-Vl20-20" (default)
ESW1#
ESW2#show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Vl10        10   100 P Standby 10.2.10.252     local           10.2.10.254
Vl20        20   105 P Active  local           10.2.20.252     10.2.20.254
ESW2#show standby      
Vlan10 - Group 10
  State is Standby
    1 state change, last state change 00:04:52
  Virtual IP address is 10.2.10.254
  Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.064 secs
  Preemption enabled
  Active router is 10.2.10.252, priority 105 (expires in 8.856 sec)
  Standby router is local
  Priority 100 (default 100)
  Group name is "hsrp-Vl10-10" (default)
Vlan20 - Group 20
  State is Active
    2 state changes, last state change 00:02:05
  Virtual IP address is 10.2.20.254
  Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.860 secs
  Preemption enabled
  Active router is local
  Standby router is 10.2.20.252, priority 100 (expires in 7.136 sec)
  Priority 105 (configured 105)
  Group name is "hsrp-Vl20-20" (default)

疎通確認

PC1から疎通確認

PC1> show ip

NAME        : PC1[1]
IP/MASK     : 10.2.10.11/24
GATEWAY     : 10.2.10.254
DNS         : 
MAC         : 00:50:79:66:68:00
LPORT       : 10020
RHOST:PORT  : 127.0.0.1:10021
MTU         : 1500
ping 宛先 結果
10.2.10.252 o
10.2.10.253 o
10.2.10.254 o
10.2.20.252 o
10.2.20.253 x
10.2.20.254 x

PC2から疎通確認

PC2> show ip

NAME        : PC2[1]
IP/MASK     : 10.2.20.11/24
GATEWAY     : 10.2.20.254
DNS         : 
MAC         : 00:50:79:66:68:01
LPORT       : 10022
RHOST:PORT  : 127.0.0.1:10023
MTU         : 1500
ping 宛先 結果
10.2.10.252 x
10.2.10.253 o
10.2.10.254 x
10.2.20.252 o
10.2.20.253 o
10.2.20.254 o

ip routing 設定

ESW1で設定

ESW1#show ip route
Default gateway is not set

Host               Gateway           Last Use    Total Uses  Interface
ICMP redirect cache is empty
ip routing 
ESW1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C       10.2.10.0/24 is directly connected, Vlan10
C       10.2.20.0/24 is directly connected, Vlan20
C       10.2.0.252/30 is directly connected, FastEthernet0/0

PC1から疎通確認

ping 宛先 結果
10.2.10.252 o
10.2.10.253 o
10.2.10.254 o
10.2.20.252 o
10.2.20.253 o
10.2.20.254 o

PC2からの疎通確認は結果に変化なし

ESW2で設定

ESW2#show ip route
Default gateway is not set

Host               Gateway           Last Use    Total Uses  Interface
ICMP redirect cache is empty
ip routing
ESW2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C       10.2.10.0/24 is directly connected, Vlan10
C       10.2.20.0/24 is directly connected, Vlan20
C       10.2.1.252/30 is directly connected, FastEthernet0/0

PC2から疎通確認

ping 宛先 結果
10.2.10.252 o
10.2.10.253 o
10.2.10.254 o
10.2.20.252 o
10.2.20.253 o
10.2.20.254 o

トラッキング設定

ESW1の設定

track 1 interface fa0/0 line-protocol
int vlan 10
standby 10 track 1 decrement 10

確認

ESW1#show track 1 
Track 1 
  Interface FastEthernet0/0 line-protocol
  Line protocol is Up
    1 change, last change 00:02:58
  Tracked by:
    HSRP Vlan10 10
ESW1#show standby 
Vlan10 - Group 10
  State is Active
    2 state changes, last state change 01:29:28
  Virtual IP address is 10.2.10.254
  Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.480 secs
  Preemption enabled
  Active router is local
  Standby router is 10.2.10.253, priority 100 (expires in 7.660 sec)
  Priority 105 (configured 105)
    Track object 1 state Up decrement 10
  Group name is "hsrp-Vl10-10" (default)
Vlan20 - Group 20
  State is Standby
    4 state changes, last state change 01:25:19
  Virtual IP address is 10.2.20.254
  Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.464 secs
  Preemption enabled
  Active router is 10.2.20.253, priority 105 (expires in 8.824 sec)
  Standby router is local
  Priority 100 (default 100)
  Group name is "hsrp-Vl20-20" (default)

ESW2の設定

track 1 interface fa0/0 line-protocol
int vlan 20
standby 20 track 1 decrement 10

確認

ESW2#show track 1
Track 1 
  Interface FastEthernet0/0 line-protocol
  Line protocol is Up
    1 change, last change 00:02:10
  Tracked by:
    HSRP Vlan20 20
ESW2#show standby 
Vlan10 - Group 10
  State is Standby
    1 state change, last state change 01:29:22
  Virtual IP address is 10.2.10.254
  Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.504 secs
  Preemption enabled
  Active router is 10.2.10.252, priority 105 (expires in 9.376 sec)
  Standby router is local
  Priority 100 (default 100)
  Group name is "hsrp-Vl10-10" (default)
Vlan20 - Group 20
  State is Active
    2 state changes, last state change 01:26:34
  Virtual IP address is 10.2.20.254
  Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.296 secs
  Preemption enabled
  Active router is local
  Standby router is 10.2.20.252, priority 100 (expires in 7.664 sec)
  Priority 105 (configured 105)
    Track object 1 state Up decrement 10
  Group name is "hsrp-Vl20-20" (default)

トラッキングのテスト

ESW1でテスト

ポートを落とす

int fa0/0
shut

確認

ESW1#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Vl10        10   95  P Standby 10.2.10.253     local           10.2.10.254
Vl20        20   100 P Standby 10.2.20.253     local           10.2.20.254
ESW1#show standby       
Vlan10 - Group 10
  State is Standby
    4 state changes, last state change 00:02:58
  Virtual IP address is 10.2.10.254
  Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.448 secs
  Preemption enabled
  Active router is 10.2.10.253, priority 100 (expires in 7.408 sec)
  Standby router is local
  Priority 95 (configured 105)
    Track object 1 state Down decrement 10
  Group name is "hsrp-Vl10-10" (default)
Vlan20 - Group 20
  State is Standby
    4 state changes, last state change 01:34:50
  Virtual IP address is 10.2.20.254
  Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.392 secs
  Preemption enabled
  Active router is 10.2.20.253, priority 105 (expires in 7.808 sec)
  Standby router is local
  Priority 100 (default 100)
  Group name is "hsrp-Vl20-20" (default)
ESW2#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Vl10        10   100 P Active  local           10.2.10.252     10.2.10.254
Vl20        20   105 P Active  local           10.2.20.252     10.2.20.254
ESW2#show standby       
Vlan10 - Group 10
  State is Active
    2 state changes, last state change 00:01:00
  Virtual IP address is 10.2.10.254
  Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.300 secs
  Preemption enabled
  Active router is local
  Standby router is 10.2.10.252, priority 95 (expires in 7.348 sec)
  Priority 100 (default 100)
  Group name is "hsrp-Vl10-10" (default)
Vlan20 - Group 20
  State is Active
    2 state changes, last state change 01:32:52
  Virtual IP address is 10.2.20.254
  Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.236 secs
  Preemption enabled
  Active router is local
  Standby router is 10.2.20.252, priority 100 (expires in 7.676 sec)
  Priority 105 (configured 105)
    Track object 1 state Up decrement 10
  Group name is "hsrp-Vl20-20" (default)

落としたインタフェースを戻す

int f0/0
no shut

確認

ESW1#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Vl10        10   105 P Active  local           10.2.10.253     10.2.10.254
Vl20        20   100 P Standby 10.2.20.253     local           10.2.20.254
ESW2#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Vl10        10   100 P Standby 10.2.10.252     local           10.2.10.254
Vl20        20   105 P Active  local           10.2.20.252     10.2.20.254

ESW2でテスト

ポートを落とす

int f0/0
shut

確認

ESW2#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Vl10        10   100 P Standby 10.2.10.252     local           10.2.10.254
Vl20        20   95  P Standby 10.2.20.252     local           10.2.20.254
ESW2#show standby 
Vlan10 - Group 10
  State is Standby
    4 state changes, last state change 00:02:23
  Virtual IP address is 10.2.10.254
  Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.776 secs
  Preemption enabled
  Active router is 10.2.10.252, priority 105 (expires in 9.756 sec)
  Standby router is local
  Priority 100 (default 100)
  Group name is "hsrp-Vl10-10" (default)
Vlan20 - Group 20
  State is Standby
    4 state changes, last state change 00:00:15
  Virtual IP address is 10.2.20.254
  Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.616 secs
  Preemption enabled
  Active router is 10.2.20.252, priority 100 (expires in 8.596 sec)
  Standby router is local
  Priority 95 (configured 105)
    Track object 1 state Down decrement 10
  Group name is "hsrp-Vl20-20" (default)
ESW1#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Vl10        10   105 P Active  local           10.2.10.253     10.2.10.254
Vl20        20   100 P Active  local           10.2.20.253     10.2.20.254
ESW1#show standby       
Vlan10 - Group 10
  State is Active
    5 state changes, last state change 00:03:05
  Virtual IP address is 10.2.10.254
  Active virtual MAC address is 0000.0c07.ac0a
    Local virtual MAC address is 0000.0c07.ac0a (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.436 secs
  Preemption enabled
  Active router is local
  Standby router is 10.2.10.253, priority 100 (expires in 8.480 sec)
  Priority 105 (configured 105)
    Track object 1 state Up decrement 10
  Group name is "hsrp-Vl10-10" (default)
Vlan20 - Group 20
  State is Active
    5 state changes, last state change 00:00:57
  Virtual IP address is 10.2.20.254
  Active virtual MAC address is 0000.0c07.ac14
    Local virtual MAC address is 0000.0c07.ac14 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.292 secs
  Preemption enabled
  Active router is local
  Standby router is 10.2.20.253, priority 95 (expires in 8.768 sec)
  Priority 100 (default 100)
  Group name is "hsrp-Vl20-20" (default)
ESW1#

落としたポートを戻す

int f0/0
no shut

確認

ESW2#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Vl10        10   100 P Standby 10.2.10.252     local           10.2.10.254
Vl20        20   105 P Active  local           10.2.20.252     10.2.20.254
ESW1#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Vl10        10   105 P Active  local           10.2.10.253     10.2.10.254
Vl20        20   100 P Standby 10.2.20.253     local           10.2.20.254
ESW1#

Linux bonding(Active-backup) 設定

debian1

bond-primary で設定したbond-primaryポートがActiveになる。

auto bond0
iface bond0 inet static
    address 10.2.10.1
    netmask 255.255.255.0
    network 10.2.10.0
    #gateway x.x.x.x
    bond-slaves ens3 ens4
    bond-primary ens3
    bond-mode active-backup
    bond-miimon 100
    bond-downdelay 200
    bond-updelay 200

auto bond1
iface bond1 inet static
    address 10.2.20.1
    netmask 255.255.255.0
    network 10.2.20.0
    #gateway x.x.x.x
    bond-slaves ens5 ens6
    bond-primary ens6
    bond-mode active-backup
    bond-miimon 100
    bond-downdelay 200
    bond-updelay 200

確認

# ip a show bond0
9: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 0c:08:3c:fe:00:00 brd ff:ff:ff:ff:ff:ff
    inet 10.2.10.1/24 brd 10.2.10.255 scope global bond0
       valid_lft forever preferred_lft forever
    inet6 fe80::e08:3cff:fefe:0/64 scope link 
       valid_lft forever preferred_lft forever

# ip a show bond1
10: bond1: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 0c:08:3c:fe:00:03 brd ff:ff:ff:ff:ff:ff
    inet 10.2.20.1/24 brd 10.2.20.255 scope global bond1
       valid_lft forever preferred_lft forever
    inet6 fe80::e08:3cff:fefe:3/64 scope link 
       valid_lft forever preferred_lft forever
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v6.1.0-37-amd64

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: ens3 (primary_reselect always)
Currently Active Slave: ens3
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200
Peer Notification Delay (ms): 0

Slave Interface: ens3
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 0c:08:3c:fe:00:00
Slave queue ID: 0

Slave Interface: ens4
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 0c:08:3c:fe:00:01
Slave queue ID: 0
# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v6.1.0-37-amd64

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: ens6 (primary_reselect always)
Currently Active Slave: ens6
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200
Peer Notification Delay (ms): 0

Slave Interface: ens5
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 0c:08:3c:fe:00:02
Slave queue ID: 0

Slave Interface: ens6
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 0c:08:3c:fe:00:03
Slave queue ID: 0

debian2 設定

こちらは bond-primary を指定しない。

auto bond0
iface bond0 inet static
    address 10.2.10.2
    netmask 255.255.255.0
    network 10.2.10.0
    #gateway x.x.x.x
    bond-slaves ens3 ens4
    #bond-primary ens4
    bond-mode active-backup
    bond-miimon 100
    bond-downdelay 200
    bond-updelay 200

auto bond1
iface bond1 inet static
    address 10.2.20.2
    netmask 255.255.255.0
    network 10.2.20.0
    #gateway x.x.x.x
    bond-slaves ens5 ens6
    #bond-primary ens5
    bond-mode active-backup
    bond-miimon 100
    bond-downdelay 200
    bond-updelay 200

確認

# ip a show bond0
7: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 0c:7a:98:b7:00:01 brd ff:ff:ff:ff:ff:ff
    inet 10.2.10.2/24 brd 10.2.10.255 scope global bond0
       valid_lft forever preferred_lft forever
    inet6 fe80::e7a:98ff:feb7:1/64 scope link 
       valid_lft forever preferred_lft forever

# ip a show bond1
8: bond1: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 0c:7a:98:b7:00:02 brd ff:ff:ff:ff:ff:ff
    inet 10.2.20.2/24 brd 10.2.20.255 scope global bond1
       valid_lft forever preferred_lft forever
    inet6 fe80::e7a:98ff:feb7:2/64 scope link 
       valid_lft forever preferred_lft forever
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v6.1.0-37-amd64

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens3
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200
Peer Notification Delay (ms): 0

Slave Interface: ens3
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 0c:7a:98:b7:00:00
Slave queue ID: 0

Slave Interface: ens4
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 0c:7a:98:b7:00:01
Slave queue ID: 0
# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v6.1.0-37-amd64

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens5
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200
Peer Notification Delay (ms): 0

Slave Interface: ens5
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 0c:7a:98:b7:00:02
Slave queue ID: 0

Slave Interface: ens6
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 0c:7a:98:b7:00:03
Slave queue ID: 0

Active-Standby 切り替え確認

debian1

bond0 の Activeのポートを確認

root@debian:~# cat /sys/class/net/bond0/bonding/active_slave
ens3

ケーブル抜去したときのログ

# journalctl -k -f

[173396.596674] bond0: (slave ens3): invalid new link 1 on slave
Jul 26 07:24:50 debian kernel: bond0: (slave ens3): link status down for active interface, disabling it in 200 ms
Jul 26 07:24:50 debian kernel: bond0: (slave ens3): invalid new link 1 on slave
Jul 26 07:24:50 debian kernel: bond0: (slave ens3): link status definitely down, disabling slave
Jul 26 07:24:50 debian kernel: bond0: (slave ens4): making interface the new active one

Activeポートが切り替わる

# cat /sys/class/net/bond0/bonding/active_slave
ens4

ケーブルを戻したときのログ

[173508.980611] bond0: (slave ens3): invalid new link 3 on slave
Jul 26 07:26:42 debian kernel: bond0: (slave ens3): link status up, enabling it in 200 ms
Jul 26 07:26:42 debian kernel: bond0: (slave ens3): invalid new link 3 on slave
Jul 26 07:26:42 debian kernel: bond0: (slave ens3): link status definitely up, 10000 Mbps full duplex
Jul 26 07:26:42 debian kernel: bond0: (slave ens3): making interface the new active one

自動で Activeポートが切りもどっている。

root@debian:~# cat /sys/class/net/bond0/bonding/active_slave
ens3

debian2

手作業でActiveを切り替える。

# cat /sys/class/net/bond0/bonding/active_slave
ens3

# echo ens4 > /sys/class/net/bond0/bonding/active_slave

# cat /sys/class/net/bond0/bonding/active_slave
ens4

ケーブル抜去したときのカーネルログ

[174042.973964] bond0: (slave ens4): invalid new link 1 on slave
Jul 26 07:39:08 debian kernel: bond0: (slave ens4): link status down for active interface, disabling it in 200 ms
Jul 26 07:39:08 debian kernel: bond0: (slave ens4): invalid new link 1 on slave
Jul 26 07:39:08 debian kernel: bond0: (slave ens4): link status definitely down, disabling slave
Jul 26 07:39:08 debian kernel: bond0: (slave ens3): making interface the new active one

アクティブポートは切り替わる。

# cat /sys/class/net/bond0/bonding/active_slave
ens3

ケーブルを戻したときのログ。

[174092.413153] bond0: (slave ens4): invalid new link 3 on slave
Jul 26 07:39:57 debian kernel: bond0: (slave ens4): link status up, enabling it in 200 ms
Jul 26 07:39:57 debian kernel: bond0: (slave ens4): invalid new link 3 on slave
Jul 26 07:39:58 debian kernel: bond0: (slave ens4): link status definitely up, 10000 Mbps full duplex

自動的に切り戻されないので、手動で切り替える。

# cat /sys/class/net/bond0/bonding/active_slave
ens3

# echo ens4 > /sys/class/net/bond0/bonding/active_slave

# cat /sys/class/net/bond0/bonding/active_slave
ens4

このときのカーネルログ

Jul 26 07:40:42 debian kernel: bond0: (slave ens4): making interface the new active one
GitHubで編集を提案

Discussion