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



Wednesday 28 November 2012

vrf ( static , eigrp , ospf and rip )

In this tutorial , I will cover vrf(virtual routing and forwarding) implementation and verification in static and dynamic routing.

TOPOLOGY


■STATIC router CONFIG

 interface Loopback0
 ip address 10.1.1.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto

ip route 0.0.0.0 0.0.0.0 192.168.1.1

■RIP router CONFIG

interface Loopback0
 ip address 40.40.40.40 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto
!
router rip
 network 40.0.0.0
 network 192.168.1.0

■EIGRP router CONFIG

interface Loopback0
 ip address 30.30.30.30 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto
!
router eigrp 1
 network 30.0.0.0
 network 192.168.1.0

■OSPF router CONFIG

interface Loopback0
 ip address 20.20.20.20 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto
!
router ospf 1
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0

■R1 CONFIG

 ip vrf EIGRP
!
ip vrf OSPF
!
ip vrf RIP
!
ip vrf STATIC

!
interface Loopback1
 ip vrf forwarding RIP

 ip address 1.1.1.1 255.255.255.255
!
interface Loopback2
 ip vrf forwarding EIGRP

 ip address 2.2.2.2 255.255.255.255
!
interface Loopback3
 ip vrf forwarding OSPF

 ip address 3.3.3.3 255.255.255.255
!
interface Loopback4
 ip vrf forwarding STATIC

 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/3
 no switchport
 ip vrf forwarding OSPF
 ip address 192.168.1.1 255.255.255.0
!
interface FastEthernet1/0
 ip vrf forwarding EIGRP
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet2/0
 ip vrf forwarding STATIC

 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet3/0
 ip vrf forwarding RIP

 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
router eigrp 1
 auto-summary
 !
 address-family ipv4 vrf EIGRP

  network 2.0.0.0
  network 192.168.1.0
  auto-summary
  autonomous-system 1
 exit-address-family
!
router ospf 1 vrf OSPF
 log-adjacency-changes
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.1.1 0.0.0.0 area 0
!
router rip
 !
 address-family ipv4 vrf RIP

  network 1.0.0.0
  network 192.168.1.0
  no auto-summary
 exit-address-family
!
ip route vrf STATIC 10.1.1.1 255.255.255.255 192.168.1.2
!

VERIFICATION

Verification on R1
***** STATIC

R1#sh ip route vrf STATIC

Routing Table: STATIC
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/32 is subnetted, 1 subnets
C       4.4.4.4 is directly connected, Loopback4
     10.0.0.0/32 is subnetted, 1 subnets
S       10.1.1.1 [1/0] via 192.168.1.2
C    192.168.1.0/24 is directly connected, FastEthernet2/0
R1#ping vrf STATIC 10.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/49/128 ms
R1#

**** RIP

R1#sh ip route vrf RIP

Routing Table: RIP
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

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback1
R    40.0.0.0/8 [120/1] via 192.168.1.2, 00:00:26, FastEthernet3/0
C    192.168.1.0/24 is directly connected, FastEthernet3/0
R1#
R1#
R1#ping vrf RIP 40.40.40.40

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 40.40.40.40, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/30/88 ms
R1#


**** EIGRP
R1#sh ip route vrf EIGRP

Routing Table: EIGRP
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

     2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       2.2.2.2/32 is directly connected, Loopback2
D       2.0.0.0/8 is a summary, 00:32:30, Null0
C    192.168.1.0/24 is directly connected, FastEthernet1/0
D    30.0.0.0/8 [90/156160] via 192.168.1.2, 00:32:17, FastEthernet1/0
R1#
R1#ping vrf EIGRP 30.30.30.30

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 30.30.30.30, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/43/100 ms
R1#


**** OSPF

R1#sh ip route vrf OSPF

Routing Table: OSPF
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

     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback3
     20.0.0.0/32 is subnetted, 1 subnets
O       20.20.20.20 [110/2] via 192.168.1.2, 00:49:42, FastEthernet0/3
C    192.168.1.0/24 is directly connected, FastEthernet0/3
R1#
R1#ping vrf OSPF 20.20.20.20

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 20.20.20.20, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/52/100 ms
R1#

Verification on STATIC router
 STATIC#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 192.168.1.1 to network 0.0.0.0

     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
S*   0.0.0.0/0 [1/0] via 192.168.1.1
STATIC#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 = 12/60/116 ms
STATIC#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)
STATIC#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:
U.U.U
Success rate is 0 percent (0/5)
STATIC#ping 1.1.1.1

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

