/*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===*/
Showing posts with label Static Route. Show all posts
Showing posts with label Static Route. Show all posts

Static Route, Floating Static Routes/Dự Phòng Đường Đi Với Static Route


Sơ đồ Bài Lab:

Mô tả: Thực hiện việc cấu hình đường đi dự phòng với Static Route dựa vào Administrative Distance

Kiến thức sử dụng trong bài: Static Route, Default Route, OSPF

Yêu cầu:
1. Thực hiện đấu nối và cấu hình IP theo sơ đồ

2. Trên R1, thực cấu hình 2 default route, ưu tiên 1: trỏ về R2-IP 192.168.12.2; ưu tiên 2: trỏ về R3-IP 192.168.13.3 với AD =254

3. Chạy OSPF trên cả 3 router đảm bảo mạng hội tụ

4. Trên R1 cấu hình floating static route để dự phòng đường đi đến loopback của R2 và R3 khi OSPF lỗi quảng bá loopback cho router láng giềng

Thực hiện:
1. Thực hiện đấu nối và cấu hình IP theo sơ đồ

R1:
interface Ethernet0/0
 ip address 192.168.1.1 255.255.255.0
no shutdown
exit
!
interface Ethernet0/2
 ip address 192.168.12.1 255.255.255.0
no shutdown
exit
!
interface Ethernet0/3
 ip address 192.168.13.1 255.255.255.0
no shutdown
end
write

R2:
interface Ethernet0/2
 ip address 192.168.12.2 255.255.255.0
no shutdown
exit
!
interface Loopback2
ip address 2.2.2.2 255.255.255.255
end
write

R3:
interface Ethernet0/3
ip address 192.168.13.3 255.255.255.0
no shutdown
exit
!
interface Loopback3
 ip address 3.3.3.3 255.255.255.255
end
write

2. Trên R1, thực cấu hình 2 default route, ưu tiên 1: trỏ về R2-IP 192.168.12.2; ưu tiên 2: trỏ về R3-IP 192.168.13.3 với AD =254
R1:
ip route 0.0.0.0 0.0.0.0 192.168.12.2
ip route 0.0.0.0 0.0.0.0 192.168.13.3 254

Kiểm tra:
R1#show ip route
{...}
Gateway of last resort is 192.168.12.2 to network 0.0.0.0
S*    0.0.0.0/0 [1/0] via 192.168.12.2
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, Ethernet0/0
L        192.168.1.1/32 is directly connected, Ethernet0/0
      192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.12.0/24 is directly connected, Ethernet0/2
L        192.168.12.1/32 is directly connected, Ethernet0/2
      192.168.13.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.13.0/24 is directly connected, Ethernet0/3
L        192.168.13.1/32 is directly connected, Ethernet0/3

Default route đang trỏ về IP 192.168.12.2 của R2 với AD = 1 (khi cấu hình ip route mà không gõ giá trị AD thì mặt định router sẽ cho AD =1). Việc cấu hình có thêm chỉ số AD như vậy gọi là floating static route

Kiểm tra hoạt động của Floating Static route
R1:
debug ip routing

Shutdown cổng Et0/2 trên R1 để kiểm tra
R1:
interface Et0/1
shutdown
*Apr 22 06:49:26.423: is_up: Ethernet0/2 0 state: 6 sub state: 1 line: 1
*Apr 22 06:49:26.423: RT: interface Ethernet0/2 removed from routing table
*Apr 22 06:49:26.423: RT: del 192.168.12.0 via 0.0.0.0, connected metric [0/0]
*Apr 22 06:49:26.423: RT: delete subnet route to 192.168.12.0/24
*Apr 22 06:49:26.423: RT: del 192.168.12.1 via 0.0.0.0, connected metric [0/0]
*Apr 22 06:49:26.423: RT: delete subnet route to 192.168.12.1/32
*Apr 22 06:49:26.424: RT: del 0.0.0.0 via 192.168.12.2, static metric [1/0]
*Apr 22 06:49:26.424: RT: delete network route to 0.0.0.0/0
*Apr 22 06:49:26.424: RT: default path has been cleared
*Apr 22 06:49:26.424: RT: updating static 0.0.0.0/0 (0x0)  :
   via 192.168.13.3   0
*Apr 22 06:49:26.424: RT: add 0.0.0.0/0 via 192.168.13.3, static metric [254/0]
*Apr 22 06:49:26.424: RT: default path is now 0.0.0.0 via 192.168.13.3
{...}

Hướng đi đến R2 đã bị xóa ra khỏi bảng route và R1 sẽ tự động thêm vào bảng route hướng đi của default bây giờ là thông qua R3 - IP 192.168.13.3 với AD = 254

R1#show ip route
{...}
Gateway of last resort is 192.168.13.3 to network 0.0.0.0
S*    0.0.0.0/0 [254/0] via 192.168.13.3
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, Ethernet0/0
L        192.168.1.1/32 is directly connected, Ethernet0/0
      192.168.13.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.13.0/24 is directly connected, Ethernet0/3
L        192.168.13.1/32 is directly connected, Ethernet0/3

Ping test trên R1:
R1#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

R1 có thể ping thành công được Lo2 của R2

R1#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
U.U.U
Success rate is 0 percent (0/5)

R1 không thể ping đến được Lo3 của R3 vì mọi route mà R1 không biết mặt định nó sẽ hỏi R2 mà R2 lại không biết đường đi đến địa chỉ 3.3.3.3 nên kết quả trả về U.U.U (nếu trên windows thì chúng ta sẽ gặp thông báo destination host unreachable). Để giải quyết vấn đền này chúng cần chạy 1 giao thức route bất kỳ  trên cả 3 router để quảng bá các loopback cho router láng giềng.

3. Chạy OSPF trên cả 3 router đảm bảo mạng hội tụ.
R1
router ospf 1
exit
interface range Et0/0, Et0/2-3
ip ospf 1 area 0

R2
router ospf 1
exit
interface range Et0/2,lo2
ip ospf 1 area 0

R3
router ospf 1
exit
interface range Et0/3,Lo3
ip ospf 1 area 0

