Showing posts with label authentication. Show all posts
Showing posts with label authentication. Show all posts

Thursday, February 6, 2014

NTS: PPP/Serial/POS

PPP/Serial/POS




PPP (Point-to-Point Protocol) is defined in RFC 1661.
PPPoE (PPP over Ethernet) is described in RFC 2516.



Serial

Don't forget to to set the clock rate (i.e. 64000) on the DCE interface (usually the one on the service provider router).



PPP

You can use "no peer neighbor route" in order to disable creating a /32 for the peer address.




Multilink PPP

R1 (IOS)
interface Serial2/0
 encapsulation ppp
 ppp multilink
 ppp multilink group 1
 clock rate 64000
!

interface Multilink1
 ip address 12.12.12.1 255.255.255.0
 ppp multilink
 ppp multilink group 1



R2 (IOS)
interface Serial0/0
 encapsulation ppp
 ppp multilink
 ppp multilink group 1

!
interface Multilink1
 ip address 12.12.12.2 255.255.255.0
 ppp multilink
 ppp multilink group 1





Multichassis Multilink PPP

SGBP is used between routers to coordinate them for multilink ppp termination.

R4 (IOS)
sgbp group SGBP-GRP
sgbp member R5 5.5.5.5
sgbp source-ip 4.4.4.4

!
username SGBP-GRP password 0 SGBP-PASS

!
multilink virtual-template 1
!
interface Virtual-Template1
 ip unnumbered Loopback0
 ppp multilink
 


R5 (IOS)
sgbp group SGBP-GRP
sgbp member R4 4.4.4.4
sgbp source-ip 5.5.5.5
username SGBP-GRP password 0 SGBP-PASS

!
multilink virtual-template 1
!
interface Virtual-Template1
 ip unnumbered Loopback0
 ppp multilink



IOS
R4#sh sgbp
Group Name: SGBP-GRP Ref: 0xDE80000
Seed bid: default, 50, default seed bid setting

  Member Name: R5 State: active Id: 1
  Ref: 0xABC0000
  Address: 5.5.5.5
  Other Active Address: 20.4.5.5





PPPoE

IOS

PPPoE server
bba-group pppoe global
 virtual-template 1
!
interface Virtual-Template1
 mtu 1492
 ip address 10.10.10.1 255.255.255.0

!
interface X
 pppoe enable group global


PPPoE client
interface X
 pppoe enable
 pppoe-client dial-pool-number 1
!
interface Dialer1
 mtu 1492
 ip address 10.10.10.2 255.255.255.0
 encapsulation ppp

 dialer pool 1

Interface X is assumed to be an ethernet interface.

You must define "encapsulation ppp" under the dialer, otherwise the ppp call won't happen.

Not all routers support the PPPoE functionality.

PPPoE server/client is not supported on IOS-XR of C12k.



PPP Authentication

IOS

Server
username USERNAME password PASSWORD
!
interface POS2/0
 encapsulation ppp
 ppp authentication chap


Client
interface POS2/0
 encapsulation ppp
 ppp chap hostname USERNAME
 ppp chap password PASSWORD



If you don't define a chap hostname, then the router's name is used as the username.

In the following example the first router authenticates the second using CHAP (encrypted), while the second router authenticates the first using PAP (cleartext).

IOS

Server & Client #1
username R2-USER password R2-PASS
!
interface POS2/0
 encapsulation ppp
 ppp authentication chap
 ppp pap sent-username R1-USER password R1-PASS



Server & Client #2
username R1-USER password R1-PASS
!
interface POS2/0
 encapsulation ppp
 ppp authentication pap

 ppp chap hostname R2-USER
 ppp chap password R2-PASS





POS (Packet over SONET/SDH)
 
POS default MTU is 4470.

MPLS-TE isn't supported on POS frame-relay subinterfaces on C12k running IOS-XR.



POS Configuration

You will find most configurations parameters under the following command:

IOS
R1(config-if)#pos ?
  ais-shut      Send LAIS when shutdown
  delay         Delay POS alarm triggers
  flag          Specify byte value
  framing       specify framing
  report        enable reporting of selected alarms
  scramble-atm  Enable POS SPE scrambling
  threshold     Set BER threshold values



Verification checks can be performed with:

IOS
R1#sh controllers pos2/0
POS2/0
SECTION
  LOF = 0          LOS    = 0                            BIP(B1) = 0
LINE
  AIS = 0          RDI    = 0          FEBE = 0          BIP(B2) = 0
PATH
  AIS = 0          RDI    = 0          FEBE = 0          BIP(B3) = 0
  PLM = 0          UNEQ   = 1          TIM  = 0          TIU     = 0
  LOP = 0          NEWPTR = 0          PSE  = 0          NSE     = 0

Active Defects: PUNEQ
Active Alarms:  None
Alarm reporting enabled for: SF SLOS SLOF B1-TCA B2-TCA PLOP B3-TCA

Framing: SONET
APS

  COAPS = 0          PSBF = 0
  State: PSBF_state = False
  Rx(K1/K2): 00/00  Tx(K1/K2): 00/00
  S1S0 = 00, C2 = 00
  Remote aps status (none); Reflected local aps status (none)
CLOCK RECOVERY
  RDOOL = 0
  State: RDOOL_state = False
PATH TRACE BUFFER: STABLE
  Remote hostname :
  Remote interface:
  Remote IP addr  :
  Remote Rx(K1/K2):   /    Tx(K1/K2):   /

BER thresholds:  SF = 10e-3  SD = 10e-6
TCA thresholds:  B1 = 10e-6  B2 = 10e-6  B3 = 10e-6

  Clock source:  line



Don't expect all things to work in GNS3.



Keepalives

The keepalive command applies to serial interfaces using HDLC or PPP encapsulation. It does not apply to serial interfaces using Frame Relay encapsulation.

Keepalives are independent between the two peers. One peer end can have keepalives enabled; the other end can have them disabled. Even if keepalives are disabled locally, LCP still responds with ECHOREP packets to the ECHOREQ packets it receives.



CRC

The cyclic redundancy check (CRC) on a serial interface defaults to a length of 16 bits. You can change it to 32 bits.


