/*auto readmore*/ /*auto readmore*/ /* an hien script*/ // an hien password /*an hien ma chuong trinh cong tru */ /*Scrollbox thanh cuon*/ /***Nhung CODE***/ /* dòng xanh dòng trắng */ /* https://cdnjs.com/libraries/prism lay thu vien, can vao ten file ma goi 1. copy link vao vi du:prism-python.min.js 2. ten ngon nua la python */ /*=== New posts ===*/ /*header slider*/ /*=== bai viet lien quan===*/ /*===tabcode===*/

Cisco, Configure IP SLA Tracking and Path Control


Mô hình ta có 2 đường internet, mặt định mọi kết nối ra internet của lớp mạng 192.168.1.0/24 phải thông qua R2 là đường chính, và sử dụng tính năng IP SLA để theo dõi/giám sát xem nếu không thể kết nối đến DNS của R2 thì chuyển hướng kết nối internet thông qua R3.

Các kiến thức dùng trong bài lab: Default route, Static, EIGRP, IP SLA, Track
Yêu cầu:
1. Đấu dây và đặt IP như hình, cấu hình:
  • R1: cấu hình default route (AD=5) trỏ về R2 đảm bảo có ping tới Web server và DNS của IPS1, ISP2
  • R2, R3: 
+ Cấu hình EIGRP 100 ( không quảng bá loopback 0: 209.165.200.254) 
+ Cấu hình Static route đến lớp mạng 192.168.1.0 về R1 


Gợi ý cấu hình:
!R1
!
interface Loopback0
 description ===LAN===
 ip address 192.168.1.1 255.255.255.0
end
!
interface Ethernet0/2
 description ===Connect to R2===
 ip address 209.165.201.2 255.255.255.252
end
!
interface Ethernet0/3
 description ===Connect to R3===
 ip address 209.165.202.130 255.255.255.252
end
!
ip route 0.0.0.0 0.0.0.0 209.165.201.1 5

!R2
!
interface Loopback0
 description ===Gia lap Web server===
 ip address 209.165.200.254 255.255.255.255
end
!
interface Loopback1
 description ===DNS===
 ip address 209.165.201.30 255.255.255.255
end
!
interface Ethernet0/2
 description ===Connect to R1===
 ip address 209.165.201.1 255.255.255.252
end
!
interface Ethernet0/0
 description ===Connect to R3===
 ip address 209.165.200.225 255.255.255.252
end
!
router eigrp 100
 network 209.165.200.224 0.0.0.3
 network 209.165.201.0 0.0.0.31
 no auto-summary
!
ip route 192.168.1.0 255.255.255.0 209.165.201.2

!R3
!
interface Loopback0
 description ===Gia lap Web server===
 ip address 209.165.200.254 255.255.255.255
end
!
interface Loopback1
 description ===DNS===
 ip address 209.165.202.158 255.255.255.255
end
!
interface Ethernet0/3
 description ===Connect to R1===
 ip address 209.165.202.129 255.255.255.252
end
!
interface Ethernet0/0
 description ===Connect to R2===
 ip address 209.165.200.226 255.255.255.252
end
!
router eigrp 100
 network 209.165.200.224 0.0.0.3
 network 209.165.202.128 0.0.0.31
no auto-summary
!
ip route 192.168.1.0 255.255.255.0 209.165.202.130

!kiểm tra
!R1
R1#show interfaces description 
Interface                      Status         Protocol Description
Et0/0                          admin down     down     
Et0/1                          admin down     down     
Et0/2                          up             up       ===Connect to R2===
Et0/3                          up             up       ===Connect to R3===
Lo0                            up             up       ===LAN===
R1#show  ip route
đã xóa 1 số dòng
Gateway of last resort is 209.165.201.1 to network 0.0.0.0
S*    0.0.0.0/0 [5/0] via 209.165.201.1
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, Loopback0
L        192.168.1.1/32 is directly connected, Loopback0
      209.165.201.0/24 is variably subnetted, 2 subnets, 2 masks
C        209.165.201.0/30 is directly connected, Ethernet0/2
L        209.165.201.2/32 is directly connected, Ethernet0/2
      209.165.202.0/24 is variably subnetted, 2 subnets, 2 masks
C        209.165.202.128/30 is directly connected, Ethernet0/3
L        209.165.202.130/32 is directly connected, Ethernet0/3

R1#traceroute 209.165.201.30 
Type escape sequence to abort.
Tracing the route to 209.165.201.30
VRF info: (vrf in name/id, vrf out name/id)
  1 209.165.201.1 0 msec 1 msec * 

R1#traceroute 209.165.200.254
Type escape sequence to abort.
Tracing the route to 209.165.200.254
VRF info: (vrf in name/id, vrf out name/id)
  1 209.165.201.1 1 msec 1 msec * 