Verification on RIP router
 RIP#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

R    1.0.0.0/8 [120/1] via 192.168.1.1, 00:00:17, FastEthernet0/0
     40.0.0.0/32 is subnetted, 1 subnets
C       40.40.40.40 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
RIP#ping 1.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/49/100 ms
RIP#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 0 percent (0/5)
RIP#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:
.....
Success rate is 0 percent (0/5)
RIP#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 0 percent (0/5)
RIP#

Verification on EIGRP router
 EIGRP#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

D    2.0.0.0/8 [90/156160] via 192.168.1.1, 00:37:00, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
     30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       30.30.30.30/32 is directly connected, Loopback0
D       30.0.0.0/8 is a summary, 00:43:47, Null0
EIGRP#ping 1.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
EIGRP#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 = 12/43/108 ms
EIGRP#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:
.....
Success rate is 0 percent (0/5)
EIGRP#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 0 percent (0/5)
EIGRP#

Verification on OSPF router
 OSPF#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

     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 192.168.1.1, 00:55:35, FastEthernet0/0
     20.0.0.0/32 is subnetted, 1 subnets
C       20.20.20.20 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
OSPF#ping 1.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
OSPF#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 0 percent (0/5)
OSPF#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:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/55/152 ms
OSPF#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 0 percent (0/5)
OSPF#


OTHER VERIFICATION COMMANDS

  • sh ip vrf [ interfaces | brief ]
  • sh ip eigrp vrf EIGRP neigh
  • sh ip ospf nei
  • sh ip rip nei 









Monday 26 November 2012

EEM(Embedded Event Manager) example ..automatically reenable an interface

Embedded Event Manager(EEM) is a scripting language in cisco devices that will allow you to automate some actions inside the devices.
In this example I'm trying to enable an interface that has been shutdown for some reasons.


TOPOLOGY


CONFIGURATION

■R1 CONFIG
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0

event manager applet NOSHUT
 event syslog pattern ".*FastEthernet0/0.*down.*"
 action 1.0 cli command "enable"
 action 2.0 cli command "conf t"
 action 3.0 cli command "interface fastEthernet 0/0"
 action 4.0 cli command "no shutdown"

■R2 CONFIG
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto
!
router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0

■CHECK(let 's shutdown f0/0 and see what's happening in the background)

 R1#debug event manager action cli
Debug EEM action cli debugging is on
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#do sh ip int br
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.1     YES manual up                    up
Loopback0                  1.1.1.1         YES manual up                    up
R1(config-if)#shut
R1(config-if)#
*Mar  1 01:06:21.399: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Mar  1 01:06:21.463: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : CTL : cli_open called.
*Mar  1 01:06:21.567: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : OUT :
*Mar  1 01:06:21.571: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : OUT : R1>
*Mar  1 01:06:21.571: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : IN  : R1>enable
*Mar  1 01:06:21.587: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : OUT :
*Mar  1 01:06:21.587: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : OUT : R1#
*Mar  1 01:06:21.587: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : IN  : R1#conf t
*Mar  1 01:06:21.611: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : OUT :
*Mar  1 01:06:21.611: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : OUT : Enter configuration commands, one per line.  End with CNTL/Z.
*Mar  1 01:06:21.611: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : OUT : R1(config)#
*Mar  1 01:06:21.61
R1(config-if)#5: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : IN  : R1(config)#interface fastEthernet 0/0
*Mar  1 01:06:21.731: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : OUT :
*Mar  1 01:06:21.731: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : OUT : R1(config-if)#
*Mar  1 01:06:21.735: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : IN  : R1(config-if)#no shutdown
*Mar  1 01:06:21.779: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : OUT :
*Mar  1 01:06:21.779: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : OUT : R1(config-if)#
*Mar  1 01:06:21.779: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : IN  : R1(config-if)#exit
*Mar  1 01:06:21.783: %HA_EM-6-LOG: NOSHUT : DEBUG(cli_lib) : : CTL : cli_close called.
*Mar  1 01:06:21.807: %SYS-5-CONFIG_I: Configured from console by vty0
R1(config-if)#do sh ip int br
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.1     YES manual up                    up
Loopback0                  1.1.1.1         YES manual up                    up
R1(config-if)#
*Mar  1 01:06:27.007: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
R1(config-if)#




 As you can see in 6seconds OSPF was up after a moment.