/*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===*/

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!


No comments:

Post a Comment

/*header slide*/