R1#traceroute 209.165.202.158
Type escape sequence to abort.
Tracing the route to 209.165.202.158
VRF info: (vrf in name/id, vrf out name/id)
  1 209.165.201.1 0 msec 1 msec 1 msec
  2 209.165.200.226 1 msec 1 msec * 


R2#show ip route
đã xóa 1 số dòng
Gateway of last resort is not set
S     192.168.1.0/24 [1/0] via 209.165.201.2
      209.165.200.0/24 is variably subnetted, 3 subnets, 2 masks
C        209.165.200.224/30 is directly connected, Ethernet0/0
L        209.165.200.225/32 is directly connected, Ethernet0/0
C        209.165.200.254/32 is directly connected, Loopback0
      209.165.201.0/24 is variably subnetted, 3 subnets, 2 masks
C        209.165.201.0/30 is directly connected, Ethernet0/2
L        209.165.201.1/32 is directly connected, Ethernet0/2
C        209.165.201.30/32 is directly connected, Loopback1
      209.165.202.0/24 is variably subnetted, 2 subnets, 2 masks
D        209.165.202.128/30 
           [90/307200] via 209.165.200.226, 02:46:36, Ethernet0/0
D        209.165.202.158/32 
           [90/409600] via 209.165.200.226, 02:46:36, Ethernet0/0

!R3
R3#show ip route
đã xóa 1 số dòng
Gateway of last resort is not set
S     192.168.1.0/24 [1/0] via 209.165.202.130
      209.165.200.0/24 is variably subnetted, 3 subnets, 2 masks
C        209.165.200.224/30 is directly connected, Ethernet0/0
L        209.165.200.226/32 is directly connected, Ethernet0/0
C        209.165.200.254/32 is directly connected, Loopback0
      209.165.201.0/24 is variably subnetted, 2 subnets, 2 masks
D        209.165.201.0/30 
           [90/307200] via 209.165.200.225, 02:48:13, Ethernet0/0
D        209.165.201.30/32 
           [90/409600] via 209.165.200.225, 02:48:13, Ethernet0/0
      209.165.202.0/24 is variably subnetted, 3 subnets, 2 masks
C        209.165.202.128/30 is directly connected, Ethernet0/3
L        209.165.202.129/32 is directly connected, Ethernet0/3
C        209.165.202.158/32 is directly connected, Loopback1

2. Cấu hình IP SLA probes (Service Level Agreement) trên R1:

  •  Kiểm tra đến DNS của R2

! cứ 10 giây ping 209.165.201.30 1 lần, sau 2 lần thất bại track chuyển trạng thái sang down, thời gian sống của ip sla là mãi mãi và có hiệu lực ngay lập tức
!R1
ip sla 12 icmp-echo 209.165.201.30
 threshold 2
 frequency 10
exit
!
ip sla schedule 12 life forever start-time now
!
R1#show ip sla configuration 12
IP SLAs Infrastructure Engine-III
Entry number: 12
Owner: 
Tag: 
Operation timeout (milliseconds): 5000
Type of operation to perform: icmp-echo
Target address/Source address: 209.165.201.30/0.0.0.0
Type Of Service parameter: 0x0
Request size (ARR data portion): 28
Verify data: No
Vrf Name: 
Schedule:
   Operation frequency (seconds): 10  (not considered if randomly scheduled)
   Next Scheduled Start Time: Start Time already passed
   Group Scheduled : FALSE
   Randomly Scheduled : FALSE
   Life (seconds): Forever
   Entry Ageout (seconds): never
   Recurring (Starting Everyday): FALSE
   Status of entry (SNMP RowStatus): Active
Threshold (milliseconds): 2
Distribution Statistics:

!
R1#show ip sla statistics 
IPSLAs Latest Operation Statistics
IPSLA operation id: 12
        Latest RTT: 1 milliseconds
Latest operation start time: 07:56:45 EET Tue Jul 9 2019
Latest operation return code: OK
Number of successes: 51
Number of failures: 0
Operation time to live: Forever


  • Kiểm tra đến DNS của R3:

!
ip sla 13 icmp-echo 209.165.202.158
 threshold 2
 frequency 10
exit
ip sla schedule 13 life forever start-time now

R1#show ip sla configuration 13
IP SLAs Infrastructure Engine-III
Entry number: 13
Owner: 
Tag: 
Operation timeout (milliseconds): 5000
Type of operation to perform: icmp-echo
Target address/Source address: 209.165.202.158/0.0.0.0
Type Of Service parameter: 0x0
Request size (ARR data portion): 28
Verify data: No
Vrf Name: 
Schedule:
   Operation frequency (seconds): 10  (not considered if randomly scheduled)
   Next Scheduled Start Time: Start Time already passed
   Group Scheduled : FALSE
   Randomly Scheduled : FALSE
   Life (seconds): Forever
   Entry Ageout (seconds): never
   Recurring (Starting Everyday): FALSE
   Status of entry (SNMP RowStatus): Active