Host> ping 2.2.2.2
84 bytes from 2.2.2.2 icmp_seq=1 ttl=254 time=0.668 ms
84 bytes from 2.2.2.2 icmp_seq=2 ttl=254 time=0.746 ms
84 bytes from 2.2.2.2 icmp_seq=3 ttl=254 time=0.681 ms
84 bytes from 2.2.2.2 icmp_seq=4 ttl=254 time=0.657 ms
84 bytes from 2.2.2.2 icmp_seq=5 ttl=254 time=0.627 ms
Host> ping 3.3.3.3
84 bytes from 3.3.3.3 icmp_seq=1 ttl=254 time=0.586 ms
84 bytes from 3.3.3.3 icmp_seq=2 ttl=254 time=0.507 ms
84 bytes from 3.3.3.3 icmp_seq=3 ttl=254 time=0.497 ms
84 bytes from 3.3.3.3 icmp_seq=4 ttl=254 time=0.519 ms
84 bytes from 3.3.3.3 icmp_seq=5 ttl=254 time=0.559 ms

Host đã ping đến được các loopback của R2, R3.

4. Trên R1 cấu hình floating static route để dự phòng đường đi đến loopback của R2 và R3 khi OSPF lỗi quảng bá loopback cho router láng giềng

Kiểm tra trước khi cấu hình
R1:
R1#show ip route 2.2.2.2
Routing entry for 2.2.2.2/32
  Known via "ospf 1", distance 110, metric 11, type intra area
  Last update from 192.168.12.2 on Ethernet0/2, 00:00:04 ago
  Routing Descriptor Blocks:
  * 192.168.12.2, from 2.2.2.2, 00:00:04 ago, via Ethernet0/2
      Route metric is 11, traffic share count is 1

Ta thấy hiện tại R1 route đến 2.2.2.2 bằng giao thức OSPF với Distance 110.
Vậy để static route backup cho OSPF chúng ta sẽ điều chỉnh AD của static route lớn hơn Distance của OSPF (mặt định là 110)

 R1:
ip route 2.2.2.2 255.255.255.255 192.168.12.2 111

Bật debug trên R1 để xem log quá trình cập nhật bảng route
debug ip routing

R2
int lo2
no ip ospf 1 area 0

Không quảng bá loopback vào OSPF (nhằm mục đích test việc câp nhật bảng routing trên R1)

R1#
*Apr 22 08:10:28.344: RT: del 2.2.2.2 via 192.168.12.2, ospf metric [110/11]
*Apr 22 08:10:28.344: RT: delete subnet route to 2.2.2.2/32
*Apr 22 08:10:28.345: RT: updating static 2.2.2.2/32 (0x0)  :
    via 192.168.12.2   0
*Apr 22 08:10:28.345: RT: add 2.2.2.2/32 via 192.168.12.2, static metric [111/0]

Route 2.2.2.2 học được từ OSPF đã bị xóa và thay vào đó là route đến Lo2 của R2 học được từ static route với AD = 111
R1#show ip route 2.2.2.2
outing entry for 2.2.2.2/32
  Known via "static", distance 111, metric 0
  Routing Descriptor Blocks:
  * 192.168.12.2
      Route metric is 0, traffic share count is 1

Tương tự các bạn tự thực hiện với R3 nhé!

Xong!

Bài 4: MPLS Layer 3 VPN PE_CE Static_OSPF

Giới thiệu:

đang cập nhật ...

Sơ đồ lab:




Yêu cầu:

1. Cấu hình MPLS Layer 3 VPN core

2. Kiểm tra các kết nối đảm bảo:
   - R1A, R1B có thể ping đến R2 và ngược lại
   - R6A, R6B có thể ping đến R5 và ngược lại
   - Loopback 0 của R2 và R5 có thể giao tiếp được với nhau

3. Cấu hình route giữa các router CE và PE:

  • Static route: Customer_A (R1A và R2; R6A và R5) đảm bảo loopback 0 của R1A và R6A có thể giao tiếp được với nhau.
  • OSPF area 0: Customer_B (R1B và R2; R6B và R5) đảm bảo loopback 0 của R1B và R6B có thể giao tiếp được với nhau.


Các kiến thức sử dụng trong bài: Static route, OSPF, Redistribute, MPLS, VRF, BGP


Cấu hình:

1. Cấu hình MPLS Layer 3 VPN core (thừa kế bài 3, tham khảo tại đây)


2. Kiểm tra các kết nối đảm bảo:

- R1A, R1B có thể ping đến R2 và ngược lại

R1A#ping 192.168.12.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R1B#ping 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/6 ms

R2#ping vrf Customer_A 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R2#ping vrf Customer_B 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms

- R6A, R6B có thể ping đến R5 và ngược lại

R6A#ping 192.168.56.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.56.5, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms
R6B#ping 192.168.56.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.56.5, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms

R5#ping vrf Customer_A 192.168.56.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.56.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R5#ping vrf Customer_B 192.168.56.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.56.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

- Loopback 0 của R2 và R5 có thể giao tiếp được với nhau

R2#ping 5.5.5.5 source 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

R5#ping 2.2.2.2 source 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 5.5.5.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

3. Cấu hình route giữa các router CE và PE:

- Static route: Customer_A (R1A và R2; R6A và R5) đảm bảo loopback 0 của R1A và R6A có thể giao tiếp được với nhau.


  • Cấu hình Static route:

R1A:
ip route 6.6.6.0 255.255.255.0 192.168.12.2

R2:
ip route vrf Customer_A 1.1.1.0 255.255.255.0 192.168.12.1

R5:
ip route vrf Customer_A 6.6.6.0 255.255.255.0 192.168.56.6

R6A:
ip route 1.1.1.0 255.255.255.0 192.168.56.5

  • Kiểm tra:
R1A#show ip route static 
(...)
Gateway of last resort is not set
      6.0.0.0/24 is subnetted, 1 subnets
S        6.6.6.0 [1/0] via 192.168.12.2


R6A#show ip route static 
(...)
Gateway of last resort is not set
      1.0.0.0/24 is subnetted, 1 subnets
S        1.1.1.0 [1/0] via 192.168.56.5

Router CE của Customer_A đã biết đường đến loopback 0 của nhau thông qua các router PE (R2, R5)


R2#show ip route vrf Customer_A 6.6.6.6
Routing Table: Customer_A
% Network not in table
R5#show ip route vrf Customer_A 1.1.1.1
Routing Table: Customer_A
% Network not in table

Tuy nhiên:
     - R2 không biết đường đi đến loopback 0 của R6A
     - R5 không biết đường đi đến loopback 0 của R1A

Để giải quyết vấn đề này ta phải redistribute các route static vào BGP, thông qua MP-BGP các router PE 2 bên sẽ học được route của các router CE.
  • Cấu hình:
R2, R5:
router bgp 2345
address-family ipv4 vrf Customer_A
redistribute static
do write
  • Kiểm tra:

R2#show ip route vrf Customer_A 6.6.6.6
Routing Table: Customer_A
Routing entry for 6.6.6.0/24
  Known via "bgp 2345", distance 200, metric 0, type internal
  Last update from 5.5.5.5 00:01:06 ago
  Routing Descriptor Blocks:
  * 5.5.5.5 (default), from 5.5.5.5, 00:01:06 ago
      Route metric is 0, traffic share count is 1
      AS Hops 0
      MPLS label: 21
      MPLS Flags: MPLS Required

R5#show ip route vrf Customer_A 1.1.1.1
Routing Table: Customer_A
Routing entry for 1.1.1.0/24
  Known via "bgp 2345", distance 200, metric 0, type internal
  Last update from 2.2.2.2 00:01:16 ago
  Routing Descriptor Blocks:
  * 2.2.2.2 (default), from 2.2.2.2, 00:01:16 ago
      Route metric is 0, traffic share count is 1
      AS Hops 0
      MPLS label: 21
      MPLS Flags: MPLS Required


R2#show ip bgp vpnv4 vrf Customer_A
BGP table version is 6, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
     Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 16:16 (default for vrf Customer_A)
 *>  1.1.1.0/24       192.168.12.1             0         32768 ?
 *>i 6.6.6.0/24       5.5.5.5                  0    100      0 ?

R5#show ip bgp vpnv4 vrf Customer_A
BGP table version is 7, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
     Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 16:16 (default for vrf Customer_A)
 *>i 1.1.1.0/24       2.2.2.2                  0    100      0 ?
 *>  6.6.6.0/24       192.168.56.6             0         32768 ?

Vậy là các PE router đã học các route static từ đầu bên kia redistribute vào và dùng lable 21 để forward gói tin

R1A#ping 6.6.6.6 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

R6A#ping 1.1.1.1 source 6.6.6.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 6.6.6.6
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

Loopback 0 của R1A và R6A đã giao tiếp được với nhau và cụ thể là dùng lable 21 để forward gói tin.


Phân tích kết quả bắt gói (dùng wireshark) trên các  router PE ta thấy lúc này MPLS có đến 2 nhãn (đại khái là 1 nhãn tránh blackhole, 1 nhãn cho vpnv4. Tìm đọc bài Quá trình trao đổi nhãn)


- OSPF area 0: Customer_B (R1B và R2; R6B và R5) đảm bảo loopback 0 của R1B và R6B có thể giao tiếp được với nhau.

  • Cấu hình:
Cấu hình ospf
Vì đã có ospf 1 chạy cho vùng MPLS core rồi nên ta dùng proccess 16 trong trường hợp này

R1B, R6B:
router ospf 16
exit
interface range ethernet 0/2, loopback 0
ip ospf 16 area 0
do write


R2:
router ospf 16 vrf Customer_B
network 192.168.12.2 0.0.0.0 area 0

R5:
router ospf 16 vrf Customer_B
network 192.168.56.5 0.0.0.0 area 0


Redistribute ospf vào MP-BGP để các PE (R2, R5) học được route của router CE (trong trường hợp này là học loopback 0 của R1B và R6B)

R2, R5:

router bgp 2345
address-family ipv4 vrf Customer_B
redistribute ospf 16


  • Kiểm tra:

R2# show ip route  vrf Customer_B ospf
(...)
      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/11] via 192.168.12.1, 00:32:09, Ethernet0/1
R2# show ip route  vrf Customer_B 6.6.6.6
Routing Table: Customer_B
Routing entry for 6.6.6.6/32
  Known via "bgp 2345", distance 200, metric 11, type internal
  Last update from 5.5.5.5 00:12:18 ago
  Routing Descriptor Blocks:
  * 5.5.5.5 (default), from 5.5.5.5, 00:12:18 ago
      Route metric is 11, traffic share count is 1
      AS Hops 0
      MPLS label: 22
      MPLS Flags: MPLS Required
R2#show ip bgp vpnv4 vrf Customer_B
BGP table version is 12, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
     Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 11:66 (default for vrf Customer_B)
 *>  1.1.1.1/32       192.168.12.1            11         32768 ?
 *>i 6.6.6.6/32       5.5.5.5                 11    100      0 ?
 *>  192.168.12.0     0.0.0.0                  0         32768 ?
 *>i 192.168.56.0     5.5.5.5                  0    100      0 ?

Có thể dùng lệnh show bgp vpnv4 unicast vrf Customer_B

R5#show ip route vrf Customer_B ospf
(...)
Gateway of last resort is not set
      6.0.0.0/32 is subnetted, 1 subnets
O        6.6.6.6 [110/11] via 192.168.56.6, 00:39:28, Ethernet0/1
R5#show ip route vrf Customer_B 1.1.1.1
Routing Table: Customer_B
Routing entry for 1.1.1.1/32
  Known via "bgp 2345", distance 200, metric 11, type internal
  Last update from 2.2.2.2 00:20:20 ago
  Routing Descriptor Blocks:
  * 2.2.2.2 (default), from 2.2.2.2, 00:20:20 ago
      Route metric is 11, traffic share count is 1
      AS Hops 0
      MPLS label: 22
      MPLS Flags: MPLS Required
R5#show ip bgp vpnv4 vrf Customer_B
BGP table version is 13, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
     Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 11:66 (default for vrf Customer_B)
 *>i 1.1.1.1/32       2.2.2.2                 11    100      0 ?
 *>  6.6.6.6/32       192.168.56.6            11         32768 ?
 *>i 192.168.12.0     2.2.2.2                  0    100      0 ?
 *>  192.168.56.0     0.0.0.0                  0         32768 ?

Ta thấy R2, R5 đã được được route theo yêu cầu.

R1B#show ip route 6.6.6.6
% Network not in table
R6B#show ip route 1.1.1.1
% Network not in table

Mục đích của chúng ta là:
- R1B phải học được route 6.6.6.6
- R6B phải học được route 1.1.1.1

Để giải quyết vấn đề cần phải redistribute bgp vào ospf trên các con router PE

R2, R5:
router ospf 16 vrf Customer_B
redistribute bgp 2345 subnets
do write

  • Kiểm tra

 R1B#show ip route 6.6.6.6
Routing entry for 6.6.6.6/32
  Known via "ospf 16", distance 110, metric 21, type inter area
  Last update from 192.168.12.2 on Ethernet0/2, 00:04:25 ago
  Routing Descriptor Blocks:
  * 192.168.12.2, from 192.168.12.2, 00:04:25 ago, via Ethernet0/2
      Route metric is 21, traffic share count is 1
