!
Cấu hình cho ALS switch
en
conf t
hostname ALS
vlan 100
name VLAN100
exit
interface range fa0/1 - 10
switchport access vlan 100
switchport mode access
int g0/1
switchport mode trunk
int g0/2
switchport mode trunk
!Cấu hình cho router CoreRT1 (đã bỏ comment)
en
conf t
hostname CoreRT1
int g0/0
ip add [Link] [Link]
no shut
int g0/1
no shutdown
int g0/1.100
description VLAN 100
encapsulation dot1q 100
ip add [Link] [Link]
standby 1 ip [Link]
standby 1 priority 105
standby 1 track g0/0
standby 1 preempt
router ospf 1
network [Link] [Link] area 0
network [Link] [Link] area 0
!Cấu hình cho router CoreRT2
en
conf t
hostname CoreRT2
int g0/1
ip add [Link] [Link]
no shut
int g0/2
no shut
int g0/2.100
description VLAN 100
encapsulation dot1q 100
ip add [Link] [Link]
standby 1 ip [Link]
standby 1 priority 100
standby 1 track g0/1
standby 1 preempt
router ospf 1
network [Link] [Link] area 0
network [Link] [Link] area 0
! Cấu hình cho router ToISP
en
conf t
hostname ToISP
int g0/0
ip add [Link] [Link]
no shut
int g0/1
ip add [Link] [Link]
no shut
int g0/2
ip add [Link] [Link]
no shut
router ospf 1
network [Link] [Link] area 0
network [Link] [Link] area 0
network [Link] [Link] area 0
! Kiem tra:
- Trên PC0 đặt địa chỉ IP thuộc VLAN 100 là [Link]/24 với Default Gateway
là [Link]; kiểm tra thông mạng lên các core router bằng lệnh ping.
ping [Link]
ping [Link]
<<
C:\>ipconfig
FastEthernet0 Connection:(default port)
Connection-specific DNS Suffix..:
Link-local IPv6 Address.........: FE80::260:47FF:FE23:6AB0
IPv6 Address....................: ::
IPv4 Address....................: [Link]
Subnet Mask.....................: [Link]
Default Gateway.................: ::
[Link]
Bluetooth Connection:
Connection-specific DNS Suffix..:
Link-local IPv6 Address.........: ::
IPv6 Address....................: ::
IPv4 Address....................: [Link]
Subnet Mask.....................: [Link]
Default Gateway.................: ::
[Link]
C:\>ping [Link] -n 3
Pinging [Link] with 32 bytes of data:
Reply from [Link]: bytes=32 time<1ms TTL=255
Reply from [Link]: bytes=32 time=1ms TTL=255
Reply from [Link]: bytes=32 time=101ms TTL=255
Ping statistics for [Link]:
Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 101ms, Average = 34ms
C:\>ping [Link] -n 3
Pinging [Link] with 32 bytes of data:
Reply from [Link]: bytes=32 time<1ms TTL=255
Reply from [Link]: bytes=32 time=1ms TTL=255
Reply from [Link]: bytes=32 time<1ms TTL=255
Ping statistics for [Link]:
Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
>>
- Đặt địa chỉ IP & Default Gateway cho server SRV như hình vẽ;
<<
C:\>ipconfig
FastEthernet0 Connection:(default port)
Connection-specific DNS Suffix..:
Link-local IPv6 Address.........: FE80::201:C9FF:FEC7:58E
IPv6 Address....................: ::
IPv4 Address....................: [Link]
Subnet Mask.....................: [Link]
Default Gateway.................: ::
[Link]
>>
- Từ các router CoreRT1, CoreRT2 ping lên máy chủ SRV để kiểm tra thông mạng.
<<
CoreRT1#ping [Link]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to [Link], timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/1 ms
CoreRT1#ping [Link]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to [Link], timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms
>>
<<
CoreRT2#ping [Link]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to [Link], timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms
CoreRT2#ping [Link]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to [Link], timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms
>>
<<
ToISP#ping [Link]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to [Link], timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/2 ms
ToISP#ping [Link]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to [Link], timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms
>>
- Kiểm tra thông mạng từ PC0 đến Virtual IP [Link]; ping và trace
route đến SRV.
<<
C:\>ping [Link] -n 4
Pinging [Link] with 32 bytes of data:
Reply from [Link]: bytes=32 time<1ms TTL=126
Reply from [Link]: bytes=32 time=1ms TTL=126
Reply from [Link]: bytes=32 time=1ms TTL=126
Reply from [Link]: bytes=32 time<1ms TTL=126
Ping statistics for [Link]:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
C:\>tracert [Link]
Tracing route to [Link] over a maximum of 30 hops:
1 0 ms 0 ms 0 ms [Link]
2 0 ms 0 ms 0 ms [Link]
3 0 ms 0 ms 0 ms [Link]
Trace complete.
=> Để đến được đích [Link] (SRV), gói tin đã đi qua hai thiết bị định tuyến
chính:
Router 1 (Default Gateway): Địa chỉ [Link] - CoreRT1. (Đây là Router đầu
tiên mà gói tin chạm tới).
Router 2 (Next Hop): Địa chỉ [Link] - ToISP. (Đây là Router chịu trách nhiệm
chuyển tiếp gói tin từ mạng nội bộ ra mạng ngoài).
Cụ thể, gói tin rời khỏi mạng LAN của bạn thông qua Router có địa chỉ IP
[Link].
CoreRT1 -> ToISP
>>
<<
C:\>ping [Link] -n 3
Pinging [Link] with 32 bytes of data:
Reply from [Link]: bytes=32 time<1ms TTL=255
Reply from [Link]: bytes=32 time=1ms TTL=255
Reply from [Link]: bytes=32 time<1ms TTL=255
Ping statistics for [Link]:
Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
>>
- Dùng lệnh show standby trên CoreRT1 và CoreRT2 để xem trạng thái của các cổng
được cấu hình HSRP: CoreRT1 sẽ là active; CoreRT2 là sandby router.
<<
CoreRT1#show standby
GigabitEthernet0/1.100 - Group 1
State is Active
10 state changes, last state change [Link]
Virtual IP address is [Link]
Active virtual MAC address is 0000.0C07.AC01
Local virtual MAC address is 0000.0C07.AC01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.043 secs
Preemption enabled
Active router is local
Standby router is [Link], priority 100 (expires in 8 sec)
Priority 105 (configured 105)
Track interface GigabitEthernet0/0 state Up decrement 10
Group name is hsrp-Gig-1 (default)
CoreRT2#show standby
GigabitEthernet0/2.100 - Group 1
State is Standby
9 state changes, last state change [Link]
Virtual IP address is [Link]
Active virtual MAC address is 0000.0C07.AC01
Local virtual MAC address is 0000.0C07.AC01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.091 secs
Preemption enabled
Active router is [Link], priority 105 (expires in 8 sec)
MAC address is 0000.0C07.AC01
Standby router is local
Priority 100 (default 100)
Track interface GigabitEthernet0/1 state Up decrement 10
Group name is hsrp-Gig-1 (default)
>>
- Trên router CoreRT1 tắt cổng G0/0 để thấy được tác dụng của HSRP:
chuyển sang dùng CoreRT2 đối với VLAN 100
int g0/0
<<
CoreRT1(config)#int g0/0
CoreRT1(config-if)#shutdown
CoreRT1(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to administratively
down
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state
to down
[Link] %OSPF-5-ADJCHG: Process 1, Nbr [Link] on GigabitEthernet0/0 from
FULL to DOWN, Neighbor Down: Interface down or detached
CoreRT1(config-if)#exit
CoreRT1(config)#do show standby
GigabitEthernet0/1.100 - Group 1
State is Speak
13 state changes, last state change [Link]
Virtual IP address is [Link]
Active virtual MAC address is 0000.0C07.AC01
Local virtual MAC address is 0000.0C07.AC01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.40703e+11 secs
Preemption enabled
Active router is [Link]
Standby router is [Link]
Priority 95 (configured 105)
Track interface GigabitEthernet0/0 state Down decrement 10
Group name is hsrp-Gig-1 (default)
CoreRT1(config)#do show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Gig 1 95 P Standby [Link] local [Link]
- Tại PC0 thực hiện lại tracert [Link] và xem lộ trình đi đến SRV lúc
này.
C:\>tracert [Link]
Tracing route to [Link] over a maximum of 30 hops:
1 0 ms 0 ms 1 ms [Link]
2 1 ms 4294967295 ms0 ms [Link]
3 0 ms 0 ms 1 ms [Link]
Trace complete.
=> Đường đi của gói tin đi qua 3 bước nhảy (hop) sau:
Hop 1 (Gateway): [Link] - CoreRT2.
Hop 2 (Router Trung gian): [Link] - ToISP.
Hop 3 (Đích): [Link] (Server/SRV).
- Tại CoreRT1: bật lại cổng G0/0 (no shutdown) thì ta sẽ thấy rằng VLAN 100 bây
giờ lại dùng CoreRT1 là đường active.
CoreRT1(config)#int g0/0
CoreRT1(config-if)#no shut
CoreRT1(config-if)#exit
CoreRT1(config)#do show standby
GigabitEthernet0/1.100 - Group 1
State is Active
16 state changes, last state change [Link]
Virtual IP address is [Link]
Active virtual MAC address is 0000.0C07.AC01
Local virtual MAC address is 0000.0C07.AC01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.145 secs
Preemption enabled
Active router is local
Standby router is [Link], priority 100 (expires in 0 sec)
Priority 105 (configured 105)
Track interface GigabitEthernet0/0 state Up decrement 10
Group name is hsrp-Gig-1 (default)
>>
Het!