Protocols/BGP_OSPF_MPLS_VPN

[MPLS] IP/MPLS Basics

양된백성 2021. 6. 8. 16:19

 

<L3 base Topology>

 

1. OSPF Topology

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
R1#show run | b router ospf 1
router ospf 1
 router-id 1.1.1.1
 network 1.1.1.1 0.0.0.0 area 0
 network 1.1.12.1 0.0.0.0 area 0
 network 1.1.14.1 0.0.0.0 area 0
 
R2#show run | b router ospf 1
router ospf 1
 router-id 1.1.2.2
 network 1.1.2.2 0.0.0.0 area 0
 network 1.1.12.2 0.0.0.0 area 0
 network 1.1.23.2 0.0.0.0 area 0
 
R3#show run | b router ospf 1
router ospf 1
 router-id 1.1.3.3
 network 1.1.3.3 0.0.0.0 area 0
 network 1.1.23.3 0.0.0.0 area 0
 network 1.1.34.3 0.0.0.0 area 0
 
R4#show run | b router ospf 1
router ospf 1
 router-id 1.1.4.4
 network 1.1.4.4 0.0.0.0 area 0
 network 1.1.14.4 0.0.0.0 area 0
 network 1.1.34.4 0.0.0.0 area 0

 

2. LDP Topology

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
R1#
mpls label protocol ldp        // Configure the use of LDP on all interfaces to forward label binding.
mpls ldp router-id Loopback0    // Specifies the preferred interface for determining the LDP router ID. 
interface Ethernet0/0.12
 mpls ip            // Configures MPLS hop-by-hop forwarding on the interface.
 
R2#
mpls label protocol ldp
mpls ldp router-id Loopback0
interface Ethernet0/0.12
 mpls ip
interface Ethernet0/0.23
 mpls ip
 
R3#
mpls label protocol ldp
mpls ldp router-id Loopback0
interface Ethernet0/0.23
 mpls ip
interface Ethernet0/0.34
 mpls ip
 
R4#
mpls label protocol ldp
mpls ldp router-id Loopback0
interface Ethernet0/0.34
 mpls ip

    2.1 LDP session extablishment procedure

    2.2 LDP Initialization Message

    2.3 Captured ICMP on R2 from R1 to R4
ICMP request was pushed with Label 18 on R1.

 

3. MP-BGP Topology

MP-BGP is enabed on PE routers.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
R1#show run | b router bgp
router bgp 1                    // start bgp routing with process id 1
 bgp router-id 1.1.1.1                // Use 1.1.1.1 for BGP identifier
 neighbor 1.1.4.4 remote-as 1            // Make a peer with 1.1.4.4 to send myAS:1 in OPEN message
 neighbor 1.1.4.4 update-source Loopback0
 !
 address-family vpnv4                // start Multi-protocol BGP for MPLS VPN version 4
  neighbor 1.1.4.4 activate            // activate MPLS VPN version 4 with 1.1.4.4 
  neighbor 1.1.4.4 send-community extended    // 'extended' community makes it possible to use RT, SOO communities
 exit-address-family
 
 
R4#show run | b router bgp
router bgp 1
 bgp router-id 1.1.4.4
 neighbor 1.1.1.1 remote-as 1
 neighbor 1.1.1.1 update-source Loopback0
 !
 address-family vpnv4
  neighbor 1.1.1.1 activate
  neighbor 1.1.1.1 send-community both        // 'both' options sends extended community, large community, and standard communities attributes to the neighbor.
 exit-address-family
 

*BGP OPEN message has 'My AS' and BGP Identifier and extensions for MP-BGP.

 

4. MPLS VPN Topology

*Configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
R1#
ip vrf customer1        // 'Virtual Routing/Forwarding' has a routing table for each customer(VPN).
 rd 1:100            // 'Route Distinguisher' can be an idientifier for a customer. AS:NN(customer number)
 route-target export 1:101    // 'route-target' is an extended community of BGP.
                // 'export 1:101' can send a packet to 'import 1:101'
 route-target import 1:102    // 'import 1:102' can receive a packet for 'export 1:102'
!
ip vrf customer2        // Create a private routing table for 'customer2'
 rd 1:200            // 'customer2' has 1:200 identifier
 route-target export 1:201    // 'rt export 1:201' can send packets to 'rt import 1:201'
 route-target import 1:202