Threshold (milliseconds): 2

Distribution Statistics:

R1#show ip sla statistics 
IPSLA operation id: 13
        Latest RTT: 1 milliseconds
Latest operation start time: 08:06:06 EET Tue Jul 9 2019
Latest operation return code: OK
Number of successes: 16
Number of failures: 0

Operation time to live: Forever

  • Tạo cấu hình track 1 để thực thi giám sát cho sla 12
!
track 1 ip sla 12 reachability
delay down 10 up 1

  • Enable debug ip routing, gán track 1 vào cấu hình floating static route (AD = 2 để nhỏ hơn AD = 5 ban đầu) trỏ về R2
!R1
debug ip routing
IP routing debugging is on


!
ip route 0.0.0.0 0.0.0.0 209.165.201.1 2 track 1
!

*Jul  9 06:28:02.179: RT: closer admin distance for 0.0.0.0, flushing 1 routes
*Jul  9 06:28:02.179: RT: add 0.0.0.0/0 via 209.165.201.1, static metric [2/0]
*Jul  9 06:28:02.179: RT: updating static 0.0.0.0/0 (0x0): via 209.165.201.1  
  • Tạo cấu hình track 2 để thực thi giám sát cho sla 13, gán track 2 vào cấu hình floating static route (AD = 3, R3 chạy dự phòng cho R2) trỏ về R3
!
track 2 ip sla 13 reachability
delay down 10 up 1
!
ip route 0.0.0.0 0.0.0.0 209.165.202.129 3 track 2

  • Kiểm tra lại bảng route R1 sau khi cấu hình track
!
R1#show run | section ip route
ip route 0.0.0.0 0.0.0.0 209.165.201.1 2 track 1
ip route 0.0.0.0 0.0.0.0 209.165.202.129 3 track 2
ip route 0.0.0.0 0.0.0.0 209.165.201.1 5

R1#show ip route 
Gateway of last resort is 209.165.201.1 to network 0.0.0.0

S*    0.0.0.0/0 [2/0] via 209.165.201.1
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, Loopback0
L        192.168.1.1/32 is directly connected, Loopback0
      209.165.201.0/24 is variably subnetted, 2 subnets, 2 masks
C        209.165.201.0/30 is directly connected, Ethernet0/2
L        209.165.201.2/32 is directly connected, Ethernet0/2
      209.165.202.0/24 is variably subnetted, 2 subnets, 2 masks
C        209.165.202.128/30 is directly connected, Ethernet0/3

L        209.165.202.130/32 is directly connected, Ethernet0/3

* Nhận xét: chúng ta cấu hình 3 dòng route, nhưng dòng route có AD = 2 sẽ đưa vào bảng routing vì hiện tại AD = 2 là nhỏ nhất

3. Kiểm tra hoạt động của IP SLA
  • Disable interface loopback 1 của R2
!R2
interface loopback 1
shutdown
!
R2(config-if)#
*Jul  9 06:59:51.330: %LINK-5-CHANGED: Interface Loopback1, changed state to administratively down
*Jul  9 06:59:52.338: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to down
!
!R1

R1#

*Jul  9 07:54:59.863: %TRACKING-5-STATE: 1 ip sla 12 reachability Up->Down

*Jul  9 07:54:59.863: RT: del 0.0.0.0 via 209.165.201.1, static metric [2/0]

*Jul  9 07:54:59.863: RT: delete network route to 0.0.0.0/0

*Jul  9 07:54:59.863: RT: default path has been cleared

*Jul  9 07:54:59.863: RT: updating static 0.0.0.0/0 (0x0): via 209.165.202.129  

*Jul  9 07:54:59.864: RT: add 0.0.0.0/0 via 209.165.202.129, static metric [3/0]

*Jul  9 07:54:59.864: RT: default path is now 0.0.0.0 via 209.165.202.129

*Jul  9 07:54:59.864: RT: updating static 0.0.0.0/0 (0x0): via 209.165.201.1  

!Kiểm tra track
R1#show track
Track 1
  IP SLA 12 reachability
  Reachability is Down
    4 changes, last change 00:03:25
  Delay up 1 sec, down 10 secs
  Latest operation return code: Timeout
  Tracked by:
    STATIC-IP-ROUTING 0
Track 2
  IP SLA 13 reachability
  Reachability is Up
    1 change, last change 00:30:41
  Delay up 1 sec, down 10 secs
  Latest operation return code: OK
  Latest RTT (millisecs) 1
  Tracked by:
    STATIC-IP-ROUTING 0