IOS 
interface POS2/0
 crc 32


IOS
R1#sh int pos2/0
POS2/0 is up, line protocol is up
  Hardware is Packet over Sonet
  Internet address is 10.10.10.1/24
  MTU 4470 bytes, BW 155000 Kbit/sec, DLY 100 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation HDLC, crc 32, loopback not set

 




POS Channel

POS channel link bundling provides load-balancing across all active links in a bundle.


IOS
interface pos-channel 1
 ip address 30.30.30.1 255.255.255.0
!
interface pos2/0
 channel-group 1
!
interface pos3/0
 channel-group 1


POS link bundling is supported on very specific hardware.



APS

The APS feature provides redundancy and allows for a switchover of POS circuits in the event of circuit failure.

You configure a pair of SONET/SDH lines for line redundancy. When the Working (W) interface fails, the Protect (P) interface quickly assumes the traffic load (usual swichover time is 50 ms)

Most configuration options are found under the "aps" command:

IOS
R1(config-if)#aps ?
  authentication  Authentication string
  force           Force channel
  group           Group association
  lockout         Lockout protection channel
  manual          Manually switch channel
  protect         Protect specified circuit
  reflector       Configure for reflector mode APS
  revert          Specify revert operation and interval
  signalling      Specify SONET/SDH K1K2 signalling
  timers          APS timers
  unidirectional  Configure for unidirectional mode
  working         Working channel number



Configuration

IOS
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface POS2/0
 ip address 10.10.10.1 255.255.255.0
 aps group 10
 aps working 1
!

interface POS3/0
 ip address 20.20.20.1 255.255.255.0
 aps group 10
 aps protect 1 1.1.1.1
 aps revert 1


You need the configure a similar setup on the peer router too.

You can have the Working and Protect interfaces on different routers and they will communicate each other using PGP (Protect Group Protocol), which runs over UDP.

IOS
R1#sh aps
POS3/0 APS Group 10: protect channel 0 (Inactive)
        Working channel 1 at 1.1.1.1 (Enabled)
        bidirectional, revertive (60 seconds)
        PGP timers (default): hello time=1; hold time=3
                hello fail revert time=120
        SONET framing; SONET APS signalling by default
        Received K1K2: 0x00 0x00
                No Request (Null)
        Transmitted K1K2: 0x00 0x05
                No Request (Null)
        Remote APS configuration: (null)

POS2/0 APS Group 10: working channel 1 (Active)
        Protect at 1.1.1.1
        PGP timers (from protect): hello time=1; hold time=3
        SONET framing
        Remote APS configuration: (null)


You need an ADM between the routers for the K1/K2 signals to work.



NTS: OSPFv2/OSPFv3

OSPFv2/OSPFv3




OSPFv2 (Open Shortest Path First v2) is defined in RFC 2328.
OSPFv3 is defined in RFC 5340.
OSPFv2 as PE/CE protocol is defined in RFC 4577.



OSPF is protocol 89.

Sends updates to multicast 224.0.0.5 (all OSPF routers) and 224.0.0.6 (all DR routers)



Adjacencies

Adjacency can be formed between different networks if "ip unnumbered" is used on both sides.

If multiple "network" commands are used, the most specific wins.

The following must match for adjacency to be successful:
  • area
  • hello/dead timers
  • mtu
  • network type
  • stub
  • authentication

DR election per network type
  • DR/BDR
    • broadcast (default on ethernet, multicast hellos)
    • non-broadcast (default on frame-relay, unicast hellos)
  • no DR/BDR
    • point-to-point (default on serial/pos, multicast hellos)
    • point-to-multipoint (multicast hellos)
    • point-to-multipoint non-broadcast (unicast hellos)

Use the "neighbor" command to send unicast hellos.

You can use the commands "ip ospf hello-interval" and "ip ospf dead-interval" in order to tune the convergence time. Fast hellos (1 sec) are also possible using the "minimal" keyword.



By default the loopback interface is advertised as a /32 (stub). Use network-type point-to-point under the loopback interface to advertise it with the original subnet mask.



Path Selection

  • "bandwidth" under the interface (not applicable to IOS-XR)
  • "ip ospf cost" under the interface
  • "auto-cost reference-bandwidth" under the ospf process
  • "neighbor x.x.x.x cost" under the ospf process



OSPF Route Preference

O - OSPF (intra-area)
IA - OSPF inter area
E1 - OSPF external type 1
E2 - OSPF external type 2
N1 - OSPF NSSA external type 1
N2 - OSPF NSSA external type 2
      
Distance and metric are evaluated as a second step, between routes of same type.



LSAs

LSA types carried in IPv6 Stub areas:
  • Router-LSAs
  • Network-LSAs
  • Inter-Area-Prefix-LSAs
  • Link-LSAs
  • Intra-Area-Prefix-LSAs

LSA types carried in IPv6 NSSA areas:
  • Router-LSAs
  • Network-LSAs
  • Inter-Area-Prefix-LSAs
  • Link-LSAs
  • Intra-Area-Prefix-LSAs
  • NSSA-LSAs

LSA types carried in IPv4 Stub areas:
  • Router-LSAs
  • Network-LSAs
  • Summary-LSAs

LSA types carried in IPv4 NSSA areas:
  • Router-LSAs
  • Network-LSAs
  • Summary-LSAs
  • NSSA-LSAs




NSSA

The NSSA ASBR redistributes routes into OSPF and originates the Type-7 LSAs.

Type-7 LSAs are only flooded within the originating NSSA area.

Type-7 LSAs have a propagate (P) bit that, when set, tells an NSSA ABR to translate a Type-7 LSA into a Type-5 LSA.

The NSSA ABR translates Type-7 LSAs into Type-5 LSAs and floods them into area 0.

If there are multiple NSSA ABRs, the router with the highest Router ID is elected as the translator.

The NSSA ASBR and the NSSA ABR can be the same router.

Preference between two Type-7 LSAs is determined by the following tie breaker rules:
  • An LSA with the P-bit set is preferred over one with the P-bit clear
  • If the P-bit settings are the same, the LSA with the higher router ID is preferred

