Thursday 29 November 2012

MPLS VPN using ospf as the PE-CE routing protocol

In this tutorial , I will be implementing MPLS L3 VPN setting with OSPF on the customer side.
TOPOLOGY


CONFIGURATION STEPS
  1. OSPF CONFIGURATION ON ISP SIDE ( R2-R1-R3)
  2. ENABLING MPLS ON ISP SIDE
  3. VRF CONFIGURATION ON PEs(Provider Edge routers)
  4. OSPF CONFIGURATION ON CEs(Customer Edge routers) and verification
  5. MP-BGP SETTING AND REDISTRIBUTION OF PE AND CE ROUTES

OSPF CONFIGURATION ON ISP SIDE ( R2-R1-R3
■R1 config
  • first let's set ip addresses on the target interfaces
 interface Loopback0
 ip address 1.1.1.1 255.255.255.0
 no shut
 interface FastEthernet0/0
 ip address 192.168.12.1 255.255.255.0

 no shut

 interface FastEthernet1/0
 ip address 192.168.13.1 255.255.255.0

 no shut

router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 network 1.1.1.1 0.0.0.0 area 0
 network 192.168.12.0 0.0.0.255 area 0
 network 192.168.13.0 0.0.0.255 area 0


※ for the loopback to be advertised as /24 we run the following command under lo0
int lo0
  ip ospf network point-to-point


■R2 config
  •  first let's set ip addresses on the target interfaces
interface Loopback0
 ip address 2.2.2.2 255.255.255.0


interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.0

 no shut

router ospf 1
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.12.0 0.0.0.255 area 0


※ for the loopback to be advertised as /24 we run the following command under lo0
int lo0
  ip ospf network point-to-point

■R3 config
  •  first let's set ip addresses on the target interfaces

interface Loopback0
 ip address 3.3.3.3 255.255.255.0


interface FastEthernet0/0
 ip address 192.168.13.2 255.255.255.0

 no shut

router ospf 1
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.13.0 0.0.0.255 area 0

※ for the loopback to be advertised as /24 we run the following command under lo0
int lo0
  ip ospf network point-to-point
  • Verify connectivity by pinging loopbacks
    • R1-R2
    • R1-R3
  • Verify ospf neighborship
R1#sh ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/DR         00:00:31    192.168.13.2    FastEthernet1/0
2.2.2.2           1   FULL/BDR        00:00:31    192.168.12.2    FastEthernet0/0
R1#

-----
R2#sh ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DR         00:00:39    192.168.12.1    FastEthernet0/0
R2#


------
R3#sh ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/BDR        00:00:34    192.168.13.1    FastEthernet0/0
R3#

ENABLING MPLS ON ISP SIDE

  • We then enable mpls on the PE router on the ISP facing side and on the LSR.
■R1
conf t
ip cef  <<<<<< for MPLS to create a LFIB based on the FIB generated by this command
int fa0/0
mpls ip
int fa1/0
mpls ip

■R2

conf t
ip cef

int fa0/0
mpls ip

■R3

conf t
ip cef

int fa0/0
mpls ip
  • Vefiry mpls neighborship
 R1#sh mpls ldp nei
    Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 1.1.1.1:0
        TCP connection: 3.3.3.3.25228 - 1.1.1.1.646
        State: Oper; Msgs sent/rcvd: 203/204; Downstream
        Up time: 02:44:56
        LDP discovery sources:
          FastEthernet1/0, Src IP addr: 192.168.13.2
        Addresses bound to peer LDP Ident:
          192.168.13.2    3.3.3.3        
    Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 1.1.1.1:0
        TCP connection: 2.2.2.2.62305 - 1.1.1.1.646
        State: Oper; Msgs sent/rcvd: 8/8; Downstream
        Up time: 00:00:48
        LDP discovery sources:
          FastEthernet0/0, Src IP addr: 192.168.12.2
        Addresses bound to peer LDP Ident:
          192.168.12.2    2.2.2.2


R2#sh mpls ldp nei
    Peer LDP Ident: 1.1.1.1:0; Local LDP Ident 2.2.2.2:0
        TCP connection: 1.1.1.1.646 - 2.2.2.2.62305
        State: Oper; Msgs sent/rcvd: 8/8; Downstream
        Up time: 00:00:27
        LDP discovery sources:
          FastEthernet0/0, Src IP addr: 192.168.12.1
        Addresses bound to peer LDP Ident:
  

R3#sh mpls ldp nei
    Peer LDP Ident: 1.1.1.1:0; Local LDP Ident 3.3.3.3:0
        TCP connection: 1.1.1.1.646 - 3.3.3.3.25228
        State: Oper; Msgs sent/rcvd: 204/203; Downstream
        Up time: 02:44:44
        LDP discovery sources:
          FastEthernet0/0, Src IP addr: 192.168.13.1
        Addresses bound to peer LDP Ident:
          192.168.12.1    192.168.13.1    1.1.1.1         
 ※If you don't advertise loopbacks into ospf neighborship will not form on mpls.
VRF CONFIGURATION ON PEs(Provider Edge routers)  



■R2 
!Defining a VRF and the routes to import and export
ip vrf OSPF
 rd 1:1
 route-target export 1:1
 route-target import 1:1

!Setting interfaces belonging to the vrf
interface FastEthernet1/0
 ip vrf forwarding OSPF
 ip address 192.168.0.1 255.255.255.0
 no shut

!Setting the ospf process for the VRF
router ospf 2 vrf OSPF
 network 192.168.0.0 0.0.0.255 area 0
■R3
ip vrf OSPF
 rd 1:1
 route-target export 1:1
 route-target import 1:1

 
 interface FastEthernet1/0
 ip vrf forwarding OSPF
 ip address 192.168.1.1 255.255.255.0
 no shut

router ospf 2 vrf OSPF
 network 192.168.1.0 0.0.0.255 area
0
 
OSPF CONFIGURATION ON CEs(Customer Edge routers) and verification

■R4

interface Loopback0
 ip address 4.4.4.4 255.255.255.0
 ip ospf network point-to-point
!
interface FastEthernet0/0
 ip address 192.168.0.2 255.255.255.0
 duplex auto
 speed auto
!
router ospf 1
 router-id 4.4.4.4
 log-adjacency-changes
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.0.0 0.0.0.255 area 0

!

■R5
interface Loopback0
 ip address 5.5.5.5 255.255.255.0
 ip ospf network point-to-point
!
interface FastEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto
!
router ospf 1
 router-id 5.5.5.5
 log-adjacency-changes
 network 5.5.5.5 0.0.0.0 area 0
 network 192.168.1.0 0.0.0.255 area 0
  • Verify ospf neighborship
R2#sh ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DR         00:00:39    192.168.12.1    FastEthernet0/0
4.4.4.4           1   FULL/BDR        00:00:30    192.168.0.2     FastEthernet1/0
R2#

------
R3#sh ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/BDR        00:00:34    192.168.13.1    FastEthernet0/0
5.5.5.5           1   FULL/BDR        00:00:30    192.168.1.2     FastEthernet1/0
  • let's to ping from the PEs
 R2#ping vrf OSPF 4.4.4.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/96/212 ms
R2#
-----------------
R3#ping vrf OSPF 5.5.5.5

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/150/212 ms
R3#
-----------------------

MP-BGP SETTING
■R2
  • let's redistribute bgp into ospf
router ospf 2 vrf OSPF
 log-adjacency-changes
 redistribute bgp 1 subnets

  • let's configure mp-bgp  (includes redistribution of ospf into bgp)
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 1
 neighbor 3.3.3.3 update-source Loopback0
 no auto-summary
 !
! defining the VPN peer

 address-family vpnv4
  neighbor 3.3.3.3 activate
  neighbor 3.3.3.3 send-community both
 exit-address-family
 !

! Redistributing the vrf ospf process into BGP
 address-family ipv4 vrf OSPF
  redistribute ospf 2 vrf OSPF
  no synchronization
 exit-address-family

■R3
  • let's redistribute bgp into ospf  
 router ospf 2 vrf OSPF
 log-adjacency-changes
 redistribute bgp 1 subnets
  •  let's configure mp-bgp  (includes redistribution of ospf into bgp)
 router bgp 1
 no synchronization
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 1
 neighbor 2.2.2.2 update-source Loopback0
 no auto-summary
 !
 address-family vpnv4
  neighbor 2.2.2.2 activate
  neighbor 2.2.2.2 send-community both
 exit-address-family
 !
 address-family ipv4 vrf OSPF
  redistribute ospf 2 vrf OSPF
  no synchronization
 exit-address-family
  • vefication
 -----------------------

R2#sh ip bgp vpnv4 all
BGP table version is 13, 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
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 1:1 (default for vrf OSPF)
*> 4.4.4.0/24       192.168.0.2              2         32768 ?
*>i5.5.5.0/24       3.3.3.3                  2    100      0 ?
*> 192.168.0.0      0.0.0.0                  0         32768 ?
*>i192.168.1.0      3.3.3.3                  0    100      0
?

------
R3#sh ip bgp vp
R3#sh ip bgp vpnv4 all
BGP table version is 13, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 1:1 (default for vrf OSPF)
*>i4.4.4.0/24       2.2.2.2                  2    100      0 ?
*> 5.5.5.0/24       192.168.1.2              2         32768 ?
*>i192.168.0.0      2.2.2.2                  0    100      0 ?
*> 192.168.1.0      0.0.0.0                  0         32768 ?

R3#
-----------
R4#sh ip route
Codes: 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

Gateway of last resort is not set

     4.0.0.0/24 is subnetted, 1 subnets
C       4.4.4.0 is directly connected, Loopback0
     5.0.0.0/24 is subnetted, 1 subnets
O IA    5.5.5.0 [110/3] via 192.168.0.1, 01:14:16, FastEthernet0/0
C    192.168.0.0/24 is directly connected, FastEthernet0/0
O IA 192.168.1.0/24 [110/2] via 192.168.0.1, 01:14:16, FastEthernet0/0

R4#
R4#ping 5.5.5.5

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 144/293/456 ms
R4#

-------------
R5#sh ip route
Codes: 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

Gateway of last resort is not set

     4.0.0.0/24 is subnetted, 1 subnets
O IA    4.4.4.0 [110/3] via 192.168.1.1, 01:14:03, FastEthernet0/0
     5.0.0.0/24 is subnetted, 1 subnets
C       5.5.5.0 is directly connected, Loopback0
O IA 192.168.0.0/24 [110/2] via 192.168.1.1, 01:14:03, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0

R5#
R5#ping 4.4.4.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/157/236 ms
R5#


@@@@@@ COMPLETE CONFIG OF ALL ROUTERS @@@@@@@
■R1
R1#sh run 
Building configuration...

Current configuration : 1032 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
ip domain name lab.local
!

!
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
 ip ospf network point-to-point
!
interface FastEthernet0/0
 ip address 192.168.12.1 255.255.255.0
 duplex auto
 speed auto
 mpls ip
!
interface FastEthernet1/0
 ip address 192.168.13.1 255.255.255.0
 duplex auto
 speed auto
 mpls ip
!
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 network 1.1.1.1 0.0.0.0 area 0
 network 192.168.12.0 0.0.0.255 area 0
 network 192.168.13.0 0.0.0.255 area 0

!
no ip http server
no ip http secure-server
!        
!

!
control-plane
!

!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line vty 0 4
 login
!
!
end
■R2
R2#sh run
Building configuration...

Current configuration : 1562 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
ip domain name lab.local
!
!
ip vrf OSPF
 rd 1:1
 route-target export 1:1
 route-target import 1:1

!
!
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
 ip ospf network point-to-point
!
interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.0
 duplex auto
 speed auto
 mpls ip
!
interface FastEthernet1/0
 ip vrf forwarding OSPF
 ip address 192.168.0.1 255.255.255.0
 duplex auto
 speed auto
!
router ospf 2 vrf OSPF
 log-adjacency-changes
 redistribute bgp 1 subnets
 network 192.168.0.0 0.0.0.255 area 0
!        
router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.12.0 0.0.0.255 area 0
!
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 1
 neighbor 3.3.3.3 update-source Loopback0
 no auto-summary
 !
 address-family vpnv4
  neighbor 3.3.3.3 activate
  neighbor 3.3.3.3 send-community both
 exit-address-family
 !
 address-family ipv4 vrf OSPF
  redistribute ospf 2 vrf OSPF
  no synchronization
 exit-address-family

!        
no ip http server
no ip http secure-server
!

control-plane
!

!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line vty 0 4
 login
!
!
end
■R3
Building configuration...

Current configuration : 1543 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
ip domain name lab.local
!
!
ip vrf OSPF
 rd 1:1
 route-target export 1:1
 route-target import 1:1

!

interface Loopback0
 ip address 3.3.3.3 255.255.255.0
 ip ospf network point-to-point
!
interface FastEthernet0/0
 ip address 192.168.13.2 255.255.255.0
 duplex auto
 speed auto
 mpls ip
!
interface FastEthernet1/0
 ip vrf forwarding OSPF
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
router ospf 2 vrf OSPF
 log-adjacency-changes
 redistribute bgp 1 subnets
 network 192.168.1.0 0.0.0.255 area 0
!        
router ospf 1
 log-adjacency-changes
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.13.0 0.0.0.255 area 0
!
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 1
 neighbor 2.2.2.2 update-source Loopback0
 no auto-summary
 !
 address-family vpnv4
  neighbor 2.2.2.2 activate
  neighbor 2.2.2.2 send-community both
 exit-address-family
 !
 address-family ipv4 vrf OSPF
  redistribute ospf 2 vrf OSPF
  no synchronization
 exit-address-family

!
no ip http server
no ip http secure-server
!
!
control-plane
!

line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line vty 0 4
 login
!
!
end
■R4
R4#sh run
Building configuration...

Current configuration : 881 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R4
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
ip domain name lab.local
!
!

!        
interface Loopback0
 ip address 4.4.4.4 255.255.255.0
 ip ospf network point-to-point
!        
interface FastEthernet0/0
 ip address 192.168.0.2 255.255.255.0
 duplex auto
 speed auto
!        
router ospf 1
 router-id 4.4.4.4
 log-adjacency-changes
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.0.0 0.0.0.255 area 0

!        
no ip http server
no ip http secure-server
!        

!        
control-plane
!        

!        
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line vty 0 4
 login   
!        
!        
end
R5

Building configuration...

Current configuration : 881 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R5
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
ip domain name lab.local
!
!
!
interface Loopback0
 ip address 5.5.5.5 255.255.255.0
 ip ospf network point-to-point
!
interface FastEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto
!
router ospf 1
 router-id 5.5.5.5
 log-adjacency-changes
 network 5.5.5.5 0.0.0.0 area 0
 network 192.168.1.0 0.0.0.255 area 0

!
no ip http server
no ip http secure-server
!
!
!
control-plane
!
!        
!
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line vty 0 4
 login
!
!
end



No comments:

Post a Comment