L2Switch - yusukew62/docs GitHub Wiki
L2Switch
1.基本設定
1-1.管理アクセス共通設定
BBルータのLAN設定
「LAN側MDI/MDI-Xモード」を自動設定にしておく
PR500KIの場合) 詳細設定->高度な設定->LAN側MDI/MDI-Xモードを自動設定
ホスト名
Switch(config)#hostname SW1
管理用IPアドレス
SW1(config)#int vlan 1
SW1(config-if)#ip address 192.168.1.80 255.255.255.0
SW1(config-if)#no shutdown
デフォルトゲートウェイ
SW1(config)#ip default-gateway 192.168.1.1
二重モードと速度の設定
SW1(config-if)#speed auto
SW1(config-if)#duplex auto
Auto MDI/MDIXの設定
SW1(config-if)#mdix auto
リモート接続設定
SW1(config)#line vty 0 4
SW1(config-line)#password password
SW1(config-line)#login
MacOSXのターミナルからtelnet接続確認
$ telnet 192.168.1.80
2.スタティックVLANの設定
vlan 10(Dev)とvlan 99(NativeVLAN用)を作成
SW1(config)#vlan 10,99
LAN名の設定(オプション)
SW1(config)#vlan 10
SW1(config-vlan)#name Dev
アクセスポートの設定(オプション)
SW1(config)#int fa 0/1
SW1(config-if)#switchport mode access
スイッチポートにVLANを割り当てる(VLANメンバーシップ)
SW1(config-if)#switchport access vlan 10
3.トランクポートの設定
トランクポートの設定
SW1(config)#int fa 0/2
SW1(config-if)#switchport mode trunk
DTPの無効化(オプション)
SW1(config-if)#switchport nonegotiate
ネイティブVLANの設定
SW1(config-if)#switchport trunk native vlan 99
トランクポートの設定確認
SW1#show int trunk
3.ACL
3-1.番号付き標準ACL
送信元IPアドレスのみ指定できる
3-1-1.番号付き標準ACLの作成
例として、拒否したいIPアドレスを登録するブラックリストとして作成
172.16.20.1を拒否
暗黙の「deny any」への対策として全てのパケットを許可
RT1(config)#access-list 1 deny 172.16.20.1 0.0.0.0
RT1(config)#access-list 1 permit any
3-1-2.インタフェースへのACL適用
RT1(config)#int fa 0.10
RT1(config-subif)#ip access-group 1 out
3-1-3.設定の確認
RT1#show access-lists 1
3-1-3.PCでの動作確認
1.access-listに設定したIPで疎通できないことを確認(172.16.20.1)
2.IPアドレスを変更(172.16.20.2)
3.疎通できることを確認
3-2.番号付き拡張ACL
宛先/送信元IPアドレス、ポート、プロトコルごとに設定できる
3-2-1.番号付き拡張ACLの作成
例として、許可したいIPアドレスを登録するホワイトリストとして作成
172.16.20.1を許可
RT1(config)#access-list 100 deny icmp 172.16.20.1 0.0.0.0 host 172.16.10.1
3-2-2.インタフェースへのACL適用
RT1(config)#int fa 0.10
RT1(config-subif)#ip access-group 100 out
3-2-3.PCでの動作確認
1.access-listに設定したIPで疎通できることを確認(172.16.20.1)
2.IPアドレスを変更(172.16.20.2)
3.疎通できないことを確認
3-3.名前付き標準ACL
3-3-1.名前付き標準ACLの作成
例として、拒否したいIPアドレスを登録するブラックリストとして作成
Private-Blockという名前付き標準ACLを作成
送信元IPアドレスが172.16.20.1のものを拒否
それ以外のIPアドレスを許可
RT1(config)#ip access-list standard Private-Block
RT1(config-std-nacl)#deny 172.16.20.1 0.0.0.0
RT1(config-std-nacl)#permit 0.0.0.0 255.255.255.255
3-3-2.インタフェースへのACL適用
RT1(config)#int fa 0.10
RT1(config-subif)#ip access-group Private-Block out
3-3-3.PCでの動作確認
1.access-listに設定したIPで疎通できないことを確認(172.16.20.1)
2.IPアドレスを変更(172.16.20.2)
3.疎通できることを確認
3-4.名前付き拡張ACL
3-4-1.名前付き拡張ACLの作成
例として、許可したいIPアドレスを登録するホワイトリストとして作成
INSIDE-Blockという名前付き標準ACLを作成
送信元IPアドレスが172.16.20.1のものを許可
それ以外のIPアドレスを拒否
RT1(config)#ip access-list extended INSIDE-Block
RT1(config-ext-nacl)#permit icmp 172.16.20.1 0.0.0.0 host 172.16.10.1
3-4-2.インタフェースへのACL適用
RT1(config)#int fa 0.10
RT1(config-subif)#ip access-group INSIDE-Block out
3-4-3.PCでの動作確認
1.access-listに設定したIPで疎通できることを確認(172.16.20.1)
2.IPアドレスを変更(172.16.20.2)
3.疎通できないことを確認
4.スイッチの設定
スタティックMACアドレスの登録/削除
スタティックMACアドレスの登録
MACアドレスはダミーで登録時間(YYYY.mmdd.HHMM)とした
SW1(config)#mac-address-table static 2017.0320.1750 vlan 2 int fa 0/3
スタティックMACアドレスが登録されたことを確認
SW1#show mac-address-table static
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
All 000f.8f5e.8c00 STATIC CPU
All 0100.0ccc.cccc STATIC CPU
All 0100.0ccc.cccd STATIC CPU
All 0100.0cdd.dddd STATIC CPU
2 2017.0320.1750 STATIC Fa0/3
Total Mac Addresses for this criterion: 5
スタティックMACアドレスの削除
SW1(config)#no mac-address-table static 2017.0320.1750 vlan 2 int fa 0/3
削除されたことを確認
SW1#show mac-address-table static
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
All 000f.8f5e.8c00 STATIC CPU
All 0100.0ccc.cccc STATIC CPU
All 0100.0ccc.cccd STATIC CPU
All 0100.0cdd.dddd STATIC CPU
Total Mac Addresses for this criterion: 4
5.セキュリティ
5-1.違反フレームの受信
最大数のセキュアMACアドレスを超過したフレームを違反フレームとする
下記では最大数を1に設定し、ダミーMACアドレスをスタティック登録、ping
SW1(config)#int gi 0/1
SW1(config-if)#switchport port-security maximum 1
SW1(config)#switchport port-security mac-address fa:16:3e:54:56:00
SW1(config-if)#switchport port-security
Gi0/1のセキュアMACの最大登録数が1であることを確認、超過時のアクションでデフォルトのShutdown
SW1#show port-security
Secure Port MaxSecureAddr CurrentAddr SecurityViolation Security Action
(Count) (Count) (Count)
---------------------------------------------------------------------------
Gi0/1 1 1 0 Shutdown
---------------------------------------------------------------------------
Total Addresses in System (excluding one mac per port) : 0
Max Addresses limit in System (excluding one mac per port) : 4096
ダミーMACアドレスが登録されていることを確認
SW1#show port-security address
Secure Mac Address Table
-----------------------------------------------------------------------------
Vlan Mac Address Type Ports Remaining Age
(mins)
---- ----------- ---- ----- -------------
2 fa16.3e54.5600 SecureConfigured Gi0/1 -
-----------------------------------------------------------------------------
Total Addresses in System (excluding one mac per port) : 0
Max Addresses limit in System (excluding one mac per port) : 4096
Port Securityが有効なことを確認
SW1#show port-security int gi 0/1
Port Security : Enabled
Port Status : Secure-up
Violation Mode : Shutdown
Aging Time : 0 mins
Aging Type : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses : 1
Total MAC Addresses : 1
Configured MAC Addresses : 1
Sticky MAC Addresses : 0
Last Source Address:Vlan : 0000.0000.0000:0
Security Violation Count : 0
Gi0/1を別ホストからpingで通過させるとPort Securityで遮断される
cisco@server-1:~$ ping 10.0.128.2
PING 10.0.128.2 (10.0.128.2) 56(84) bytes of data.
From 10.0.0.2 icmp_seq=1 Destination Host Unreachable
Gi0/1が err-disabledになっていることを確認
SW1#show int status
Port Name Status Vlan Duplex Speed Type
Gi0/0 OOB management connected routed a-full auto RJ45
Gi0/1 to unmanagedswitch err-disabled 2 auto auto RJ45
Gi0/2 to iosv-1 connected 2 a-full auto RJ45
err-disabledからの復旧
SW1(config)#int gi 0/1
SW1(config-if)#shutdown
SW1(config-if)#no shutdown
SW1#show int status
Port Name Status Vlan Duplex Speed Type
Gi0/0 OOB management connected routed a-full auto RJ45
Gi0/1 to unmanagedswitch connected 2 a-full auto RJ45
Gi0/2 to iosv-1 connected 2 a-full auto RJ45
5-2.セキュアMACアドレスを別のポートで使用
あるセキュアポートで登録されているセキュアMACアドレスが、同じVLANのセキュアポートで送信元MACアドレスのフレームとして受信するとセキュリティ違反
Gi0/1をセキュアポートに設定
SW1(config)#int gi 0/1
SW1(config-if)#switchport port-security
Gi0/2をセキュアポートに設定し、Gi0/1と接続しているホストのMACアドレスをスタティック登録
SW1(config)#int gi 0/2
SW1(config-if)#switchport port-security maximum 10
SW1(config-if)#switchport port-security mac-address fa:16:3e:54:56:69
各インタフェースが有効なことを確認
SW1#show int status
Port Name Status Vlan Duplex Speed Type
Gi0/0 OOB management connected routed a-full auto RJ45
Gi0/1 to unmanagedswitch connected 2 a-full auto RJ45
Gi0/2 to iosv-1 connected 2 a-full auto RJ45
登録されているセキュアMACアドレスを確認
SW1#show port-security address
Secure Mac Address Table
-----------------------------------------------------------------------------
Vlan Mac Address Type Ports Remaining Age
(mins)
---- ----------- ---- ----- -------------
2 fa16.3e54.5669 SecureConfigured Gi0/2 -
2 fa16.3e55.dee5 SecureDynamic Gi0/2 -
-----------------------------------------------------------------------------
Total Addresses in System (excluding one mac per port) : 1
Max Addresses limit in System (excluding one mac per port) : 4096
Gi0/1のホストからpingを通過させるとPort Securityで遮断される
cisco@server-1:~$ ping 10.0.128.2
PING 10.0.128.2 (10.0.128.2) 56(84) bytes of data.
From 10.0.0.2 icmp_seq=1 Destination Host Unreachable
Gi0/1がerr-disabledになっていることを確認
SW1#show int status
Port Name Status Vlan Duplex Speed Type
Gi0/0 OOB management connected routed a-full auto RJ45
Gi0/1 to unmanagedswitch err-disabled 2 auto auto RJ45
Gi0/2 to iosv-1 connected 2 a-full auto RJ45
6.復旧
イメージ破損からの復旧方法
- イメージの破損や消失からの Catalyst 固定構成スイッチの回復
- Catalyst Switch - Password Recovery
- Catalyst 2940 Image File
- Loading an IOS on a switch via Xmodem
7.STP
7-1.STPの設定確認
SW1#show run | inc span
spanning-tree mode pvst
spanning-tree extend system-id
SW1-SW2-SW3-SW1のループ構成を作成しSTPのFWDとBLKを確認する
SW1はFWDのみ
SW1#show span vlan 1 | inc Gi
Gi0/1 Desg FWD 4 128.2 P2p
Gi0/2 Desg FWD 4 128.3 P2p
SW2はFWDのみ
SW2#show span vlan 1 | inc Gi
Gi0/1 Root FWD 4 128.2 P2p
Gi0/2 Desg FWD 4 128.3 P2p
SW3はBLKを含む
SW3#show span vlan 1 | inc Gi
Gi0/1 Altn BLK 4 128.2 P2p
Gi0/2 Root FWD 4 128.3 P2p
ルートブリッジの情報確認
SW1#show span root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 32769 5e00.0000.0000 0 2 20 15
VLAN0010 32778 5e00.0000.0000 0 2 20 15
VLAN0020 32788 5e00.0000.0000 0 2 20 15
STPの詳細を確認
SW1#show span vlan 1
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 5e00.0000.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 5e00.0000.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1 Desg FWD 4 128.2 P2p
Gi0/2 Desg FWD 4 128.3 P2p
7-2.スタティックなルートブリッジの設定
SW2のvlan10を4096に設定
SW2(config)#spanning-tree vlan 10 priority 4096
SW1#show span root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 32769 5e00.0000.0000 0 2 20 15
VLAN0010 4106 5e00.0001.0000 4 2 20 15 Gi0/1
VLAN0020 32788 5e00.0000.0000 0 2 20 15
7-3.ダイナミックなルートブリッジの設定
プライマリのみ設定
SW3のvlan10をプライマリのルートブリッジに設定
SW3(config)#spanning-tree vlan 10 root primary
SW3のvlan10のプライオリティが24586へ上がった
SW3#show span vlan 10
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address 5e00.0002.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24586 (priority 24576 sys-id-ext 10)
Address 5e00.0002.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1 Desg FWD 4 128.2 P2p
Gi0/2 Desg FWD 4 128.3 P2p
SW1で確認するとSW3がルートブリッジになっている
SW1#show span root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 32769 5e00.0000.0000 0 2 20 15
VLAN0010 24586 5e00.0002.0000 4 2 20 15 Gi0/2
VLAN0020 32788 5e00.0000.0000 0 2 20 15
プライマリとセカンダリの設定
SW2をルート・プライマリへ設定
SW2(config)#span vlan 10 root primary
SW3をルート・セカンダリへ設定
SW3(config)#span vlan 10 root secondary
ルートブリッジの確認
SW1#show span root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port
---------------- -------------------- --------- ----- --- --- ------------
VLAN0001 32769 5e00.0000.0000 0 2 20 15
VLAN0010 24586 5e00.0001.0000 4 2 20 15 Gi0/1
VLAN0020 32788 5e00.0000.0000 0 2 20 15
SW2はルートブリッジ、ブリッジIDのプライオリティは24586となっている
SW2#show span vlan 10
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address 5e00.0001.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24586 (priority 24576 sys-id-ext 10)
Address 5e00.0001.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 15 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1 Desg FWD 4 128.2 P2p
Gi0/2 Desg FWD 4 128.3 P2p
ブリッジIDは28682になっている
show span vlan 10
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address 5e00.0001.0000
Cost 4
Port 2 (GigabitEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 28682 (priority 28672 sys-id-ext 10)
Address 5e00.0002.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 15 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1 Root FWD 4 128.2 P2p
Gi0/2 Desg FWD 4 128.3 P2p
ルートのSW2を落下させるとSW3がルートに切り替わる
(SW2をreload実行)
SW3#show span vlan 10
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address 5e00.0001.0000
Cost 4
Port 2 (GigabitEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 28682 (priority 28672 sys-id-ext 10)
Address 5e00.0002.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 15 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1 Root FWD 4 128.2 P2p
Gi0/2 Desg FWD 4 128.3 P2p
(SW2がリロードされ、SW3がルートになる)
SW3#show span vlan 10
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 28682
Address 5e00.0002.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 28682 (priority 28672 sys-id-ext 10)
Address 5e00.0002.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 15 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1 Desg FWD 4 128.2 P2p
Gi0/2 Desg FWD 4 128.3 P2p
(SW2が復活しSW2がルート、SW3がセカンダリに戻る)
SW3#show span vlan 10
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address 5e00.0001.0000
Cost 4
Port 2 (GigabitEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 28682 (priority 28672 sys-id-ext 10)
Address 5e00.0002.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 15 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1 Root FWD 4 128.2 P2p
Gi0/2 Desg FWD 4 128.3 P2p
8.PortFast/BPDUガード
8-1.PortFastの設定
SW1のアクセスポートにPortFastを設定
SW1(config-if)#spanning-tree portfast
Spanning-TreeでPortFastのデフォルトが有効になっていることを確認
SW1#show span summary | inc Portfast Default
Portfast Default is edge
Spanning-TreeのType部分に"Edge"が表示されるようになる
SW1#show span vlan 10
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 32778
Address 5e00.0003.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 5e00.0003.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1 Desg FWD 4 128.2 P2p
Gi0/2 Desg FWD 4 128.3 P2p Edge
Gi0/3 Desg FWD 4 128.4 P2p
8-2.BPDUガードの設定
すべてのPortFastでBPDUガードを有効化
SW1(config)#spanning-tree portfast edge bpduguard
BPDUガードの有効化の確認
SW1#show span summary | inc BPDU Guard
Portfast Edge BPDU Guard Default is enabled
9.RSTP
以下の構成はServer1とServer2はSW1に結線、SW1はSW2とSW3と結線、SW2とSW3はそれぞれ結線
RSTP/PortFastの有効化
RSTPを有効化
SW1(config)#spanning-tree mode rapid-pvst
アクセスポートに対してはPostFastを有効化
SW1(config-if-range)#spanning-tree portfast
vlan作成とプライオリティの設定
SW2とSW3はそれぞれvlan10を作成
SW2(config)#vlan 10
SW2はvlan1と10のプライオリティをスタティックで4096に設定
SW2(config)#spanning-tree mode rapid-pvst
SW2(config)#spanning-tree vlan 1,10 priority 4096
SW3もvlan1と10のプライオリティをスタティックで8192に設定
SW3(config)#spanning-tree mode rapid-pvst
SW3(config)#spanning-tree vlan 1,10 priority 8192
RSTPの確認
RSTPに設定されていることを確認
SW2#show span vlan 10 summary | inc pvst
Switch is in rapid-pvst mode
PVST Simulation Default is enabled but inactive in rapid-pvst mode
10.EtherChannel
10-1.EtherChannelなしの場合
SW1とSW2を4本で結線するとSTPでSW2の1本がルートポート(FWD)、3本が非指定ポート(BLK)になる
SW1のSTP
SW1#show span vlan 1
(割愛)
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1 Desg FWD 4 128.2 P2p
Gi0/2 Desg FWD 4 128.3 P2p
Gi0/3 Desg FWD 4 128.4 P2p
Gi1/0 Desg FWD 4 128.5 P2p
SW2のSTP
SW2#show span vlan 1
(割愛)
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1 Root FWD 4 128.2 P2p
Gi0/2 Altn BLK 4 128.3 P2p
Gi0/3 Altn BLK 4 128.4 P2p
Gi1/0 Altn BLK 4 128.5 P2p
10-2.EtherChannelの設定(スタティック)
ポートチャネル1の設定
SW1のGi0/1-2でチャネルグループを組み、ポートチャネル1とする
SW1(config)#int range gi 0/1-2
SW1(config-if-range)#channel-group 1 mode on
Creating a port-channel interface Port-channel 1
SW1(config-if-range)#exit
ポートチャネル1をtrunkポートとして設定、vlanは1,2,10,20を許可する
SW1(config)#int port-channel 1
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk allowed vlan 1
ポートチャネル2の設定
SW1のGi0/3,Gi1/0でチャネルグループを組み、ポートチャネル2とする
SW1(config)#int range gi 0/3, gi 1/0
SW1(config-if-range)#channel-group 2 mode desirable
Creating a port-channel interface Port-channel 2
SW1(config-if-range)#exit
ポートチャネル2もtrunkポートとして設定し、vlan1,2,10,20を許可する
SW1(config)#int port-channel 2
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk allowed vlan 1
インタフェースの確認
ポートチャネル1と2が作成されていることを確認
SW1#show int status
Port Name Status Vlan Duplex Speed Type
Gi0/0 OOB management connected routed a-full auto RJ45
Gi0/1 to iosvl2-2 connected trunk a-full auto RJ45
Gi0/2 to iosvl2-2 connected trunk a-full auto RJ45
Gi0/3 to iosvl2-3 connected trunk a-full auto RJ45
Gi1/0 to iosvl2-3 connected trunk a-full auto RJ45
Po1 connected trunk a-full auto
Po2 connected trunk a-full auto
チャネルグループの確認
チャネルグループのサマリ確認
SW1#show etherchannel summary
Flags: D - down P - bundled in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use N - not in use, no aggregation
f - failed to allocate aggregator
M - not in use, minimum links not met
m - not in use, port not aggregated due to minimum links not met
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
A - formed by Auto LAG
Number of channel-groups in use: 2
Number of aggregators: 2
Group Port-channel Protocol Ports
------+-------------+-----------+-----------------------------------------------
1 Po1(SU) - Gi0/1(P) Gi0/2(P)
2 Po2(SU) PAgP Gi0/3(P) Gi1/0(P)
チャネルグループの確認
SW1#show etherchannel
Channel-group listing:
----------------------
Group: 1
----------
Group state = L2
Ports: 2 Maxports = 4
Port-channels: 1 Max Port-channels = 1
Protocol: -
Minimum Links: 0
Group: 2
----------
Group state = L2
Ports: 2 Maxports = 4
Port-channels: 1 Max Port-channels = 1
Protocol: PAgP
Minimum Links: 0
ポートチャネルの確認
ポートチャネル1のサマリ確認
SW1#show int port-channel 1 summary
*: interface is up
IHQ: pkts in input hold queue IQD: pkts dropped from input queue
OHQ: pkts in output hold queue OQD: pkts dropped from output queue
RXBS: rx rate (bits/sec) RXPS: rx rate (pkts/sec)
TXBS: tx rate (bits/sec) TXPS: tx rate (pkts/sec)
TRTL: throttle count
Interface IHQ IQD OHQ OQD RXBS RXPS TXBS TXPS TRTL
-----------------------------------------------------------------------------------------------------------------
* Port-channel1 0 0 0 0 0 0 0 0 0
ポートチャネル1の確認
SW1#show int port-channel 1
Port-channel1 is up, line protocol is up (connected)
Hardware is EtherChannel, address is fa16.3e49.afd4 (bia fa16.3e49.afd4)
MTU 1500 bytes, BW 2000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, Auto-speed, media type is RJ45
input flow-control is off, output flow-control is unsupported
Members in this channel: Gi0/1 Gi0/2
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:03:52, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/2000/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
454 packets input, 26110 bytes, 0 no buffer
Received 0 broadcasts (0 multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 input packets with dribble condition detected
1064 packets output, 65864 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out
STPの確認
STPの確認
SW1#show span vlan 1
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 5e00.0000.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 5e00.0000.0000
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Po1 Desg FWD 3 128.65 P2p
Po2 Desg FWD 3 128.66 P2p
10.HSRP
RT1とRT2でHSRPでデフォルトルートの冗長化をする
HSRPの設定
RT1のIPアドレス設定
RT1(config)#int gi 0/1
RT1(config-if)#ip address 192.168.1.100 255.255.255.0
RT1(config)#int gi 0/2
RT1(config-if)#ip address 192.168.2.100 255.255.255.0
RT1のHSRPの設定
RT1(config)#int gi 0/1
RT1(config-if)#standby 10 ip 192.168.1.254
RT1(config-if)#standby 10 priority 200
*Feb 18 22:52:17.474: %HSRP-5-STATECHANGE: GigabitEthernet0/1 Grp 10 state Standby -> Active
RT1(config-if)#standby 10 preempt
RT2のIPアドレスの設定
RT2(config)#int gi 0/1
RT2(config-if)#ip address 192.168.1.200 255.255.255.0
RT2(config)#int gi 0/2
RT2(config-if)#ip address 192.168.2.200 255.255.255.0
RT2のHSRPの設定
RT2(config)#int gi 0/1
RT2(config-if)#standby 10 ip 192.168.1.254
*Feb 18 22:53:11.343: %HSRP-5-STATECHANGE: GigabitEthernet0/1 Grp 10 state Speak -> Standby
設定の確認
RT1のHSRPの確認
RT1#show standby bri
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Gi0/1 10 200 P Active local 192.168.1.200 192.168.1.254
RT2のHSRPの確認
RT2#show standby bri
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Gi0/1 10 100 Standby 192.168.1.100 local 192.168.1.254
RT1のHSRPの詳細確認
RT1#show standby
GigabitEthernet0/1 - Group 10
State is Active
6 state changes, last state change 00:04:37
Virtual IP address is 192.168.1.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.760 secs
Preemption enabled
Active router is local
Standby router is 192.168.1.200, priority 100 (expires in 9.632 sec)
Priority 200 (configured 200)
Group name is "hsrp-Gi0/1-10" (default)
RT2の詳細確認
RT2#show standby
GigabitEthernet0/1 - Group 10
State is Standby
7 state changes, last state change 00:05:13
Virtual IP address is 192.168.1.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.144 secs
Preemption disabled
Active router is 192.168.1.100, priority 200 (expires in 10.160 sec)
Standby router is local
Priority 100 (default 100)
Group name is "hsrp-Gi0/1-10" (default)
動作確認(RT1のIF停止)
RT1のIFをshutdownすると、RT2がアクティブになる
RT1(config)#int gi 0/1
RT1(config-if)#shutdown
*Feb 18 23:08:53.556: %HSRP-5-STATECHANGE: GigabitEthernet0/1 Grp 10 state Active -> Init
*Feb 18 23:08:55.528: %LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to administratively down
*Feb 18 23:08:56.100: %SYS-5-CONFIG_I: Configured from console by console
*Feb 18 23:08:56.528: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down
RT2がStandbyからActiveになったことがわかる
RT2#
*Feb 18 23:08:52.903: %HSRP-5-STATECHANGE: GigabitEthernet0/1 Grp 10 state Standby -> Active
動作確認(RT1の停止後の戻し)
RT1の停止させたIFを上げる
RT1(config)#int gi 0/1
RT1(config-if)#no shutdown
*Feb 18 23:09:54.920: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to up
*Feb 18 23:09:55.920: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
*Feb 18 23:09:57.872: %SYS-5-CONFIG_I: Configured from console by console
*Feb 18 23:09:57.937: %HSRP-5-STATECHANGE: GigabitEthernet0/1 Grp 10 state Listen -> Active
RT2がActiveからStandbyへ戻る
RT2#
*Feb 18 23:09:57.249: %HSRP-5-STATECHANGE: GigabitEthernet0/1 Grp 10 state Active -> Speak
RT2#
*Feb 18 23:10:07.604: %HSRP-5-STATECHANGE: GigabitEthernet0/1 Grp 10 state Speak -> Standby
トラブルシュート
デバッグモードでHSRPのパケット確認
RT1ルータ側
RT1#debug stand
HSRP debugging is on
RT1#
*Feb 18 23:46:10.712: HSRP: Gi0/1 Grp 10 Hello in 192.168.1.200 Standby pri 100 vIP 192.168.1.254
*Feb 18 23:46:11.038: HSRP: Gi0/1 Grp 10 Hello out 192.168.1.100 Active pri 200 vIP 192.168.1.254
RT1#
*Feb 18 23:46:13.608: HSRP: Gi0/1 Grp 10 Hello in 192.168.1.200 Standby pri 100 vIP 192.168.1.254
*Feb 18 23:46:13.926: HSRP: Gi0/1 Grp 10 Hello out 192.168.1.100 Active pri 200 vIP 192.168.1.254
*Feb 18 23:46:14.088: HSRP: Gi0/1 Interface adv in, Passive, active 0, passive 1, from 192.168.1.200
RT1#
*Feb 18 23:46:16.469: HSRP: Gi0/1 Grp 10 Hello in 192.168.1.200 Standby pri 100 vIP 192.168.1.254
*Feb 18 23:46:16.735: HSRP: Gi0/1 Grp 10 Hello out 192.168.1.100 Active pri 200 vIP 192.168.1.254
RT2ルータ側
RT2#debug stand
HSRP debugging is on
RT2#
*Feb 18 23:46:08.589: HSRP: Gi0/1 Grp 10 Hello out 192.168.1.200 Standby pri 100 vIP 192.168.1.254
*Feb 18 23:46:08.923: HSRP: Gi0/1 Grp 10 Hello in 192.168.1.100 Active pri 200 vIP 192.168.1.254
RT2#
*Feb 18 23:46:11.508: HSRP: Gi0/1 Grp 10 Hello out 192.168.1.200 Standby pri 100 vIP 192.168.1.254
*Feb 18 23:46:11.832: HSRP: Gi0/1 Grp 10 Hello in 192.168.1.100 Active pri 200 vIP 192.168.1.254
*Feb 18 23:46:11.988: HSRP: Gi0/1 Interface adv out, Passive, active 0 passive 1
RT2#
*Feb 18 23:46:14.363: HSRP: Gi0/1 Grp 10 Hello out 192.168.1.200 Standby pri 100 vIP 192.168.1.254
*Feb 18 23:46:14.636: HSRP: Gi0/1 Grp 10 Hello in 192.168.1.100 Active pri 200 vIP 192.168.1.254
RT2#
認証(オプション)
RT1に認証を設定
RT1(config-if)#standby 10 authentication test
RT2側には認証がないため認証エラーが起きる
RT2#
*Feb 18 23:54:27.727: %HSRP-4-BADAUTH: Bad authentication from 192.168.1.100, group 10, remote state Active
*Feb 18 23:54:46.313: %HSRP-5-STATECHANGE: GigabitEthernet0/1 Grp 10 state Active -> Speak
RT2#show standby bri
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Gi0/1 10 100 Speak 192.168.1.100 unknown 192.168.1.254
RT2で認証を設定すると再びStandby状態に戻る
RT2(config-if)#standby 10 authentication test
*Feb 19 00:04:10.896: %HSRP-5-STATECHANGE: GigabitEthernet0/1 Grp 10 state Speak -> Standby
RT2#show standby bri
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Gi0/1 10 100 Standby 192.168.1.100 local 192.168.1.254