Links



LSDB optimization

You can decrease the LSA DB size by doing one or more of the following:
  • configure interfaces as unnumbered
  • remove network LSAs (caused by DRs) by using point-to-point as network type on interfaces
  • remove transit prefixes by activating prefix-suppression 

Prefixes that will be removed by prefix-suppression can be found under "Link connected to: a Stub Network" in Router LSAs (loopbacks, secondary IPs and passive interfaces are excluded).



LSA flood-reduction

OSPF requires every LSA to be refreshed by default every 1800 seconds (30 mins) or else the LSA will expire when it reaches 3600 seconds (1 hour).

When flood-reduction is enabled on a router (towards a neighbor), then this router will flood its self-originated LSAs with the DoNotAge (DNA) bit set, so they do not have to be re-flooded every 30 mins. Of course any change in the contents of the LSA will cause the new LSA to be re-flooded (again with the DoNotAge bit set).

IOS
interface X
 ip ospf flood-reduction
 ipv6 ospf flood-reduction


IOS-XR
router ospf X
 flood-reduction enable
 area 0
  flood-reduction enable
  interface X
   flood-reduction enable



In IOS-XR, flood-reduction can be configured under the ospf process, under a specific area and under a specific interface.

Prefer to enable it on stable topologies.

The demand-circuit offers the same functionality plus the suppression of periodic hello packets.

Links



Route Filtering

  • distribute-list
    • in: filter the routes from entering the RIB
    • out: filter the redistributed routes (E1/E2) entering OSPF on an ASBR
  • stub area
    • stub (filter LSA-5)
    • totally stub (filter LSA-3/4/5)
    • nssa (filter LSA-5, allow LSA-7)
    • totally nssa (filter LSA-3/4/5, allow LSA-7)
  • LSA-3 prefix filter
    • "area x filter-list prefix x"



LSA Searching

Depending on what type of LSAs you're searching for, you can use the following commands to do so:

IOS
sh ip ospf database router | i Link State ID  
  Link State ID: x.x.x.x
 

sh ip ospf database network | i Link State ID
  Link State ID: x.x.x.x (address of Designated Router) 

sh ip ospf database summary | i Link State ID
  Link State ID: x.x.x.x (Summary Network Number)
 
sh ip ospf database asbr-summary | i Link State ID
  Link State ID: x.x.x.x (AS Boundary Router address)

sh ip ospf database external | i Link State ID
  Link State ID: x.x.x.x (External Network Number)
 


IOS-XR
sh ospf database router | i Link State ID
  Link State ID: x.x.x.x
 

sh ospf database network | i Link State ID
  Link State ID: x.x.x.x (address of Designated Router)

sh ospf database summary | i Link State ID
  Link State ID: x.x.x.x (Summary Network Number)
 

sh ospf database asbr-summary | i Link State ID
  Link State ID: x.x.x.x (AS Boundary Router address)

sh ospf database external | i Link State ID
  Link State ID: x.x.x.x (External Network Number)


Searching for IPv6 is a little bit different, because the IPv6 prefix information is stored in another attribute.




Summarization

  • Type-3 summary
    • at ABR
    • area x range 10.10.10.0 255.255.255.0 (IOS)
    • area 1 range 10.10.10.0/24 (IOS-XR)
  • Type-5 summary
    • at ASBR
    • summary-address 20.20.20.0 255.255.255.0 (IOS)
    • summary-prefix 20.20.20.0/24 (IOS-XR)

Both types of summarization can also accept "not-advertise" as parameter.

Sub-routes must pre-exist in order for the summaries to be advertised.



OSPFv3

Multicast addresses have become FF02::x from 224.0.0.x (where x=5 for all OSPF routers, or x=6 for all DR routers).

If there is no IPv4 address assigned to any interface, then you must manually configure an IPv4-formatted router-id under the OSPFv3 process.

OSPFv3 runs per-link instead of per-subnet.

You cannot automatically detect OSPFv3 neighbors when using NBMA interfaces. You must manually configure your router to detect neighbors when using an NBMA interface.

All manually configured neighbors in OSPFv3 must be identified by their link-local IPv6 address.

On all OSPFv3 interfaces except virtual links, OSPFv3 packets are sent using the interface's associated link-local unicast address as the source address.

On virtual links, a global scope IPv6 address must be used as the source address for OSPFv3 packets.

Router-LSAs (Type-1) and Network-LSAs (Type-2) no longer contain network addresses, but simply express topology information.

Link-LSAs (Type-8) include the prefixes which are configured on links and are flooded only on local-link scope. Link-local addresses appear only in Link-LSAs.

For Stub areas, the Inter-area Prefix LSA can only be a default route.
For NSSA areas, the AS-External LSA can also be a default route.


IOS
ipv6 router ospf 1
 router-id 2.2.0.2 
!
interface Ethernet1/0
 ipv6 ospf 1 area 0



IOS-XR
router ospfv3 1
 router-id 2.2.0.8
 address-family ipv6 unicast
 area 0
  interface Loopback0
   passive
  !
  interface GigabitEthernet0/2/1/1



A use for running multiple OSPFv3 instances is to have a single link belong to two or more OSPFv3 areas.
Also on a LAN you can have multiple adjacencies between different routers, each one on a separate OSPFv3 process/instance.



OSPFv2 Authentication

  • Null (Type 0)  - default
  • Plain-text (Type 1)
  • MD5 (Type 2)

In IOS, you can configure the authentication type under the ospf process or under the interface.

IOS
router ospf 1
 area 0 authentication
!
interface X
 ip ospf authentication
 ip ospf authentication-key xxx


IOS
router ospf 1
 area 0 authentication message-digest
!

interface X
 ip ospf authentication message-digest
 ip ospf message-digest-key 1 md5 xxx


In IOS-XR, you can configure the authentication type/key under the ospf process, under the area or under the interface.

IOS-XR
router ospf 1
 authentication-key xxx
 authentication
 area 0
  authentication-key xxx
  authentication
  interface X
   authentication-key xxx
   authentication