R1B#show ip route     
Codes: L - local, 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, H - NHRP, l - LISP
       + - replicated route, % - next hop override
Gateway of last resort is not set
      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.1.1.0/24 is directly connected, Loopback0
L        1.1.1.1/32 is directly connected, Loopback0
      6.0.0.0/32 is subnetted, 1 subnets
O IA     6.6.6.6 [110/21] via 192.168.12.2, 00:06:06, Ethernet0/2
      192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.12.0/24 is directly connected, Ethernet0/2
L        192.168.12.1/32 is directly connected, Ethernet0/2
O IA  192.168.56.0/24 [110/11] via 192.168.12.2, 00:06:06, Ethernet0/2

R6B#show ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 16", distance 110, metric 21, type inter area
  Last update from 192.168.56.5 on Ethernet0/2, 00:04:05 ago
  Routing Descriptor Blocks:
  * 192.168.56.5, from 192.168.56.5, 00:04:05 ago, via Ethernet0/2
      Route metric is 21, traffic share count is 1
R6B#show ip route     
Codes: L - local, 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, H - NHRP, l - LISP
       + - replicated route, % - next hop override
Gateway of last resort is not set
      1.0.0.0/32 is subnetted, 1 subnets
O IA     1.1.1.1 [110/21] via 192.168.56.5, 00:04:20, Ethernet0/2
      6.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        6.6.6.0/24 is directly connected, Loopback0
L        6.6.6.6/32 is directly connected, Loopback0
O IA  192.168.12.0/24 [110/11] via 192.168.56.5, 00:04:20, Ethernet0/2
      192.168.56.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.56.0/24 is directly connected, Ethernet0/2
L        192.168.56.6/32 is directly connected, Ethernet0/2
R1B#ping 6.6.6.6 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

R6B#ping 1.1.1.1 source 6.6.6.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 6.6.6.6
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/3 ms

R1B#traceroute 6.6.6.6 source 1.1.1.1 numeric 
Type escape sequence to abort.
Tracing the route to 6.6.6.6
VRF info: (vrf in name/id, vrf out name/id)
  1 192.168.12.2 1 msec 1 msec 0 msec
  2 192.168.23.3 [MPLS: Labels 16/22 Exp 0] 2 msec 1 msec 1 msec
  3 192.168.34.4 [MPLS: Labels 16/22 Exp 0] 1 msec 2 msec 1 msec
  4 192.168.56.5 [MPLS: Label 22 Exp 0] 1 msec 2 msec 1 msec
  5 192.168.56.6 1 msec *  2 msec
Noted:
Ta thấy IP của các router P hiển thị khi sử dụng traceroute, đó là điều không cần thiết đối với khách hàng nên ta có thể không cho hiển thị các IP này bằng câu lệnh no mpls ip propagate-ttl trên tất cả các router PE

R2, R5:
no mpls ip propagate-ttl 

R1B#traceroute 6.6.6.6 source 1.1.1.1 numeric 
Type escape sequence to abort.
Tracing the route to 6.6.6.6
VRF info: (vrf in name/id, vrf out name/id)
  1 192.168.12.2 0 msec 0 msec 1 msec
  2 192.168.56.5 [MPLS: Label 22 Exp 0] 1 msec 1 msec 1 msec
  3 192.168.56.6 2 msec *  2 msec
IP của R3 (192.168.23.3) và R4 (192.168.34.4) đã không xuất hiện trong bảng traceroute sau khi sử dụng dòng lệnh no mpls ip propagate-ttl.

Xong!


Bài 4: MPLS Layer 3 VPN PE_CE Static_OSPF

Giới thiệu:

đang cập nhật ...

Sơ đồ lab:




Yêu cầu:

1. Cấu hình MPLS Layer 3 VPN core

2. Kiểm tra các kết nối đảm bảo:
   - R1A, R1B có thể ping đến R2 và ngược lại
   - R6A, R6B có thể ping đến R5 và ngược lại
   - Loopback 0 của R2 và R5 có thể giao tiếp được với nhau

3. Cấu hình route giữa các router CE và PE:

  • Static route: Customer_A (R1A và R2; R6A và R5) đảm bảo loopback 0 của R1A và R6A có thể giao tiếp được với nhau.
  • OSPF area 0: Customer_B (R1B và R2; R6B và R5) đảm bảo loopback 0 của R1B và R6B có thể giao tiếp được với nhau.


Các kiến thức sử dụng trong bài: Static route, OSPF, Redistribute, MPLS, VRF, BGP


Cấu hình:

1. Cấu hình MPLS Layer 3 VPN core (thừa kế bài 3, tham khảo tại đây)


2. Kiểm tra các kết nối đảm bảo:

- R1A, R1B có thể ping đến R2 và ngược lại

R1A#ping 192.168.12.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R1B#ping 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/6 ms

R2#ping vrf Customer_A 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R2#ping vrf Customer_B 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms

- R6A, R6B có thể ping đến R5 và ngược lại

R6A#ping 192.168.56.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.56.5, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms
R6B#ping 192.168.56.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.56.5, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms

R5#ping vrf Customer_A 192.168.56.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.56.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R5#ping vrf Customer_B 192.168.56.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.56.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

- Loopback 0 của R2 và R5 có thể giao tiếp được với nhau

R2#ping 5.5.5.5 source 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

R5#ping 2.2.2.2 source 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 5.5.5.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

3. Cấu hình route giữa các router CE và PE:

- Static route: Customer_A (R1A và R2; R6A và R5) đảm bảo loopback 0 của R1A và R6A có thể giao tiếp được với nhau.


  • Cấu hình Static route:

R1A:
ip route 6.6.6.0 255.255.255.0 192.168.12.2

R2:
ip route vrf Customer_A 1.1.1.0 255.255.255.0 192.168.12.1

R5:
ip route vrf Customer_A 6.6.6.0 255.255.255.0 192.168.56.6

R6A:
ip route 1.1.1.0 255.255.255.0 192.168.56.5

  • Kiểm tra:
R1A#show ip route static 
(...)
Gateway of last resort is not set
      6.0.0.0/24 is subnetted, 1 subnets
S        6.6.6.0 [1/0] via 192.168.12.2


R6A#show ip route static 
(...)
Gateway of last resort is not set
      1.0.0.0/24 is subnetted, 1 subnets
S        1.1.1.0 [1/0] via 192.168.56.5

Router CE của Customer_A đã biết đường đến loopback 0 của nhau thông qua các router PE (R2, R5)