!
interface Ethernet0/0.15
 encapsulation dot1Q 15
 ip vrf forwarding customer1    // apply a virtual routing table (customer1) to this interface)
 ip address 10.1.15.1 255.255.255.0
!
interface Ethernet0/0.17
 encapsulation dot1Q 17
 ip vrf forwarding customer2
 ip address 10.1.17.1 255.255.255.0
!
router bgp 1
 address-family ipv4 vrf customer1
  redistribute connected    // Redistribute connection routes to customer1 BGP routing table.
  redistribute static        // Redistribute static routes to customer1 BGP routing table.
 exit-address-family
 !
 address-family ipv4 vrf customer2
  redistribute connected
  redistribute static
 exit-address-family
!
ip route vrf customer1 10.1.1.0 255.255.255.0 10.1.15.5    // can reach customer1 network via 10.1.15.5 GW.
ip route vrf customer2 10.1.1.0 255.255.255.0 10.1.17.7    // can reach customer2 network via 10.1.17.7 GW.
 
 
 
R4#
ip vrf customer1
 rd 1:100
 route-target export 1:102
 route-target import 1:101
!
ip vrf customer2
 rd 1:200
 route-target export 1:202
 route-target import 1:201
!
interface Ethernet0/0.46
 encapsulation dot1Q 46
 ip vrf forwarding customer1
 ip address 10.1.46.4 255.255.255.0
!
interface Ethernet0/0.48
 encapsulation dot1Q 48
 ip vrf forwarding customer2
 ip address 10.1.48.4 255.255.255.0
!
router bgp 1
 address-family ipv4 vrf customer1
  redistribute connected
  redistribute static
 exit-address-family
!
 address-family ipv4 vrf customer2
  redistribute connected
  redistribute static
 exit-address-family
 
 
* show command
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
R1#show ip bgp vpnv4 rd 1:100
BGP table version is 13, local router ID is 1.1.1.1
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: 1:100 (default for vrf customer1)
 *>  10.1.1.0/24      10.1.15.5                0         32768 ?
 *>10.1.2.0/24      1.1.4.4                  0    100      0 ?
 *>  10.1.15.0/24     0.0.0.0                  0         32768 ?
 *>10.1.46.0/24     1.1.4.4                  0    100      0 ?
R1#
R1#show ip bgp vpnv4 rd 1:100 10.1.2.0/24
BGP routing table entry for 1:100:10.1.2.0/24, version 10
Paths: (1 available, best #1, table customer1)
  Not advertised to any peer
  Refresh Epoch 1
  Local
    1.1.4.4 (metric 31) (via default) from 1.1.4.4 (1.1.4.4)
      Origin incomplete, metric 0, localpref 100, valid, internal, best
      Extended Community: RT:1:102
      mpls labels in/out nolabel/22                        // push label 22 for 10.1.2.0 via 1.1.4.4
      rx pathid: 0, tx pathid: 0x0
R1#
R1#show mpls forwarding-table
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
17         Pop Label  1.1.2.2/32       0             Et0/0.12   1.1.12.2
18         Pop Label  1.1.23.0/24      0             Et0/0.12   1.1.12.2
19         19         1.1.4.4/32       0             Et0/0.12   1.1.12.2    // 'push' label 19 for 1.1.4.4
20         20         1.1.3.3/32       0             Et0/0.12   1.1.12.2
21         21         1.1.34.0/24      0             Et0/0.12   1.1.12.2
22         No Label   10.1.1.0/24[V]   590           Et0/0.15   10.1.15.5
23         No Label   10.1.15.0/24[V]  2714          aggregate/customer1
24         No Label   10.1.1.0/24[V]   652           Et0/0.17   10.1.17.7
25         No Label   10.1.17.0/24[V]  590           aggregate/customer2
R1#
 
cs

* ICMP packet for 10.1.2.2 on R1

the packet has label 19 and 22.

R5에서 R6으로 ping 갈 때 22 lable 먼저 붙고 그 다음 19가 붙는 것을 알 수 있다.

22 label은 BGP Label로 BGP에 의해 붙였고, 19 label은 IGP Label로 LDP에서 붙인 것을 알 수 있다.