IOS-XR
router ospf 1
 authentication message-digest
 message-digest-key 1 md5 xxx

  area 0
  authentication message-digest
  message-digest-key 2 md5 xxx

  interface X   authentication message-digest
   message-digest-key 3 md5 xxx



You can always use various combination of enabling authentication for a specific area (under the ospf process) or for a specific adjacency (under the interface).

More specific configurations override the less specific ones.



OSPFv3 Authentication

You can configure an authentication (AH) or encryption (ESP) policy, either on an interface or for an OSPFv3 area/process.

IPSec AH
  • Authentication
    • MD5
    • SHA1

IPSec ESP
  • Encryption
    • 3DES
    • AES (128,192,256 bits)
    • DES
    • NULL
  • Authentication
    • MD5
    • SHA1

To use the IPsec AH (for authentication), you must use commands with the "authentication" keyword.

To use the IPsec ESP (for authentication & confidentiality), you must use commands with the "encryption" keyword.

ESP may use encryption and authentication or only authentication (when encryption=null), but is not recommended.


IOS
ipv6 router ospf 1
 area 0 authentication ipsec spi 256 md5 yyy

 area 0 encryption ipsec spi 256 esp 3des md5 yyy
!
interface X
 ipv6 ospf authentication ipsec spi 256 md5 zzz
 ipv6 ospf encryption ipsec spi 256 esp 3des md5 zzz

 
IOS > 12.3(4)T is required for OSPFv3 IPsec authentication.


IOS-XR
router ospfv3 1
 authentication ipsec spi 256 md5 password xxx
 encryption ipsec spi 256 esp 3des password xxx

!
 area 0

  authentication ipsec spi 256 md5 password yyy
  encryption ipsec spi 256 esp 3des password yyy

!
  interface GigabitEthernet0/2/1/1.78
   authentication ipsec spi 256 md5 password zzz
   encryption ipsec spi 256 esp 3des password zzz



More specific configurations override the less specific ones.

Links



Options Bits

Hello/DBD/LSA Options Bits
  • V6 bit: It should be set, unless the router will not participate in IPv6 topology calculation and IPv6 transit routing. If this bit is clear, the router/link should be excluded from any IPv6 routing calculations.
  • R bit: It should be set, unless the router will not participate in any transit routing. It allows the router to participate in the unicast topology, but does not allow transit traffic.
  • E bit: It should be set if the interface attaches to a regular area (i.e., not a stub or NSSA area).
  • N bit: It should be set if the interface attaches to an NSSA area.
  • DC bit: This bit describes the router's handling of demand circuits. It should be set in Hellos/DBDs if the router wishes to suppress the sending of future Hellos over the interface. It should be set in LSAs, if the router can correctly process the DoNotAge bit when it appears in the LS age field of LSAs.

IPv6 Prefix Options Bits
  • NU bit: The "No Unicast" capability bit. If set, the prefix should be excluded from IPv6 unicast calculations. If not set, it should be included.
  • LA bit: The "Local Address" capability bit. If set, the prefix is actually an IPv6 interface address of the Advertising Router.
  • P bit: The "Propagate" bit. Set on NSSA area prefixes that should be readvertised by the translating NSSA area border.
  • DN bit: The "Down" bit. This bit controls an inter-area-prefix-LSAs or AS-external-LSAs re-advertisement in a VPN environment. It is used for loop prevention in PE=>CE=>PE advertisements and should not be checked in CE multi-vrf (vrf-lite) scenarios.



Special multi-hop adjacencies
  • virtual-link
    • connects two areas 0 or extends area 0 across a transit area
    • uses a transit area in order to connect areas 0 or extend area 0
    • used in normal environments with multiple areas 0 or area 0 extension
    • configured betweens two ABRs under the OSPF process
  • sham-link
    • connects two areas X (including 0)
    • uses the MPLS core in order to connect the areas
    • used in MPLS VPN environments with backdoor links
    • configured betweens two PEs/ABRs under the OSPF vrf process

Virtual-Link

All areas in an OSPF autonomous system must be connected to area 0. When this is not possible in terms of direct connectivity, then a virtual-link can be used in order to connect the non-backbone areas to area 0, as long as there is a common area between them.

  • connect two areas 0
    • R1 <=(area 0)=> R2 <=(area 1)=> R3 <=(area 0)=> R4
    • a virtual link can be configured between ABRs R2,R3 that connect to area 0 from different sides and have a common area between them
  • extend area 0 
    • R1 <=(area 0)=> R2 <=(area 1)=>R3 <=(area 2)=> R4
    • a virtual link can be configured between ABRs R2,R3 that connect to a common area, with only one ABR directly connected to area 0.
    • area 0 is extended to R3, in order to serve area 2
If a common area does not exist between the ABRs, then an additional area can be created to become the transit area.

The transit area through which the virtual link is configured, must have full routing information, so it cannot be any type of stub area. If this is the case, a GRE tunnel can be used to connect the two areas 0.


For virtual-links in OSPFv3 you have to use the remote neighbor's router-id (IPv4 format).

ABR #1

IOS
router ospf 1
 area 1 virtual-link 2.2.2.2

IOS-XR
router ospf 1
 area 1

  virtual-link 2.2.2.2


ABR #2

IOS
router ospf 1
 area 1 virtual-link 3.3.3.3

IOS-XR
router ospf 1
 area 1

  virtual-link 3.3.3.3


Sham-Link

To make a route through an MPLS backbone appear to be an intra-area route, it is necessary to make it appear as if there is an intra-area link connecting the two PE routers. A sham link can be thought of as a indirect relation between two VRFs.  If two VRFs are to be connected by a sham link, each VRF must be associated with a "Sham Link Endpoint Address", a 32-bit IPv4 address that is treated as an address of the PE router containing that VRF.

The Sham Link Endpoint Address is an address in the VPN's address space, not the SP's address space.  It must not be advertised inside customer's OSPF, because when there is no BGP VPNv4 route to the Sham Link Endpoint Address, that address must become unreachable, so that the sham link comes down.

The sham link is an unnumbered point-to-point intra-area link and is advertised as a type 1 LSA.