R2#show ip route vrf Customer_A 6.6.6.6
Routing Table: Customer_A
% Network not in table
R5#show ip route vrf Customer_A 1.1.1.1
Routing Table: Customer_A
% Network not in table

Tuy nhiên:
     - R2 không biết đường đi đến loopback 0 của R6A
     - R5 không biết đường đi đến loopback 0 của R1A

Để giải quyết vấn đề này ta phải redistribute các route static vào BGP, thông qua MP-BGP các router PE 2 bên sẽ học được route của các router CE.
  • Cấu hình:
R2, R5:
router bgp 2345
address-family ipv4 vrf Customer_A
redistribute static
do write
  • Kiểm tra:

R2#show ip route vrf Customer_A 6.6.6.6
Routing Table: Customer_A
Routing entry for 6.6.6.0/24
  Known via "bgp 2345", distance 200, metric 0, type internal
  Last update from 5.5.5.5 00:01:06 ago
  Routing Descriptor Blocks:
  * 5.5.5.5 (default), from 5.5.5.5, 00:01:06 ago
      Route metric is 0, traffic share count is 1
      AS Hops 0
      MPLS label: 21
      MPLS Flags: MPLS Required

R5#show ip route vrf Customer_A 1.1.1.1
Routing Table: Customer_A
Routing entry for 1.1.1.0/24
  Known via "bgp 2345", distance 200, metric 0, type internal
  Last update from 2.2.2.2 00:01:16 ago
  Routing Descriptor Blocks:
  * 2.2.2.2 (default), from 2.2.2.2, 00:01:16 ago
      Route metric is 0, traffic share count is 1
      AS Hops 0
      MPLS label: 21
      MPLS Flags: MPLS Required


R2#show ip bgp vpnv4 vrf Customer_A
BGP table version is 6, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
     Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 16:16 (default for vrf Customer_A)
 *>  1.1.1.0/24       192.168.12.1             0         32768 ?
 *>i 6.6.6.0/24       5.5.5.5                  0    100      0 ?

R5#show ip bgp vpnv4 vrf Customer_A
BGP table version is 7, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
     Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 16:16 (default for vrf Customer_A)
 *>i 1.1.1.0/24       2.2.2.2                  0    100      0 ?
 *>  6.6.6.0/24       192.168.56.6             0         32768 ?

Vậy là các PE router đã học các route static từ đầu bên kia redistribute vào và dùng lable 21 để forward gói tin

R1A#ping 6.6.6.6 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

R6A#ping 1.1.1.1 source 6.6.6.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 6.6.6.6
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

Loopback 0 của R1A và R6A đã giao tiếp được với nhau và cụ thể là dùng lable 21 để forward gói tin.


Phân tích kết quả bắt gói (dùng wireshark) trên các  router PE ta thấy lúc này MPLS có đến 2 nhãn (đại khái là 1 nhãn tránh blackhole, 1 nhãn cho vpnv4. Tìm đọc bài Quá trình trao đổi nhãn)


- OSPF area 0: Customer_B (R1B và R2; R6B và R5) đảm bảo loopback 0 của R1B và R6B có thể giao tiếp được với nhau.

  • Cấu hình:
Cấu hình ospf
Vì đã có ospf 1 chạy cho vùng MPLS core rồi nên ta dùng proccess 16 trong trường hợp này

R1B, R6B:
router ospf 16
exit
interface range ethernet 0/2, loopback 0
ip ospf 16 area 0
do write


R2:
router ospf 16 vrf Customer_B
network 192.168.12.2 0.0.0.0 area 0

R5:
router ospf 16 vrf Customer_B
network 192.168.56.5 0.0.0.0 area 0


Redistribute ospf vào MP-BGP để các PE (R2, R5) học được route của router CE (trong trường hợp này là học loopback 0 của R1B và R6B)

R2, R5:

router bgp 2345
address-family ipv4 vrf Customer_B
redistribute ospf 16


  • Kiểm tra:

R2# show ip route  vrf Customer_B ospf
(...)
      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/11] via 192.168.12.1, 00:32:09, Ethernet0/1
R2# show ip route  vrf Customer_B 6.6.6.6
Routing Table: Customer_B
Routing entry for 6.6.6.6/32
  Known via "bgp 2345", distance 200, metric 11, type internal
  Last update from 5.5.5.5 00:12:18 ago
  Routing Descriptor Blocks:
  * 5.5.5.5 (default), from 5.5.5.5, 00:12:18 ago
      Route metric is 11, traffic share count is 1
      AS Hops 0
      MPLS label: 22
      MPLS Flags: MPLS Required
R2#show ip bgp vpnv4 vrf Customer_B
BGP table version is 12, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
     Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 11:66 (default for vrf Customer_B)
 *>  1.1.1.1/32       192.168.12.1            11         32768 ?
 *>i 6.6.6.6/32       5.5.5.5                 11    100      0 ?
 *>  192.168.12.0     0.0.0.0                  0         32768 ?
 *>i 192.168.56.0     5.5.5.5                  0    100      0 ?

Có thể dùng lệnh show bgp vpnv4 unicast vrf Customer_B

R5#show ip route vrf Customer_B ospf
(...)
Gateway of last resort is not set
      6.0.0.0/32 is subnetted, 1 subnets
O        6.6.6.6 [110/11] via 192.168.56.6, 00:39:28, Ethernet0/1
R5#show ip route vrf Customer_B 1.1.1.1
Routing Table: Customer_B
Routing entry for 1.1.1.1/32
  Known via "bgp 2345", distance 200, metric 11, type internal
  Last update from 2.2.2.2 00:20:20 ago
  Routing Descriptor Blocks:
  * 2.2.2.2 (default), from 2.2.2.2, 00:20:20 ago
      Route metric is 11, traffic share count is 1
      AS Hops 0
      MPLS label: 22
      MPLS Flags: MPLS Required
R5#show ip bgp vpnv4 vrf Customer_B
BGP table version is 13, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
     Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 11:66 (default for vrf Customer_B)
 *>i 1.1.1.1/32       2.2.2.2                 11    100      0 ?
 *>  6.6.6.6/32       192.168.56.6            11         32768 ?
 *>i 192.168.12.0     2.2.2.2                  0    100      0 ?
 *>  192.168.56.0     0.0.0.0                  0         32768 ?

Ta thấy R2, R5 đã được được route theo yêu cầu.

R1B#show ip route 6.6.6.6
% Network not in table
R6B#show ip route 1.1.1.1
% Network not in table

Mục đích của chúng ta là:
- R1B phải học được route 6.6.6.6
- R6B phải học được route 1.1.1.1