! Kiểm tra bảng routing
R1#show ip route 
đã xóa 1 số dòng
Gateway of last resort is 209.165.202.129 to network 0.0.0.0
S*    0.0.0.0/0 [3/0] via 209.165.202.129
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, Loopback0
L        192.168.1.1/32 is directly connected, Loopback0
      209.165.201.0/24 is variably subnetted, 2 subnets, 2 masks
C        209.165.201.0/30 is directly connected, Ethernet0/2
L        209.165.201.2/32 is directly connected, Ethernet0/2
      209.165.202.0/24 is variably subnetted, 2 subnets, 2 masks
C        209.165.202.128/30 is directly connected, Ethernet0/3
L        209.165.202.130/32 is directly connected, Ethernet0/3

!Kiểm tra IP SLA 
R1#show ip sla statistics 
IPSLAs Latest Operation Statistics
IPSLA operation id: 12
        Latest RTT: NoConnection/Busy/Timeout
Latest operation start time: 10:02:35 EET Tue Jul 9 2019
Latest operation return code: Timeout
Number of successes: 38
Number of failures: 48
Operation time to live: Forever

IPSLA operation id: 13
        Latest RTT: 1 milliseconds
Latest operation start time: 10:02:36 EET Tue Jul 9 2019
Latest operation return code: OK
Number of successes: 354
Number of failures: 0
Operation time to live: Forever

! Tracert đến web server
R1#traceroute 209.165.200.254 source 192.168.1.1
Type escape sequence to abort.
Tracing the route to 209.165.200.254
VRF info: (vrf in name/id, vrf out name/id)
  1 209.165.202.129 0 msec 1 msec * 

!R2: enable interface loopback 1 trên R2 quan sát trên R1

R1#
*Jul  9 08:07:26.410: %TRACKING-5-STATE: 1 ip sla 12 reachability Down->Up
R1#
*Jul  9 08:07:26.410: RT: updating static 0.0.0.0/0 (0x0): via 209.165.201.1  
*Jul  9 08:07:26.410: RT: closer admin distance for 0.0.0.0, flushing 1 routes
*Jul  9 08:07:26.410: RT: add 0.0.0.0/0 via 209.165.201.1, static metric [2/0]
*Jul  9 08:07:26.410: RT: updating static 0.0.0.0/0 (0x0): via 209.165.202.129  
*Jul  9 08:07:26.410: RT: rib update return code: 17
*Jul  9 08:07:26.410: RT: updating static 0.0.0.0/0 (0x0): via 209.165.202.129  
*Jul  9 08:07:26.410: RT: rib update return code: 17
*Jul  9 08:07:26.410: RT: updating static 0.0.0.0/0 (0x0): via 209.165.201.1  
*Jul  9 08:07:26.410: RT: rib update return code: 17

!
R1#show  ip sla statistics 
IPSLAs Latest Operation Statistics
IPSLA operation id: 12
        Latest RTT: 1 milliseconds
Latest operation start time: 10:24:45 EET Tue Jul 9 2019
Latest operation return code: OK
Number of successes: 143
Number of failures: 76
Operation time to live: Forever

IPSLA operation id: 13
        Latest RTT: 1 milliseconds
Latest operation start time: 10:24:46 EET Tue Jul 9 2019
Latest operation return code: OK
Number of successes: 128
Number of failures: 0

R1#show ip route 
đã xóa 1 số dòng
Gateway of last resort is 209.165.201.1 to network 0.0.0.0
S*    0.0.0.0/0 [2/0] via 209.165.201.1
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, Loopback0
L        192.168.1.1/32 is directly connected, Loopback0
      209.165.201.0/24 is variably subnetted, 2 subnets, 2 masks
C        209.165.201.0/30 is directly connected, Ethernet0/2
L        209.165.201.2/32 is directly connected, Ethernet0/2
      209.165.202.0/24 is variably subnetted, 2 subnets, 2 masks
C        209.165.202.128/30 is directly connected, Ethernet0/3
L        209.165.202.130/32 is directly connected, Ethernet0/3


Kết luận: Để kiểm tra có thể liên kết được IP ở đầu chúng ta dùng IP SLA,  kết hợp track ip sla và route để điều chỉnh thông tin bảng định tuyến. Gồm các bước cơ bản như dưới:




Ví dụ mẫu áp dụng cho default route có AD
ip sla 12 icmp-echo <ip cần kiểm tra>
threshold 2
frequency 10
exit
!
ip sla schedule 12 life forever start-time now
!
track 1 ip sla 12 reachability
!
ip route 0.0.0.0 0.0.0.0 <default gateway> 2  track 1



xong!


No comments:

Post a Comment

/*header slide*/