Sham links are treated as OSPF Demand Circuits. This means that LSAs will be flooded over them, but periodic refresh traffic will be avoided. Normal flooding is done over the backdoor link, but if that fails, flooding will occur over the sham-link (because LSA synchronization between sites must continue).

Configuration Steps
  • Create a /32 loopback that belongs to the relevant VRF on both PEs
  • Advertise the above /32 into BGP VPNv4 on both PEs
  • Don't advertise the above /32 into the OSPF vrf process on both PEs
  • Create a sham-link between the above /32 of the PEs under the OSPF vrf process

PE1

IOS
interface Loopback1
 vrf forwarding VPN
 ip address 1.1.1.1 255.255.255.255
!

router ospf 100 vrf VPN
 area 0 sham-link 1.1.1.1 2.2.2.2


IOS-XR
interface Loopback1
 vrf VPN

 ipv4 address 1.1.1.1/32
!
router ospf 100
 vrf VPN
  area 0
   sham-link 1.1.1.1 2.2.2.2



PE2

IOS
interface Loopback1
 vrf forwarding VPN
 ip address 2.2.2.2 255.255.255.255

!
router ospf 100 vrf VPN
 area 0 sham-link 2.2.2.2 2.1.1.1


IOS-XR
interface Loopback1
 vrf VPN

 ipv4 address 2.2.2.2/32
!

router ospf 100
 vrf VPN
  area 0
   sham-link 2.2.2.2 1.1.1.1



Verification

IOS
R1#sh ip ospf sham-links
Sham Link OSPF_SL0 to address 2.2.2.2 is up
Area 0 source address 1.1.1.1
  Run as demand circuit
  DoNotAge LSA allowed. Cost of using 1 State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40,
    Hello due in 00:00:04
    Adjacency State FULL (Hello suppressed)
    Index 2/2, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec



R1#sh ip ospf interface | b _SL
OSPF_SL0 is up, line protocol is up
  Internet Address 0.0.0.0/0, Area 0
  Process ID 100, Router ID 10.10.10.1, Network Type SHAM_LINK, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           1         no          no            Base
  Configured as demand circuit.
  Run as demand circuit.
  DoNotAge LSA allowed.
  Transmit Delay is 1 sec, State POINT_TO_POINT
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:06
  Supports Link-local Signaling (LLS)
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
  Index 2/2, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 1
  Last flood scan time is 0 msec, maximum is 4 msec
  Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 10.10.10.2  (Hello suppressed)
  Suppress hello for 1 neighbor(s)



R1#sh ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
...
10.10.10.2        0   FULL/  -           -        2.2.2.2
         OSPF_SL0
...


R1#sh ip ospf neighbor detail | b 2.2.2.2
 Neighbor 10.10.10.2, interface address 2.2.2.2
    In the area 0 via interface OSPF_SL0
    Neighbor priority is 0, State is FULL, 6 state changes
    DR is 0.0.0.0 BDR is 0.0.0.0
    Options is 0x32 in Hello (E-bit, L-bit, DC-bit)
    Options is 0x72 in DBD (E-bit, L-bit, DC-bit, O-bit)
    LLS Options is 0x1 (LR)
    Neighbor is up for 00:12:16
    Index 2/2, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec



IOS-XR
GSR#sh ospf vrf VPN sham-links

Sham Links for OSPF 2, VRF VPN

Sham Link OSPF_SL0 to address 2.2.2.2 is up
Area 0, source address 1.1.1.1
IfIndex = 2
  Run as demand circuit
  DoNotAge LSA allowed., Cost of using 1
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:08
    Adjacency State FULL (Hello suppressed)
    Number of DBD retrans during last exchange 0
    Index 2/2, retransmission queue length 0, number of retransmission 0
    First 0(0)/0(0) Next 0(0)/0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec



Both sham-links and virtual-links can have most of their "interface" attributes (hellos, cost, authentication, etc.) configured (IOS-XR gives more options).

The OSPF Sham Link endpoint address must not be used as the endpoint address of an OSPF Virtual Link.



OSPF Multi-Area

Applicable to OSPFv2 and OSPFv3.

It allows a link to be configured in more than one area, so that the link could be considered as an intra-area link in all those areas and get preference over inter-area links.

It exists as a logical construct over an existing primary interface for OSPF; however, the neighbor state on the primary interface is independent of the multi-area interface.

Only point-to-point adjacencies are supported.

IOS
interface Ethernet 0/0
 ip ospf 1 area 0
 ip ospf multi-area 1


IOS-XR
router ospf 1
 area 0
  interface GigabitEthernet0/2/1/2
 area 1
  multi-area-interface GigabitEthernet0/2/1/2
 area 2
  multi-area-interface GigabitEthernet0/2/1/2


The multi-area interface inherits the interface characteristics from its primary interface, but some interface characteristics can be configured under the multi-area interface configuration.

It also inherits the BFD characteristics from its primary interface.




OSPF Multiple-instance

Both IOS and IOS-XR allows you to run multiple OSPFv3 instances. Peer routers need to use the same instance-id for ospfv3 communication to happen.

Also, OSPFv3 can support multiple address-families using a different instance per address-family.

Unlike OSPFv3 where the Instance ID can be used for multiple purposes, such as putting the same interface in multiple areas, the OSPFv2 Instance ID is reserved for identifying protocol instances.



Although the relevant RFC defines the mechanism to differentiate packets for different instances sent and received on the same interface, Cisco's current IOS implementation allows you to have multiple OSPFv2 processes (not instances) using only different interfaces. Some of these processes can be VRF ones.


Links




NTS: MPLS/LDP

MPLS/LDP




LDP (Label Distribution Protocol) is defined in RFC 5036.
MPLS (Multi-Protocol Label Switching) architecture is defined in RFC 3031.
MPLS Label Stack Encoding is defined in RFC 3032.



LDP messages
  • LDP Discovery (to directly connected neighbors)
    • Multicast UDP to 244.0.0.2:646
  • targeted LDP Discovery (to non-directly connected neighbors)
    • Unicast UDP to x.x.x.x:646
  • LDP Session/Advertisement/Notification (to all)
    • Unicast TCP to x.x.x.x:646