Để giải quyết vấn đề cần phải redistribute bgp vào ospf trên các con router PE

R2, R5:
router ospf 16 vrf Customer_B
redistribute bgp 2345 subnets
do write

  • Kiểm tra

 R1B#show ip route 6.6.6.6
Routing entry for 6.6.6.6/32
  Known via "ospf 16", distance 110, metric 21, type inter area
  Last update from 192.168.12.2 on Ethernet0/2, 00:04:25 ago
  Routing Descriptor Blocks:
  * 192.168.12.2, from 192.168.12.2, 00:04:25 ago, via Ethernet0/2
      Route metric is 21, traffic share count is 1
R1B#show ip route     
Codes: L - local, 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, H - NHRP, l - LISP
       + - replicated route, % - next hop override
Gateway of last resort is not set
      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.1.1.0/24 is directly connected, Loopback0
L        1.1.1.1/32 is directly connected, Loopback0
      6.0.0.0/32 is subnetted, 1 subnets
O IA     6.6.6.6 [110/21] via 192.168.12.2, 00:06:06, Ethernet0/2
      192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.12.0/24 is directly connected, Ethernet0/2
L        192.168.12.1/32 is directly connected, Ethernet0/2
O IA  192.168.56.0/24 [110/11] via 192.168.12.2, 00:06:06, Ethernet0/2

R6B#show ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 16", distance 110, metric 21, type inter area
  Last update from 192.168.56.5 on Ethernet0/2, 00:04:05 ago
  Routing Descriptor Blocks:
  * 192.168.56.5, from 192.168.56.5, 00:04:05 ago, via Ethernet0/2
      Route metric is 21, traffic share count is 1
R6B#show ip route     
Codes: L - local, 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, H - NHRP, l - LISP
       + - replicated route, % - next hop override
Gateway of last resort is not set
      1.0.0.0/32 is subnetted, 1 subnets
O IA     1.1.1.1 [110/21] via 192.168.56.5, 00:04:20, Ethernet0/2
      6.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        6.6.6.0/24 is directly connected, Loopback0
L        6.6.6.6/32 is directly connected, Loopback0
O IA  192.168.12.0/24 [110/11] via 192.168.56.5, 00:04:20, Ethernet0/2
      192.168.56.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.56.0/24 is directly connected, Ethernet0/2
L        192.168.56.6/32 is directly connected, Ethernet0/2
R1B#ping 6.6.6.6 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

R6B#ping 1.1.1.1 source 6.6.6.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 6.6.6.6
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/3 ms

R1B#traceroute 6.6.6.6 source 1.1.1.1 numeric 
Type escape sequence to abort.
Tracing the route to 6.6.6.6
VRF info: (vrf in name/id, vrf out name/id)
  1 192.168.12.2 1 msec 1 msec 0 msec
  2 192.168.23.3 [MPLS: Labels 16/22 Exp 0] 2 msec 1 msec 1 msec
  3 192.168.34.4 [MPLS: Labels 16/22 Exp 0] 1 msec 2 msec 1 msec
  4 192.168.56.5 [MPLS: Label 22 Exp 0] 1 msec 2 msec 1 msec
  5 192.168.56.6 1 msec *  2 msec
Noted:
Ta thấy IP của các router P hiển thị khi sử dụng traceroute, đó là điều không cần thiết đối với khách hàng nên ta có thể không cho hiển thị các IP này bằng câu lệnh no mpls ip propagate-ttl trên tất cả các router PE

R2, R5:
no mpls ip propagate-ttl 

R1B#traceroute 6.6.6.6 source 1.1.1.1 numeric 
Type escape sequence to abort.
Tracing the route to 6.6.6.6
VRF info: (vrf in name/id, vrf out name/id)
  1 192.168.12.2 0 msec 0 msec 1 msec
  2 192.168.56.5 [MPLS: Label 22 Exp 0] 1 msec 1 msec 1 msec
  3 192.168.56.6 2 msec *  2 msec
IP của R3 (192.168.23.3) và R4 (192.168.34.4) đã không xuất hiện trong bảng traceroute sau khi sử dụng dòng lệnh no mpls ip propagate-ttl.

Xong!

Cisco, First Hop Redundancy Protocol (FHRP), Hot Standby Router Protocol (HSRP)



Các kiến thức sử dụng trong bài Lab: Spanning Tree Protocol, VLAN, Trunking, router on a stick, HSRP, floating static route, Nat overload, Access List, IP SLA

YÊU CẦU:
1. Cấu hình Rapid-PVST+ và Port Fast trên Switch 12 để đảm bảo sự chuyển đổi dự phòng của HSRP được nhanh hơn (mặt định switch phải mất 30s-50s để chuyển thành port fordward dữ liệu), tạo và gán vlan tương ứng cho các PC, cấu hình trunk trên các cổng nối đến R1, R2.

2. VLAN 10: Cấu hình HSRP version 1 đảm bảo R1 là actice router, bật chế độ preempt để chiếm quyền active router nếu R1 online, R2 là standy router

3. VLAN 20: Cấu hình HSRP version 2 đảm bảo R2 là active router, bật chế độ preempt để chiếm quyền active router sau 2 phút nếu R2 online, R1 là standy router, cấu hình xác thực md5 password là cisco123, điều chỉnh timer: hello 1, deal 3 (mặt định hello time là 3s, deal/hold time 10s)

4. Cấu hình và đặt ip cho R12 như hình, cấu hình default route trên:
  • R1, R2 --> R12 với AD 5; Nat overload đảm bảo các PC trong LAN có thể ping đến được 8.8.8.8
  • R1 --> R2 với AD 10
  • R2 --> R1 với AD 10

5. Cấu hình Track cho HSRP
  • R1 track interface: kiểm tra nếu đường link e0/3 đến R12 bị down thì giảm priority của group 10 xuống 15, nếu đường link e0/3 đến R2 và e0/0 bị cùng down -> giảm thêm priority của group 10 là 15 ( lúc này R2 là active router cho group 10)
  • R2 track object: nếu R2 không ping đến được địa chỉ 2.2.2.2 của R12 thì giảm bớt priority của group 20 là 15, nếu không ping được địa chỉ 2.2.2.2 và 10.3.3.9 của R1 thì giảm tiếp priority của group 20 là 15. => R1 active router của group 20.
6. Cấu hình track cho Route đi internet:
  • R2 nếu không ping đến được ip 2.2.2.2 trỏ next hop của R2 trỏ về R1
  • Nếu R1 không ping đến được 10.3.3.1 của R2 thì next của R1 trỏ về R2