A working IGP between neighbors is a requirement for all the above, besides LDP Discovery.

Label retention/distribution
  • Label retention
    • liberal
    • conservative
  • Label distribution
    • downstream
      • unsolicited
      • on-demand

Liberal, downstream, unsolicited is the most common case.



General

Although in latest software releases LDP is the default label protocol, it's a good practice to always enable it with "mpls label protocol ldp". The same applies with the "mpls ldp router-id", which should in most cases be loopback0.

Use "sh mpls ldp bindings" to check the LIB (labels for all IGP database prefixes)
Use "sh mpls forwarding" to check the LFIB (labels for RIB installed prefixes)

Outgoing Label under "show mpls forwarding-table":
  • X Label 
    • Local device is an LSR
  • Pop Label
    • Local device is an LSR and also the PHP
  • No Label
    • Local device is a LER

You need to configure "mpls ldp explicit-null" if you want to keep the EXP QoS till the end PE. Default is implicit-null due to PHP.

"debug mpls packet" includes the label stack {Label EXP TTL} information

Fa0/0.1: rx: Len 122 Stack {29 0 253} - ipv4 data
Fa0/0.2: tx: Len 122 Stack {30 0 252} - ipv4 data



Debugging should be the last thing you should do in case of a problem in production networks. So learn not to depend on it.



Label Allocation Methods

  • an IGP/Transport Label is allocated through
    • LDP (+IGP)
    • RSVP (MPLS TE)
    • Labeled BGP
  • a VPN Label (L3VPN) is allocated through
    • MP-BGP (VPNv4/v6)
  • a PW Label (L2VPN) is allocated through
    • Targeted LDP 
  • an IPv6 Label (6PE) is allocated through
    • Labeled BGP



Targeted LDP Sessions

You can create targeted LDP sessions (assuming ip connectivity exists) using the following methods:

IOS

Static LDP neighbors on both routers

R1
mpls ldp neighbor R2 targeted

R2
mpls ldp neighbor R1 targeted


Static LDP neighbor on one router and accept targeted hellos on the other

R1
mpls ldp neighbor R2 targeted

R2
mpls ldp discovery targeted-hello accept


MPLS/LDP under a TE tunnel interface on one router and static LDP neighbor on the other

R1
interface Tunnel0
 tunnel destination R2
 mpls ip

R2
mpls ldp neighbor R1 targeted


MPLS/LDP under a TE tunnel interface on one router and accept targeted hellos on the other

R1
interface Tunnel0
 tunnel destination R2
 mpls ip

R2
mpls ldp discovery targeted-hello accept


Something similar applies to IOS-XR too.

IOS-XR

R1
mpls ldp
 neighbor R2 targeted


R2
mpls ldp
 discovery targeted-hello accept



In case of RSVP in the core and LDP in the access, you can have tLDP sessions over RSVP, where end-to-end LSPs will have 1 label (LDP) in the access and 2 labels (RSVP/LDP) in the core.

You can also use RSVP solely for (one-hop) link protection, having tLDP on top of it.



Simple VPN with iBGP & LDP

The rule for LSP usage in BGP is that when an LSP is available for the BGP next-hop of a route, that LSP can be used to forward traffic to that route destination.

Assuming a network of R1-R2-R3-R4-R5-R6, where R2,R3,R4,R5 run LDP+IGP in the core and R2,R5 run iBGP between them, then R1 and R6 can communicate between each other as long as their networks as advertised to R2,R5 (i.e with eBGP) and R2,R5 are using their loopbacks as next-hops in their iBGP. The intermediate routers R3,R4 just do mpls switching based on the R2,R5 loopback labels.

R2,R5 have BGP-generated labels for the R1,R6 prefixes which according to BGP have R2,R5 as next-hops.
These labels (which are the same as the ones used for the BGP next-hop) are shown only if you exclusively define the network in "sh mpls forwarding-table" or use "sh ip cef".

IOS
R2#sh mpls forwarding-table | i 6.6.6.6
R2# -no entry shown-

R2#sh mpls forwarding-table 6.6.6.6
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
None       22         6.6.6.6/32       0             Fa0/0.23   20.2.3.3

R2#sh mpls forwarding-table | i 5.5.5.5
21         22         5.5.5.5/32       0             Fa0/0.23   20.2.3.3


R2#sh ip route 6.6.6.6
Routing entry for 6.6.6.6/32
  Known via "bgp 100", distance 200, metric 0
  Tag 20, type internal
  Last update from 5.5.5.5 00:35:32 ago
  Routing Descriptor Blocks:
  * 5.5.5.5, from 5.5.5.5, 00:35:32 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 20
      MPLS label: none


R2#sh ip cef 6.6.6.6 det
6.6.6.6/32, epoch 0, flags rib only nolabel, rib defined all labels
  recursive via 5.5.5.5
    nexthop 20.2.3.3 FastEthernet0/0.23 label 22



R3,R4 have LDP-generated labels for the R2,R5 next-hops




Static Labels

After you configure the label range, you need to remove the mpls ldp config from the IGP process or from the interfaces in order to use the label range. If you just clear the LDP neighbors, then the old labels remain.

Check "Inter-AS MPLS L3VPN" for more examples.



LDP Auto-configuration
  • Supported in OSPF and IS-IS
  • Not supported on MPLS-TE Tunnels

IOS
router ospf/isis X
 mpls ldp autoconfig
!
interface X
  no mpls ldp igp autoconfig


IOS-XR
mpls ldp
!
router ospf/isis X
 mpls ldp auto-config
 !
 interface X
   igp auto-config disable


Use "sh mpls interfaces detail" or "sh mpls ldp discovery detail" to find out how LDP was activated on an interface.

IOS-XR requires the explicit activation of MPLS LDP prior to LDP autoconfiguration.



LDP Authentication

Authentication is applicable only to the LDP TCP session.

After setting the LDP password, the LDP session might need to be cleared manually to have the password enabled.

When setting "mpls ldp password required", all LDP sessions are cleared automatically.

Password can be configured:
  • per neighbor
    • "mpls ldp neighbor x.x.x.x password" (IOS, IOS-XR)
  • per group of neighbors
    • "mpls ldp password option X for Y-ACL" (IOS)
  • as a default password for all neighbors
    • "mpls ldp password fallback" (IOS)
    • "mpls ldp neighbor password" (IOS-XR)



Label Filtering

The LDP default behavior is to allocate local labels for all non-BGP prefixes, which includes IGP learned prefixes and connected interfaces with LDP on.
  • Local Label Allocation Filtering
    • controls the allocation of local labels
    • uses prefix-lists for filtering
    • use "allocate global prefix-list" under "mpls ldp label" config (IOS)
    • use "mpls ldp label allocate" under global config (IOS-XR)
    • use "sh mpls ldp bindings local" to verify
  • Inbound Label Binding Filtering
    • controls label bindings that a router accepts from a specific neighbor
    • uses access-lists for filtering
    • use "mpls ldp neighbor x.x.x.x labels accept" under global config (IOS)
    • use "mpls ldp label accept" under global config (IOS-XR)
    • use "sh mpls ldp bindings neighbor" to verify
  • Outbound Label Binding Filtering
    • controls label bindings that a router sends to a specific neighbor
    • uses access-lists for filtering
    • use "mpls ldp advertise-labels" under global config (IOS) - "no mpls advertise" is needed first
    • use "mpls ldp label advertise" under global config (IOS-XR)
    • use "sh mpls ldp bindings neighbor" to verify

LDP does not apply the configured local label filter to redistributed BGP routes in the global table for which BGP allocates the local label, but LDP does the advertisements (i.e. Inter-AS Option C). LDP neither forwards these entries, nor releases the local labels allocated by BGP.

Common use of label filtering is to allocate labels only for PE loopback addresses.



LDP Session Protection

When enabled, a new targeted LDP session is created between the neighbors, in order to keep their LDP session active over any backup path, after the direct/primary link fails. When the primary/direct link is restored, label bindings do not need to be re-exchanged.

2 implementation choices:
  • both neighbors must be configured for session protection
  • one router must be configured for session protection and the other router must simply respond to targeted hellos

IOS
mpls ldp session protection
mpls ldp session protection for LDP-NEI-ACL duration X

IOS-XR
mpls ldp
 session protection
 session protection for LDP-NEI-ACL duration X



You can enable it for all LDP neighbors or for specific ones using an ACL.

IOS
R2#sh mpls ldp neighbor detail | i Protection|duration
        LDP Session Protection enabled, state: Ready
            duration: 86400 seconds
        LDP Session Protection enabled, state: Incomplete
            duration: 86400 seconds
        LDP Session Protection enabled, state: Protecting
            duration: 86400 seconds


R2#sh mpls ldp neighbor 3.3.3.3 detail
...
        LDP discovery sources:
          FastEthernet0/0.23; Src IP addr: 20.2.3.3
            holdtime: 15000 ms, hello interval: 5000 ms
          Targeted Hello 2.2.2.2 -> 3.3.3.3, active, passive;
            holdtime: infinite, hello interval: 10000 ms


Successful recovery

%LDP-5-SP: 3.3.3.3:0: session hold up initiated
%LDP-5-SP: 3.3.3.3:0: session recovery succeeded

Failed recovery

%LDP-5-SP: 4.4.4.4:0: session hold up initiated
%LDP-5-SP: 4.4.4.4:0: session recovery failed
%LDP-5-NBRCHG: LDP Neighbor 4.4.4.4:0 (1) is DOWN (Session Protection disabled targeted session)




LDP IGP Synchronization

When enabled, links where LDP adjacencies are not established, will have their IGP metric increased to the max by the local IGP process.

Generally when an IGP adjacency is established on a link with LDP-IGP Sync on, but LDP-IGP Sync is not yet achieved (or is lost), the IGP advertises the max-metric on that link. That way the link won't be preferred for passing traffic and black-holing will be prevented.

IOS
router ospf/isis X
 mpls ldp sync

!
mpls ldp igp sync holddown x

!
interface X
 no mpls ldp igp sync
 mpls ldp igp sync delay x


IOS-XR
router ospf/isis X
 mpls ldp sync
!
mpls ldp
 igp sync delay x

 interface X
  igp sync delay x



IOS
R2#sh mpls ldp igp sync
    FastEthernet0/0.23:
        LDP configured; LDP-IGP Synchronization enabled.
        Sync status: sync achieved; peer reachable.
        Sync delay time: 0 seconds (0 seconds left)
        IGP holddown time: infinite.
        Peer LDP Ident: 3.3.3.3:0
        IGP enabled: OSPF 1


R2#sh mpls ldp igp sync
    FastEthernet0/0.23:
        LDP configured; LDP-IGP Synchronization enabled.
        Sync status: sync not achieved; peer reachable.
        Sync delay time: 0 seconds (0 seconds left)
        IGP holddown time: infinite.
        Peer LDP Ident: 3.3.3.3:0
        IGP enabled: OSPF 1



IOS-XR
GSR#sh mpls ldp igp sync

GigabitEthernet0/1/0/1.619:
  Sync status: Ready
  Peers:
    6.6.6.6:0



Targeted LDP sessions (i.e. AToM) are not supported, which is expected because these are already tLDP sessions that can use IGP for rerouting.

In IS-IS the maximum wide metric -1 (0XFFFFFE) is used with MPLS LDP IGP synchronization.


Links



TTL Propagation

Default behavior is to copy the TTL from the IP header to the MPLS header (topmost label).

2 extra options are available:
  • do not copy the TTL for forwarded packets
    • "no mpls ip propagate-ttl forwarded" (IOS)
    • "mpls ip-ttl-propagate disable forwarded" (IOS-XR)
  • do not copy the TTL for locally generated packets
    • "no mpls ip propagate-ttl local" (IOS)
    • "mpls ip-ttl-propagate disable local" (IOS-XR)