THỰC HIỆN:
1. Cấu hình Rapid-PVST+ và Port Fast trên Switch 12 để đảm bảo sự chuyển đổi dự phòng của HSRP được nhanh hơn (mặt định switch phải mất 30s-50s để chuyển thành port fordward dữ liệu), tạo và gán vlan tương ứng cho các PC, cấu hình trunk trên các cổng nối đến R1, R2.

Cisco, Dynamic Multipoint VPN (DMVPN) Phase 2 - HUB, SPOKES, mGRE Protection and Routing




Các kiến thức dùng trong bài lab: ospf, mGRE, static route

Yêu cầu:
1. Đấu dây và đặt IP như hình (qui ước cách đặt ip theo số của Router),  cấu hình OSPF sao cho các IP public phải ping thấy nhau


Gợi ý cấu hình

  • R1
!
interface Ethernet0/1
 ip address 1.1.1.1 255.255.255.0
 ip ospf 1 area 0
end
!
interface Loopback0
 ip address 192.168.1.1 255.255.255.0
end
!
router ospf 1
router-id 1.1.1.1
  • R2

!
interface Ethernet0/2
 ip address 2.2.2.2 255.255.255.0
 ip ospf 1 area 0
end
!
interface Loopback0
 ip address 192.168.2.1 255.255.255.0
end
!
router ospf 1
router-id 2.2.2.2
  • R3
!
interface Ethernet0/3
 ip address 3.3.3.3 255.255.255.0
 ip ospf 1 area 0
end
!
interface Loopback0
 ip address 192.168.3.1 255.255.255.0
end
!
router ospf 1
router-id 3.3.3.3
  • R4
!
interface Ethernet0/1
 ip address 1.1.1.4 255.255.255.0
 ip ospf 1 area 0
end

!
interface Ethernet0/2
 ip address 2.2.2.4 255.255.255.0
 ip ospf 1 area 0
end

!
interface Ethernet0/3
 ip address 3.3.3.4 255.255.255.0
 ip ospf 1 area 0
end

!

router ospf 1
router-id 4.4.4.4


!Kiểm tra sau khi cấu hình OSPF
!R1
R1#show ip route ospf
đã xóa 1 số dòng không cần thiết
      2.0.0.0/24 is subnetted, 1 subnets
O        2.2.2.0 [110/20] via 1.1.1.4, 00:01:32, Ethernet0/1
      3.0.0.0/24 is subnetted, 1 subnets
O        3.3.3.0 [110/20] via 1.1.1.4, 00:01:32, Ethernet0/1
!R2
R2#show ip route ospf 
đã xóa 1 số dòng không cần thiết
      1.0.0.0/24 is subnetted, 1 subnets
O        1.1.1.0 [110/20] via 2.2.2.4, 00:00:53, Ethernet0/2
      3.0.0.0/24 is subnetted, 1 subnets
O        3.3.3.0 [110/20] via 2.2.2.4, 00:02:42, Ethernet0/2
!R3
R3#show ip route ospf
đã xóa 1 số dòng không cần thiết
      1.0.0.0/24 is subnetted, 1 subnets
O        1.1.1.0 [110/20] via 3.3.3.4, 00:01:17, Ethernet0/3
      2.0.0.0/24 is subnetted, 1 subnets
O        2.2.2.0 [110/20] via 3.3.3.4, 00:03:06, Ethernet0/3

2. Cấu hình mGRE giữa R1, R2, R3 
Gợi ý cấu hình

  • R1

!
interface Tunnel0
 description ===mGRE - DMVPN Tunnel===
 ip address 172.16.0.1 255.255.255.0
 no ip redirects
 ip nhrp authentication cisco
 ip nhrp map multicast dynamic
 ip nhrp network-id 1
 tunnel source 1.1.1.1
 tunnel mode gre multipoint
end

  • R2

!
interface Tunnel0
 description ===R2 mGRE - DMVPN Tunnel===
 ip address 172.16.0.2 255.255.255.0
 no ip redirects
 ip nhrp authentication cisco
 ip nhrp map multicast dynamic
 ip nhrp map 172.16.0.1 1.1.1.1
 ip nhrp network-id 1
 ip nhrp nhs 172.16.0.1
 tunnel source Ethernet0/2
 tunnel mode gre multipoint
end
  • R3
!
interface Tunnel0
 description ===R3 mGRE - DMVPN Tunnel===
 ip address 172.16.0.3 255.255.255.0
 no ip redirects
 ip nhrp authentication cisco
 ip nhrp map multicast dynamic
 ip nhrp map 172.16.0.1 1.1.1.1
 ip nhrp network-id 1
 ip nhrp nhs 172.16.0.1
 tunnel source Ethernet0/3
 tunnel mode gre multipoint
end

Kiểm tra sau khi cấu hình mGRE
!R1
R1#show dmvpn 
đã xóa 1 số dòng không cần thiết
Interface: Tunnel0, IPv4 NHRP Details 
Type:Hub, NHRP Peers:2, 

 # Ent  Peer NBMA Addr Peer Tunnel Add State  UpDn Tm Attrb
 ----- --------------- --------------- ----- -------- -----
     1 2.2.2.2              172.16.0.2    UP 01:31:58     D
     1 3.3.3.3              172.16.0.3    UP 01:27:41     D

R1#show ip nhrp 
172.16.0.2/32 via 172.16.0.2
   Tunnel0 created 01:36:55, expire 01:43:04
   Type: dynamic, Flags: unique registered used 
   NBMA address: 2.2.2.2 
172.16.0.3/32 via 172.16.0.3
   Tunnel0 created 01:33:23, expire 01:47:23
   Type: dynamic, Flags: unique registered used 
   NBMA address: 3.3.3.3 
!R2

R2#show dmvpn 
đã xóa 1 số dòng không cần thiết
Interface: Tunnel0, IPv4 NHRP Details 
Type:Spoke, NHRP Peers:2, 

 # Ent  Peer NBMA Addr Peer Tunnel Add State  UpDn Tm Attrb
 ----- --------------- --------------- ----- -------- -----
     1 1.1.1.1              172.16.0.1    UP 01:34:10     S
     1 3.3.3.3              172.16.0.3    UP 01:29:44     D
!Tunnel được thiết lập từ SPOKES đến HUB là S

R2#show ip nhrp 
172.16.0.1/32 via 172.16.0.1
   Tunnel0 created 01:39:02, never expire 
   Type: static, Flags: used 
   NBMA address: 1.1.1.1 