If the TTL is not copied for forwarded packets, then a traceroute from a local CE to a remote CE, will include the local PE, the remote PE and the remote CE (all the intermediate P routers won't be shown). You can use this in order to hide the MPLS hops from the customer.

You only need to disable the TTL propagation on the PEs, since the P (LSR) routers do not see the original IP packet, so no TTL propagation takes place there.

Traceroute in MPLS L3VPNs works a little bit differently than in normal IP networks, because when the traceroute packet reaches the MPLS core (P routers), the local generated ttl-exceeded response packet must first reach the PE at the other side of the VPN before it's returned back to the traceroute source.

i.e. in a traceroute from CE1 to CE2 (CE1-PE1-P-PE2-CE2), the following happens

  • CE1 sends a ICMP packet with TTL=1
    • Source=CE1
    • Destination=CE2
    • TTL=1
  • PE1 receives the ICMP packet
  • PE1 sends an ICMP ttl-exceeded response back to CE1
    • Source=PE1
    • Destination=CE1
  • CE1 receives the ICMP response
  • CE2 sends an ICMP packet with TTL=2
    • Source = CE1
    • Destination=CE2
    • TTL=2
  • PE1 receives the ICMP packet
  • PE1 forwards the ICMP packet to the next P
    • Source=CE1
    • Destination=CE2
    • TTL=1
  • P receives the ICMP packet
  • P creates an ICMP ttl-exceeded response and sends it to PE2 using the original label stack
    • Source=P
    • Destination=CE1
    • TTL=default
  • PE2 receives the ICMP response and forwards it to CE1 which is the actual destination
    • Source=P
    • Destination=CE1
  • CE1 receives the ICMP response
  • CE1 sends a ICMP packet with TTL=3
    • and so on...



MPLS MTU

Every label adds 4 bytes to the frame size.

Common label stacks
  • L3VPN
    • LDP label + VC label
  • L2VPN/VPLS
    • LDP label + VC label
  • MPLS-TE
    • TE label + VC label
    • TE label + LDP label + VC label
  • MPLS-TE/FRR
    • FRR label + TE label + VC label
    • FRR label + TE label + LDP label + VC label
  • AToM & TE/FRR & CsC
    • FRR label + TE label + LDP label + VPN label + VC label

Common transport header sizes (in bytes):
  • Ethernet port:14
  • Ethernet VLAN: 14 + 4 per vlan tag
  • Frame-Relay DLCI: 2 (Cisco), 8 (IETF)
  • HDLC/PPP: 4
  • AToM Control Word: 4

All L3 protocols (i.e. IPv4, IPv6, MPLS, CLNS) inherit their MTU settings from L2 MTU.

The default MPLS MTU value of a link equals the interface MTU value. You need to first change the interface MTU in order to be able to increase the MPLS MTU too.

IOS
R4#sh mpls int detail
Interface FastEthernet0/0:
        IP labeling not enabled
        LSP Tunnel labeling enabled
        BGP labeling not enabled
        MPLS operational
        MTU = 1500


IOS
interface FastEthernet0/0
 mtu 1530


R4#sh mpls int detail
Interface FastEthernet0/0:
        IP labeling not enabled
        LSP Tunnel labeling enabled
        BGP labeling not enabled
        MPLS operational
        MTU = 1530


IOS
interface FastEthernet0/0
 mtu 1530
 mpls mtu 1508


R4#sh mpls int detail
Interface FastEthernet0/0:
        IP labeling not enabled
        LSP Tunnel labeling not enabled
        BGP labeling not enabled
        MPLS operational
        MTU = 1508



In IOS-XR, interface MTU includes the L2 header (i.e. +14 bytes in case of untagged ethernet).

IOS-XR
interface TenGigE0/0/0/6
 mtu 9214


IOS-XR
ASR9k#sh imds int Te0/0/0/6

View: OWN - Owner, L3P - Local 3rd Party, G3P - Global 3rd Party,
      LDP - Local Data Plane, GDP - Global Data Plane, RED - Redundancy

Node 0/RSP0/CPU0 (0x41)

Interface TenGigE0/0/0/6, ifh 0x000002c0 (up, 9214)
  Interface flags:          0x000000000010059f (IFCONNECTOR|IFINDEX
                            |SUP_NAMED_SUB|BROADCAST|CONFIG|HW|VIS|DATA
                            |CONTROL)
  Encapsulation:            ether
  Interface type:           IFT_TENGETHERNET
  Control parent:           None
  Data parent:              None
  Views:                    GDP|G3P

  Protocol        Caps (state, mtu)
  --------        -----------------
  None            spio (up, 9214)
  None            ether (up, 9214)
  arp             arp (up, 9200)
  ipv4            ipv4 (up, 9200)
  mpls            mpls (up, 9200)
  ether_sock      ether_sock (up, 9200)
  ether_link_oam  ether_link_oam (up, 9200)


The "sh imds" command is hidden in most IOS-XR releases.

IOS-XR
ASR9k#sh ip int Te0/0/0/6
TenGigE0/0/0/6 is Up, ipv4 protocol is Up
  Vrf is default (vrfid 0x60000000)
  Internet address is 10.201.10.221/30
  MTU is 9214 (9200 is available to IP)



In IOS-XR, if you change the interface MTU, then you need to take into account the L2 header. If you change the L3 protocol MTU, then it's the same as in IOS.


Fragmentation

If a labeled packet is received and the LSR notices that the outgoing MTU is not big enough for this packet, the LSR strips off the label stack, fragments the IP packet, puts the label stack (after the pop, swap, or push operation) onto all fragments, and forwards the fragments.

If the IP header has the DF bit set, the LSR doesn't fragment the IP packet, but it drops the packet and returns an ICMP error message "Fragmentation needed and do not fragment bit set" to the originator of the IP packet (following the same procedure as with traceroute).

Fragmentation should be avoided if possible.

IOS uses MRU in order to "inform" the LSR how big a received labeled packet of a certain FEC can be in order for that to be forwarded out of this LSR without fragmenting it.

IOS
R6#sh mpls forwarding-table 19.19.19.19 detail
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
Label      Label      or Tunnel Id     Switched      interface
None       No Label   19.19.19.19/32   0             Fa0/0.619  20.6.19.19
        MAC/Encaps=18/18, MRU=1504, Label Stack{}
        CA020BB00008CA01063000008100026B0800
        No output feature configured