172.16.0.2/32 via 172.16.0.2
   Tunnel0 created 01:34:08, expire 00:25:51
   Type: dynamic, Flags: router unique local 
   NBMA address: 2.2.2.2 
    (no-socket) 
172.16.0.3/32 via 172.16.0.3
   Tunnel0 created 01:35:34, expire 00:25:51
   Type: dynamic, Flags: router implicit used 
   NBMA address: 3.3.3.3 
!R3

R3#show dmvpn 
đã xóa 1 số dòng không cần thiết
Interface: Tunnel0, IPv4 NHRP Details 
Type:Spoke, NHRP Peers:2, 

 # Ent  Peer NBMA Addr Peer Tunnel Add State  UpDn Tm Attrb
 ----- --------------- --------------- ----- -------- -----
     1 1.1.1.1              172.16.0.1    UP 01:31:05     S
     1 2.2.2.2              172.16.0.2    UP 01:30:56     D
!Tunnel được thiết lập từ SPOKES đến HUB là S

R3#show ip nhrp 
172.16.0.1/32 via 172.16.0.1
   Tunnel0 created 01:33:35, never expire 
   Type: static, Flags: used 
   NBMA address: 1.1.1.1 
172.16.0.2/32 via 172.16.0.2
   Tunnel0 created 01:33:26, expire 00:26:33
   Type: dynamic, Flags: router used 
   NBMA address: 2.2.2.2 

3. Cấu hình static route để các loopback 0 phải ping thấy nhau
Gợi ý cấu hình:
!R1
ip route 192.168.2.0 255.255.255.0 172.16.0.2
ip route 192.168.3.0 255.255.255.0 172.16.0.3

!R2
ip route 192.168.1.0 255.255.255.0 172.16.0.1
ip route 192.168.3.0 255.255.255.0 172.16.0.3

!R3
ip route 192.168.1.0 255.255.255.0 172.16.0.1
ip route 192.168.2.0 255.255.255.0 172.16.0.2

Kiểm tra sau khi cấu hình static route
!R1
R1#show ip route static 
đã xóa 1 số dòng không cần thiết
S     192.168.2.0/24 [1/0] via 172.16.0.2
S     192.168.3.0/24 [1/0] via 172.16.0.3
R1#ping 192.168.2.1 source 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.1.1 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
R1#ping 192.168.3.1 source 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.1.1 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

!R2
R2#show ip route static 
đã xóa 1 số dòng không cần thiết
S     192.168.1.0/24 [1/0] via 172.16.0.1
S     192.168.3.0/24 [1/0] via 172.16.0.3
R2#ping 192.168.3.1 source 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.2.1 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
R2#ping 192.168.1.1 source 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.2.1 
!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
!R3
R3#show ip route static 
đã xóa 1 số dòng không cần thiết
S     192.168.1.0/24 [1/0] via 172.16.0.1
S     192.168.2.0/24 [1/0] via 172.16.0.2
R3#ping 192.168.2.1 source 192.168.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.3.1 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
R3#ping 192.168.1.1 source 192.168.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.3.1 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

4. Protecting - Encrypting DMVPN mGRE Tunnel with IPSEC
!Gợi ý cấu hình:
!R1, R2, R3
crypto isakmp policy 1
 encr 3des
 hash md5
 authentication pre-share
 group 2
crypto isakmp key cisco address 0.0.0.0     
crypto ipsec transform-set TS esp-3des esp-md5-hmac
 mode tunnel
crypto ipsec profile protect-gre
 set security-association lifetime seconds 86400
 set transform-set TS
! gán vào interface tunnel 0
interface Tunnel0
 tunnel protection ipsec profile protect-gre

!Kiểm tra
R1#show crypto session 
Crypto session current status

Interface: Tunnel0
Session status: UP-ACTIVE     
Peer: 3.3.3.3 port 500 
  IKEv1 SA: local 1.1.1.1/500 remote 3.3.3.3/500 Active 
  IPSEC FLOW: permit 47 host 1.1.1.1 host 3.3.3.3 
        Active SAs: 2, origin: crypto map

Interface: Tunnel0
Session status: UP-ACTIVE     
Peer: 2.2.2.2 port 500 
  IKEv1 SA: local 1.1.1.1/500 remote 2.2.2.2/500 Active 
  IPSEC FLOW: permit 47 host 1.1.1.1 host 2.2.2.2 
        Active SAs: 2, origin: crypto map


!R2#show crypto session 
Crypto session current status

Interface: Tunnel0
Session status: UP-ACTIVE     
Peer: 3.3.3.3 port 500 
  IKEv1 SA: local 2.2.2.2/500 remote 3.3.3.3/500 Active 
  IKEv1 SA: local 2.2.2.2/500 remote 3.3.3.3/500 Active 
  IPSEC FLOW: permit 47 host 2.2.2.2 host 3.3.3.3 
        Active SAs: 6, origin: crypto map

Interface: Tunnel0
Session status: UP-ACTIVE     
Peer: 1.1.1.1 port 500 
  IKEv1 SA: local 2.2.2.2/500 remote 1.1.1.1/500 Active 
  IPSEC FLOW: permit 47 host 2.2.2.2 host 1.1.1.1 
        Active SAs: 2, origin: crypto map

!R3#show crypto session 
Crypto session current status

Interface: Tunnel0
Session status: UP-ACTIVE     
Peer: 2.2.2.2 port 500 
  IKEv1 SA: local 3.3.3.3/500 remote 2.2.2.2/500 Active 
  IKEv1 SA: local 3.3.3.3/500 remote 2.2.2.2/500 Active 
  IPSEC FLOW: permit 47 host 3.3.3.3 host 2.2.2.2 
        Active SAs: 6, origin: crypto map

Interface: Tunnel0
Session status: UP-ACTIVE     
Peer: 1.1.1.1 port 500 
  IKEv1 SA: local 3.3.3.3/500 remote 1.1.1.1/500 Active 
  IPSEC FLOW: permit 47 host 3.3.3.3 host 1.1.1.1 
        Active SAs: 2, origin: crypto map


! so sánh kết quả trước và sau khi cấu hình IPSec

Cisco, Dynamic Multipoint VPN (DMVPN) Phase 2 - HUB, SPOKES, mGRE Protection and Routing




Các kiến thức dùng trong bài lab: ospf, mGRE, static route

Yêu cầu:
1. Đấu dây và đặt IP như hình (qui ước cách đặt ip theo số của Router),  cấu hình OSPF sao cho các IP public phải ping thấy nhau

/*header slide*/