Friday, March 27, 2015

CCIE OCG: IS-IS (Chapter 10)

IS-IS Terminology

  • End System (ES) = a host.
  • Intermediate System (IS) = a router.
  • System = a network node.
  • Circuit = an interface.
  • Domain = an autonomous system.

NSAP Addressing

  • An NSAP address is assigned to the entire network node, not to individual interfaces.
  • A single node requires only one NSAP address, regardless of how many network interfaces it uses.
  • Two parts: the Initial Domain Part (IDP) and the Domain Specific Part (DSP).
  • IDP = Authority and Format Identifier (AFI) and the Initial Domain Identifier (IDI).
  • IDI is indicated by AFI and might even be omitted.
  • AFI + IDI = the routing domain.
  • The System ID (6 octects) is the unique identifier of the node itself.
  • NSEL identifies the particular service in or above the network layer.
  • In typical IS-IS deployments, the addressing uses the AFI of 49 in which the length and meaning of the HO-DSP field are entirely up to the administrator.
  • If the value of the SEL octet is 0, no particular service is being addressed, and the entire NSAP address simply identifies the destination node itself without referring to any particular service on that node.

Example: 49.0001.1234.5678.3333.00.
  • The AFI is 49, signifying a local addres.
  • The 0001 is the area number.
  • The 1234.5678.3333 is the System ID of the node.
  • The trailing 00 is the SEL value.

The use of the dot, however, is arbitrary, as long as it separates groups of integer octet length.
Therefore, all the following notations represent the same address:
  • 49.0001.1234.5678.3333.00
  • 4900.0112.3456.7833.3300
  • 49.00.01.12.34.56.78.33.33.00
  • 49000112.34.5678.33.3300
  • 49000112345678333300

A Cisco router rewrites the address into the notation used in the first line.

Levels of Routing

  • Level 0 routing: Routing between two ES nodes on the same link, or between an ES
    node and its nearest IS.
  • Level 1 routing: Routing between ES nodes in a single area of a domain.
  • Level 2 routing: Routing between ES nodes in different areas of a domain.
  • Level 3 routing: Routing between ES nodes in different domains.
  • Both ES and IS send a periodic Hello message advertising their existence.
  • Aptly named, Hellos sent by ES nodes are called ES Hello (ESH), while Hellos sent by IS nodes are called IS Hello (ISH).
  • On Level 1, IS nodes collect lists of all ES nodes directly attached to them, and advertise these lists to each other.
  • On Level 2, IS nodes do not advertise the list of connected ES nodes anymore. Instead, in this level, IS nodes exchange area prefixes to learn how to reach particular areas.
  • If a Level 1 IS determines that the packet’s destination ES is in a different area, it will forward the packet toward the nearest IS capable of Level 2 routing, regardless of the destination area.
  • Hence, Level 1 routing can be described as routing by System ID, while Level 2 routing can be described as routing by area prefix.

IS-IS Metrics, Levels, and Adjacencies

  • Four metric types:
  1. Default: Required to be supported by all IS-IS implementations; usually relates to the bandwidth of the link (higher value represents a slower link).
  2. Delay: Relates to the transit delay on the link.
  3. Expense: Relates to the monetary cost of carrying data through the link.
  4. Error: Relates to the residual bit error rate of the link.
  • Most IS-IS implementations today support only the default metric.
  • Cisco IS-IS implementation assigns all interfaces the default metric of 10, regardless of their bandwidth.
  • Cisco IOS does not automatically recalculate an interface's bandwidth into its IS-IS metric.
  • Narrow metrics: network metric path of 6 bits (1-63), and the complete path metric of 10 bits (1-1023).
  • Wide metrics: 24 bits for the interface metric and 32 bits for the entire path metric.
  • IS-IS routers operate on each routing level independently.
  • For each level, an IS-IS router establishes separate adjacencies with its neighbors running on the same level, and maintains a separate link-state database.
  • Each router belongs to a single area (only one NET that carries the area identifier).
  • Level 1 adjacencies are created only between routers with the same area identifier.

IS-IS Packet Types

Four basic packet types:
  • Hello packet
  • Link State PDU
  • Complete Sequence Numbers PDU (CSNP)
  • Partial Sequence Numbers PDU (PSNP)

Hello Packets

  • Also denoted as IIH (IS-IS Hello) discover and maintain IS-IS neighbors.
  • On broadcast-type networks, IS-IS routers use separate Hello packets for L1 and L2 adjacencies.
  • On point-to-point type interfaces, a single L1L2 Hello is used.
  • Sent periodically every 10 seconds by default.
  • Hold time = Hello multiplier x Hello time.
  • By default, Hold time = 3 x 10 seconds = 30 seconds.
  • The timers do not need to match on neighboring routers.
  • On a DIS, the individual timers are always one-third of the configured timers.

Link State PDUs

  • There are no different types of LSPs.
  • Different network objects are described by distinct Type-Length-Value (TLV) records inside an LSP.
  • LSPs are uniquely identified by three parts:
  1. System ID of the router that originated the LSP.
  2. Pseudonode ID that differentiates between the LSP describing the router itself and the LSPs for multiaccess networks in which the router is a Designated IS.
  3. LSP Number denoting the fragment number of the LSP.
  • LSPID = System ID + Pseudonode ID + LSP Number.
  • For LSPs that describe routers themselves, the Pseudonode ID is always set to 0.
  • Each LSP has a sequence number, incremented at each change.
  • The LSP with the higher sequence number is more recent.
  • Each LSP has a Remaining Lifetime value (20 minutes).
  • IS-IS routers refresh their self-originated LSPs every 15 minutes.
  • Flooding an empty LSP with the Remaining Lifetime set to 0 is called an LSP purge.
  • After this timer expires, a router is required to wait at least another ZeroAgeLifetime (60 seconds) before flushing the LSP.
  • If putting all TLV records into a single LSP would cause it to exceed the MTU, the router will simply create multiple LSPs.
  • Fragmentation is performed only by the router that originates the LSP.
  • Fragmentation is signified by an increasing LSP Number, starting from 0.
  • After the LSP is flooded, it must not be modified by any other router, and also not be defragmented and/or refragmented.
  • The MTU on interfaces must be identical.

R1# show isis database
IS-IS Level-1 Link State Database:
LSPID        LSP Seq Num  LSP Checksum  LSP Holdtime   ATT/P/OL
R1.00-00   * 0x00000002   0x4BD3        676            0/0/0
R1.00-01   * 0x00000002   0xF403        708            0/0/0
R1.00-02   * 0x00000003   0xF86B        643            0/0/0
R2.00-00     0x00000003   0x449C        574            0/0/0


  • The router automatically substitutes the numerical System ID for the router's hostname to make the output easily readable.
  • Each LSP is identified by the triplet SystemID.PseudonodeID-Fragment in the LSPID column.
  • For LSPs that describe routers, the Pseudonode ID is always 0.
  • Entries marked with the asterisk sign are the LSPs that the router has originated itself.
  • A directly connected network is marked by an "IP" label.
  • A neighboring router is marked by an "IS" label and identified by its System ID and Pseudonode ID.
  • All metrics default to 10.
  • Each IS-IS router originates only a single LSP (plus Pseudonode LSPs if it is a DIS), and has therefore only a single or a few self-originated LSPs to age and refresh.

Complete and Partial Sequence Numbers PDUs

  • Used to synchronize link-state databases.
  • Similar to OSPF DBD packets.
  • Purpose is to advertise a complete list of LSPs in the sender's LSDB.
  • Receivers can flood a newer or missing LSP if they have one, or request an LSP if they find it missing in their own database.
  • If the sender’s link-state database contains so many LSPs that listing them all in a single CSNP packet would cause it to exceed the MTU, multiple CSNPs are sent.
  • For this purpose, individual LSPIDs are advertised.
  • LSPIDs range from 0000.0000.0000.00-00 to FFFF.FFFF.FFFF.FF-FF.
  • The bold part is the System ID, the following octet is the Pseudonode ID, and the octet following the dash is the LSP Number ID.
  • On point-to-point links, CSNP packets are exchanged usually only during initial adjacency buildup.
  • On broadcast networks, CSNP packets are originated periodically by the DIS.
  • PSNP packets are functionally similar to OSPF LSR and LSAck packets.
  • PSNP packets are used to request an LSP or acknowledge its successful arrival.


IS-IS Operation over Different Network Types

  • IS-IS natively supports only broadcast and point-to-point network types.
  • Running IS-IS over any Layer 2 technology works right out of the box.
  • No special provision to operate over partially meshed hub-and-spoke Frame Relay.
  • Recommended action to configure point-to-point subinterfaces and IS-IS point-to-point links.
  • Three possible adjacency states:
  1. Down - The initial state. No IIHs have been received.
  2. Initializing - IIHs have been received but the communication may not be bidirectional.
  3. Up - IIHs have been received and it is certain that the neighbor is also receiving IIHs.

Over Point-to-Point Links 

  • IS-IS expects to detect a single neighbor, bring up the adjacency, and synchronize the LSDB.
  • A three-way handshake to verify bidirectional connectivity.
  • The three-way handshake is simple:
  1. Router A <--- (Down) Router B + Router A (Initializing) ---> Router B
  2. Router A <--- (Up) Router B
  3. Router A (Up) ---> Router B
  • After the adjacency is declared as Up, routers will attempt to synchronize their link-state
  • databases.
  • Every LSP sent over a point-to-point link, whether during the initial database synchronization or anytime later when it is updated or purged, must be acknowledged, and this is done using PSNP or CSNP packets.

Over Broadcast Links

  • Similar to OSPF.
  • An IS-IS router lists the MAC address (or SNPAs) of all neighboring routers it hears in the IIH.
  • If a router receives an IIH from a neighbor and finds its own SNPA indicated in the IIH, it knows that the routers can see each other, and can move the adjacency to the Up state.
  • If IIH packets from a neighbor do not contain the receiving router’s SNPA, the adjacency is kept in the Initializing state.
  • IS-IS elects on Designated IS (DIS) for each broadcast network.
  • No backup DIS.
  • Selection criteria:
  1. The router with the highest interface priority.
  2. The router with the highest SNPA.
  3. If SNPAs are not comparable, the router with the highest System ID.
  • 0 is a valid priority as well, and it does not exclude a router from participating in DIS election.
  • DIS is preemptive.
  • The DIS election is effectively performed with each received IIH.
  • All routers on a common broadcast segment become fully adjacent, regardless of which is the DIS.
  • DIS has two important operations:
  1. Help routers synchronize on broadcast networks.
  2. Represent the broadcast segment in the LSDB as a standalone object - the Pseudonode.
  • Synchronization: The DIS creates and sends a CSNP packet in regular intervals (10 seconds by default) on the segment. This CSNP packet lists all LSPs present in the DIS’s link-state database. Other routers on the segment receive this CSNP and compare it to the index of their own link-state database.
  • The DIS is not a relay of LSPs; rather, it is a reference point of comparison.
  • If a router misses an LSP known by the DIS, or if the LSP is older than the one known by the DIS, the router will request the newer LSP through PSNP and the DIS will flood it.
  • If a router knows about a newer LSP than the one known by the DIS, or if the DIS seems to miss it completely, the router will simply flood the LSP onto the network.
  • No explicit acknowledgment by the DIS is sent.
  • If the LSP has arrived, the DIS will advertise it in its next periodic CSNP, and this CSNP serves as an implicit acknowledgment.
  • To exist as a pseudonode in a link-state database, a broadcast network must have its own LSP.
  • It is the responsibility of the DIS to originate and flood the Pseudonode LSP.

Areas in IS-IS

  • The entire node with all its interfaces belongs only to a single area.
  • IS-IS uses the entire high-order part of the NSAP address up to the start of System ID as the area identifier.
  • Nodes in a single area must obviously be addressed using the same NSAP format, the same initial domain identifier, and the same internal area number (high-order domain specific part).
  • IS-IS routers maintain separate and independent Level 1 (L1 in short) and Level 2 (L2 in short) link-state databases, and do not allow LSPs from one database to ever leak into the other.
  • L1 routing is a process of intra-area routing, delivering packets between stations located in the same area.
  • Each L1 router advertises its directly connected IP networks in its L1 LSP.
  • L2 routing is a process of inter-area routing, delivering packets between stations located in different areas.
  • L2 backbone must be contiguous and pervade all areas within the domain.
  • Each L2 router advertises its directly connected IP networks to achieve contiguous IP connectivity in the backbone, plus all other L1 routes from its own area with appropriate metrics , to advertise IP networks present in particular areas.
  • L2 routers establish adjacencies regardless of their areas.
  • L1 routers in an area behave as if they were in an OSPF Not So Stubby-Totally Stubby (NSSA-TS) area.
  • IS-IS on Cisco routers defaults to L1L2 operation, meaning that both L1 and L2 routing are enabled by default.
  • ATT/P/OL = ATTached, Partition repair, and Overload flags.
  • ATT = 1 means that the router can reach other areas.
  • L1 routers automatically install a default route toward their nearest L1L2 router whose ATT bit set.
  • Cisco routers do not support the Partition repair function (always set to 0).
  • The Overload bit was originally intended to signal that the router is, for whatever reason, unable to store all LSPs in its memory, and that its link-state database is overloaded.
  • If a router’s LSP has the O bit set, the SPF computation on other routers will ignore this router when computing shortest paths to other routers and their networks.
  • The router will not be used as a transit router to other routers, but it still will be considered as a router usable to reach its own directly connected networks.
  • Looking at any L2 LSP in isolation, you do not even know which prefix is directly connected to the router and which one is an L1 prefix “uptaken” into L2—they are both advertised in the same manner.

Authentication in IS-IS 

  • IIH packets are authenticated independently of LSP, CSNP, and PSNP packets.
  • L1 LSPs must use the same area password or the level-1 authentication password.
  • L2 LSPs must use the same domain password or the level-2 authentication password.
  • IIH authentication is configured independently of non-IIH.
  • IIH authentication is configured directly under the interface, so different neighbors can use different passwords.
  • Non-IIH must use the same authentication type and the same password.
  • If IIH packets received from a neighboring router fail authentication, no adjacency will be created between this router and the neighbor.
  • As a result, these routers will not accept LSP, CSNP, or PSNP packets from each other, as these packets are accepted only from routers in the Up adjacency state.
  • If IIH packets pass the authentication but the non-IIH packets fail it, the routers will be in the Up adjacency state but they will not be able to synchronize their link-state databases.

IPv6 Support in IS-IS

  • IS-IS does not require a particular Layer 3 protocol to carry its packets.
  • IS-IS can also carry information about destinations described by different address families in a single instance.
  • Rules about advertising IPv6 prefixes in L1 and L2 LSPs are identical to those for IPv4.
  • It is not necessary to start an additional IS-IS process to carry IPv6 routes along with IPv4.
  • Instead, the existing IS-IS process is simply instructed to advertise IPv6 routes along with other information it is already advertising.

Configuring IS-IS


key chain ISISAuth
key 1
key-string S3cretP4ss
!
interface Serial0/0/0
description => To R2 <=
ip address 10.1.12.1 255.255.255.0
ip router isis
isis authentication mode md5
isis authentication key-chain ISISAuth
isis three-way-handshake ietf
!
router isis
net 49.0001.0000.0000.0001.00
is-type level-1
authentication mode md5
authentication key-chain ISISAuth
metric-style wide
log-adjacency-changes all


  • Interfaces are added to IS-IS directly by configuring them with the ip router isis command. IS-IS has no network command; therefore, per-interface configuration is the way of adding networks and interfaces into IS-IS.
  • If a router is configured for L1L2 operation, it will by default try to establish both L1 and L2 adjacencies over all active IS-IS interfaces.
  • It is possible to limit its operation only to the selected level. That will prevent the router from sending and processing packets of a different routing level over that interface (Example: isis circuit-type level-2-only).

Thursday, March 26, 2015

400-101: IS-IS

Understanding CLNS Addressing

  • Apply to entire nodes and not interfaces.
  • IS-IS requires CLNS node addresses to function properly.
  • CLNS addresses used by routers are called network service access poins (NSAPs).
  • One part of an NSAP address is the NSAP selector (NSEL) byte.
  • When an NSAP is specified with an NSEL of 0, the NSAP is called the network entity title (NET).
  • An NSEL of 0 identifies network services.

NSAP Addresses

  • Maximum size of 20 bytes.
  • The high-order bits describe inter-area structure, and the low-order bits identify unique systems within an area.
  • IS-IS uses the OSI address in the LSPs to identify the router and build the topology table and the underlying IS-IS routing tree.
  • OSI addresses are NSAPs. They contain the following:
  • The device's OSI address.
  • A link to the higher-layer process.
  • Equivalent to the combination of the IP address and upper-layer protocol in an IP header.

IS-IS NSAP Address Structure

  • Three fields: the area address, the system ID, and the NSEL.

+++++++++++++++++++++++++++++++++++++++++++++++++++++
|    IDP    |                 DSP                   |
+++++++++++++++++++++++++++++++++++++++++++++++++++++
| AFI | IDI |  High Order DSP  |  System ID  | NSEL |
++++++++++++++++++++++++++++++++++++++++++++++++++++
+


  • Initial Domain Identifier (IDI) identifies the domain of the NSAP address.
  • Authority and Format Identifier (AFI) makes up the format of the address and the authority that assigned the address.
  • Initial Domain Part (IDP) = AFI + IDI.

  • Domain-Specific Part (DSP) contributes to routing within an IS-IS routing domain.
  • High-Order Domain-Specific Part (HODSP) is more or less the OSI equivalent of a subnet in IP.
  • System ID identifies an individual OSI device. (In OSI, a device has an address, where as in IP, each interface has an address.)
  • NSEL identifies a process on the device. (It corresponds roughly to a port or socket in IP, not used in routing decisions.)
  • DSP = HODSP + System ID + NSEL

Example:  49.0001.0000.0c12.3456.00
  • AFI = 49 (private)
  • Area ID = 0001
  • System ID = 0000.0c12.3456
  • NSEL = 0 (also called NET)

Identifying Sysems in IS-IS

  • Unlike OSPF, an IS-IS router can be a member of only one area.
  • Other restrictions:
  1. All routers in an area must use the same area address.
  2. ESs recognize only ISs and other ESs on the same subnetwork that share the same area address.
  3. L1 intra-area routing is based on system IDs (must be unique).
  4. L2 system IDs must also be unique.
  5. It is customary to use a MAC address from the router as the system ID.
  6. All system IDs in a domain must be of equal length.

NET Addresses

  • NSAP addresses with an NSEL value of 0.
  • Used to uniquely identify a host within an IS-IS routing domain.
  • Because IS-IS originates from the OSI world, NET addresses are required even if the only routed protocol is IP.
  • NET address (NSEL = 00) refers to the device itself.
  • Routers use the NET to identify themselves in the LSPs.
  • Addresses starting with the AFI value of 49 are private addresses, analogous to RFC 1918 for IP addresses.
  • A circuit is the IS-IS term for an interface.

IS-IS PDUs

  • Hello PDU (ESH, ISH, IIH): Used to establish and maintain adjacencies.
  • Link-state PDU (LSP): Used to distribute link-state information.
  • Partial Sequence Number PDU (PSNP): Used to acknowledge and request missing pieces of link-state information.
  • Complete Sequence Number PDU (CSNP): Used to describe the complete list of LSPs in a router's LSDB.

  • L1 and L2 establish separate adjacencies for L1 and L2, one for each level.
  • Unlike OSPF, IS-IS routers in a LAN establish adjacencies with all other routers on the LAN.
  • IIH PDUs announce the area ID.
  • Separate IIH packets announce the L1 and L2 neighbors.
  • Adjacencies form based on the area address communicated in the incoming IIH and the type of router (L1 or L2).
  • L1 routers accept L1 IIH PDUs from their own area and establish adjacencies with other routers in their own area.
  • L2 routers (or the L2 process within any L1/L2 router) accept only L2 IIH PDUs and establish only Level 2 adjacencies.
  • Dijkstra's algorithm requires a virtual router (pseudonode) called the DIS to build a directed graph for broadcast media.
  • DIS selection criteria:
  1. highest priority (default 64, within 0-127)
  2. highest MAC address
  • The L1 DIS and L2 DIS on a LAN might or might not be the same router.
  • Preemptive. Any adjacent IS with a higher priority automatically takes over the DIS role.
  • No backup DIS.
  • Routers on a LAN establish adjacencies with all other routers and with the DIS.
  • Each IS is required to advertise a single adjacency to the pseudonode.
  • A pseudonode LSP details only the adjacent ISs.
  • The pseudonode LSP is used to build the map of the network and to calculate the shortest path first (SPF) tree (equivalent to the network LSA in OSPF).
  • L1 LSPs are flooded within the local area.
  • L2 LSPs area flooded throughout the backbone.
  • Each IS originates its own LSP (one for L1 and one for L2).
  • Identified by the originator's system ID and an LSP number starting at 0.
  • If an LSP exceeds the MTU, it is fragmented into several LSPs, numbered 1, 2, 3, and so on.
  • IS-IS maintains the L1 and L2 LSPs in separate LSDBs.
  • IS examines the checksum of received LSPs and discards any invalid LSPs, flooding them with an expired lifetime age.
  • If the LSP is valid and newer than what is currently in the LSDB, it is retained, acknowledged and given a lifetime of 1200 seconds.
  • When the LSP expires, it is kept for an additional 60 seconds before it is flooded as an expired LSP.
  • Sequence Number PDUs (SNPs) are used to acknowledge the receipt of LSPs and to maintain LSDB synchronization.
  • Two kinds: Complete SNPs (CSNPs) and Partial SNPs (PSNPs).
  • Adjacent IS-IS routers exchange CSNPs to compare their LSDBs.
  • CSNPs are multicast every 10 seconds.
  • Adjacent IS-IS routers use PSNPs to acknowledge the receipt of LSPs and to request transmission of missing or newer LSPs.CSNPs are not periodically sent on point-to-point links.
  • A CSNP is sent only once, when the point-to-point link first comes up.
  • After that, LSPs are sent to describe topology changes, and they are acknowledged with a PSNP.

Configuring IS-IS for IP

  • OSI CLNS protocol must also be configured.
  • Each IS-IS router requires a NET, and IS-IS packets are directly encapsulated onto the data link layer instead of traveling inside IP packets.
  • A NET address identifies a device (an IS or ES), not an interface.

Basic Configuration for Integrated IS-IS
  1. Define areas, prepare the addressing plan (NETs) for routers, and determine which interfaces to enable IS-IS.
  2. Enable IS-IS on the router.
  3. Configure the router's NET.
  4. Enable IS_IS on the proper interfaces.

Three commands to enable Integrated IS-IS on a router for IP routing. Additional commands to fine-tune the IS-IS process.
  • router isis: enables IS-IS as an IP routing protocol.
  • net [number]: assigns a NET to a router to identify it.
  • ip router isis [tag]: enables IS-IS on the interface (no network statement).

A router's CLNS address (NET) consists of three main parts:
  1. The prefix, which identifies the area that the router is a part of.
  2. The system ID, which uniquely identifies each device.
  3. The NSEL, which must be 0.
  • The IS-IS neighbor relationships are established over CLNS, not over IP.
  • Two ends of a CLNS adjacency can have IP addresses on different subnets, with no impact on the operation of IS-IS.
  • Multiple IS-IS processes is possible (marked with a tag). 
  • The process name is locally significant. If omitted, Cisco IOS assumes a null tag.
  • By default, the Cisco IOS makes the router an L1/L2 router.

  • NET = area ID + system ID + NSEL (00).
  • Area ID = 1-13 bytes.
  • System ID = 6 bytes.

  • If no tag is listed, the Cisco IOS assumes a tag value of 0.
  • If only one IS-IS process is active on the router, not tag value is needed.

Example:

router isis
 net 49.0001.0000.0000.0001.00
!
interface ethernet0
 ip address 10.1.1.1 255.255.255.0
 ip router isis
!
interface ethernet1
 ip address 10.1.2.1 255.255.255.0
 router isis

Sunday, March 22, 2015

400-101: MPLS Concepts, Part II

MPLS L3VPNs

  • MPLS L3VPNs allow ISPs to providate private Layer 3 services for their customers.
  • MPLS L3VPNs are aware of the IP addressing at customer locations.
  • At the same time, different customers can have overlapping IP address spaces.
  • The concept of using multiple routing tables, called Virtual Routing and Forwarding (VRF) tables, separate customer routes, allowing duplicate address ranges.



  • Routers have different roles in MPLS VPNs.
  • Customer Edge (CE): A router that is not MPLS aware. Does not send any labeled packets, only peers with the PE router.
  • Provider Edge (PE): An entry point into the MPLS network. Adds labels to packets received from the CE. Connects to multiple CEs and segregates their routes using VRFs.
  • Provider (P): An LSR in the MPLS core. Fowards packets based on labels only. Does not know or care about customer VPN routes. 
  • CEs exchange routes with the PE using a routing protocol.
  • The PE stores the routes in separate per-customer VRFs.
  • The PE redistributes those routes into iBGP and exchanges those routes with other PEs.
  • The routes are never advertised to P routers.
  • The ingress PE pushes two labels on the packet:
  1. An outer MPLS header (S-bit = 0): a label to forward the packet towards the far-end PE.
  2. An inner MPLS header (S-bit = 1): a label to identify the VPN.

General MPLS VPN Traffic Flow

  1. CE1 forwards an unlabeled packet to PE1.
  2. PE1 receives the packet on an interface assigned to VRF-A and makes a routing decision based on VRF-A's forwarding tables. PE1 adds two labels and forwards the labeled packets.
  3. P1 processes the labeled packet and swaps the top label.
  4. P2 receives the labeled packet, pops the top label (penultimate hop pop) and sends the packet to PE2.
  5. Based on the VPN label, PE2 knows that the packet belongs to VRF-A. PE2 removes the label and forwards the packet unlabeled to CE2.

  • Extranet (route leaking) means importing routes from one VRF into a different VRF that servies another VPN site.

MPLS VPLS

  • Virtual Private LAN Service (VPLS) emulates a LAN segment across the MPLS backbone.
  • When the customer with different Ethernet sites connects to an MPLS backbone where VPLS is deployed, it appears as if all the sites are interconnected through a virtual Ethernet switch.
  • VPLS is the same as EoMPLS, as in it is a Layer 2 domain.
  • However, EoMPLS is a service that is point-to-point in nature, whereas VPLS—emulating a LAN—is point-to-multipoint in nature.

Any Transport over MPLS (AToM)

  • AToM provides a solution whereby the MPLS backbone also carries the Layer 2 traffic from the customers, thereby eliminating the need to run two separate networks side by side.
  • The service provider can provide an existing service (ATM, Frame Relay, and so on) over the MPLS backbone.
  • Customers might not want to migrate to MPLS VPNs for two reasons: 1) they want to retain complete control over their network and how it is built, and 2) they have legacy equipment running protocols that cannot be carried over IP.
  • Whereas MPLS VPN provides a service of creating VPNs at Layer 3, AToM creates VPNs at Layer 2 and is sometimes referred to as L2VPN.
  • AToM is a Layer 2 point-to-point service.
  • Benefits of AToM:
  1. The customer does not need to change anything (no need for a routing protocol like with MPLS L3VPNs).
  2. The service provider does not have to change anything on the P routers in the MPLS core. The intelligence to support AToM sits entirely on the PE routers.

L2TPv3

  • L2TPv3 is the Layer 2 transport service over an IP network.
  • The Layer 2 frames are encapsulated with an L2TPv3 header and are transported across the IP network.
  • Similar to AToM, L2TPv3 can carry ATM, Frame Relay, HDLC, PPP, Ethernet, and others.
  • Both the AToM and L2TPv3 solutions use the same architecture, but the network that is carrying the service is different. AToM is carried over MPLS, L2TPv3 is carried over IP.
  • The Layer 2 frames are either encapsulated into an IP packet (L2TPv3) or are labeled (AToM).

Overlay Transport Virtualization (OTV)

  • OTV allows for live migration of virtual machines between sites, the process being completely transparent to the end users.
  • A typical requirement for live migration is that the host machines are in the same IP subnet and the same VLAN. OTV extends the Layer 2 domain across data centers.
  • In essence, OTV accomplishes the same goal as other L2 tunneling protocols such as L2TPv3, AToM, and VPLS. For OTV specifically, the goal is to take Ethernet frames from an end station, like a virtual machine, encapsulate them inside IPv4, transport them over the Data Center Interconnect (DCI) network, decapsulate them on the other side, and out pops the original Ethernet frame.
  • OTV benefits over AToM and VPLS:
  1. Transport agnostic: As long as there is IPv4 connectivity between the data centers, OTV can be used. AToM and VPLS require MPLS.
  2. Simple provisioning: OTV is a CE side protocol. AToM and VPLS are PE side protocols.
  • OTV is an encapsulation nightmare: ICMP over IP over Ethernet over MPLS over GRE over IP over Ethernet (IoIoEoMPLSoGREoIP for short).
  • As a summary, OTV is a fancy GRE tunnel.

Saturday, March 21, 2015

400-101: MPLS Concepts, Part I

Label Switching


MPLS shifts the paradigm from packet forwarding from the destination IP address to label switching. Normally, when a router receives a packet, it looks at the IP header, and makes a forwarding decision based on the destination IP address (the longest match in the routing table). On the contrary, in MPLS networks, a label is added between the Layer 2 and Layer 3 headers, and the router performs packet forwarding strictly based on that label. This allows end-to-end circuits across any type of transport medium, using any protocol.

Label-Switched Path (LSP)

  • LSPs are predetermined unidirectional routes through the MPLS core.
  • Routers define the LSPs by exchanging MPLS information before forwarding any packets.
  • Contrary to LSPs, normal IP routing operates on a hop-by-hop basis, each router making routing decisions independently.

Label-Switching Router (LSR)

  • LSR is a router configured with MPLS that participates in LSPs.
  • LSRs can interpret MPLS headers and performs MPLS operations required to pass traffic through the network.
  • There are diffrent types of LSRs: ingress LSR, "normal" LSR, and egress LSR.
  • Ingress LSR is the entry point into the MPLS network. Native IPv4 packets are assigned MPLS label(s).
  • "Normal" LSRs forward MPLS traffic along the LSP, using only the MPLS header to determine how the packet is routed.
  • Egress LSR receives MPLS packets, strips off any labels, and performs a native IP route lookup.

Label Format


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|         Label            |  Exp  | S |       TTL       |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


  • Label: label value (20 bits)
  • Exp: experimental use, currently used for QoS (3 bits)
  • S: Bottom of Stack (1 bit)
  • TTL: Time To Live (8 bits)
  • Multiple labels can be imposed in an MPLS header. The last label has the S bit set to 1.
  • TTL has the same purpose as in IP.

Label Operations

  • Push: Adds a new label on top of the packet.
  • Swap: Replaces the top label of a label stack with a new label.
  • Pop: Removes the top label of a label stack.
  • Multiple Push: Adds multiple labels to the top of the label stack.
  • Swap and Push: Replaces the top label with a new label and then pushes a new label to the top of the stack.
  • Penultimate Hop Popping (PHP): Removing the top label at the second last router in the MPLS network. This prevents the egress LSR from performing an unnecessary MPLS lookup, only to realize that it needs to send the packet using native IP, and then refer to its routing table to make the actual forwarding decision.

Label Distribution Protocol (LDP)

  • LDP is a method to dynamically build and maintain the LSPs between the LSRs.
  • LSRs exchange label information using LDP.
  • The label bindings received by LDP are stored in the LIB.
  • The LIB in turns feeds the LFIB which defines the label operation (pop, swap, or push).
  • LDP is automatically run on interfaces with mpls ip enabled (CEF and LDP globally must also be enabled).
  • LDP sends Hellos to discover neighbors.
  • LDP Hello messages are UDP (646) messages that are sent on the links to the “all routers on this subnet” multicast address 224.0.0.2.
  • Default timers: Hello = 5 seconds, Hold = 15 seconds.
  • LSRs that are running LDP have an LDP Identifier, or LDP ID.
  • This LDP ID is a 6-byte field that consists of 4 bytes identifying the LSR uniquely and 2 bytes identifying the label space that the LSR is using.
  • The first 4 bytes of the LDP ID are an IP address taken from an operational interface on the router.
  • If loopback interfaces exist, the highest IP address of the loopback interfaces is taken for the LDP ID. If no loopback interfaces exist, the highest IP address of a regular interface is taken.
  • The LDP ID needs to be present in the routing table of the LDP neighboring routers. If it is not, the LDP session is not formed.
  • If there is no route for that IP address in the routing table, the LDP session is not established.
  • If two LSRs have discovered each other by means of the LDP Hellos, they attempt to establish an LDP session between them. One LSR tries to open a TCP connection—to TCP port 646—to the other LSR.
  • After the LDP session has been set up, it is maintained by either the receipt of LDP packets or a periodic keepalive message. Each time the LDP peer receives an LDP packet or a keepalive message, the keepalive timer is reset for that peer (default 180 seconds).

MPLS Ping

  • IP ping is insufficient for verifying the correct MPLS oepration.
  • IP ping verifies connectivity on the IP level but it does not verify whether the LSP is broken.
  • If LDP is broken between two LSR, IP ping indicates that there is no problem.
  • LSPs can break for any number of reasons, while the IP connectivity remains fine. For example: 
  1. The LDP session is down.
  2. MPLS is not enabled on one LSR (or one interface).
  3. The LFIB has a wrong entry for the LSP (wrong in/out label or wrong out-going next-hop information).
  4. The software and hardware LFIB have a discrepancy.
  • For some of these problems, the packets become unlabeled; others are label-switched, but in a
    wrong way.
  • MPLS ping detects problems in the forwarding plane, but it also checks the control plane against the information in the data plane. 
  • MPLS ping is similar to IP ping in that it also uses an echo request and echo reply. 
  • That is where the similarities stop, though. MPLS ping has different packet formats altogether and returns more troubleshooting information.
  • An MPLS echo request is a UDP packet with a destination port of 3503 and a source port chosen by the sender. 
  • It has a Router Alert option. 
  • To prevent the packet from switching any further as an IP packet if the LSP is broken but the IP path is still fine, the IP TTL of the packet is set to 1 and the destination IP address of the packet is from the range 127.0.0.0/8.
  • An LSR never forwards such an IP packet if the LSP is broken.
  • The destination of the packet and which label stack is pushed onto the packet is derived from the IP address that the user command or a software component provides.

MPLS Traceroute

  • The goal of traceroute is to test the path, whereas the goal of ping is to test the connectivity.
  • An MPLS traceroute is nothing more than an MPLS echo request. 
  • The difference with MPLS ping is that MPLS traceroute sends several MPLS echo request packets with increasing MPLS TTL. 
  • The first MPLS LSP traceroute probe has MPLS TTL 1, and for every subsequent probe, the TTL is increased by 1.

Friday, March 20, 2015

CCIE OCG: OSPF (Chapter 9), Part III

OSPF Configuration

The example configuration has the following design goals in mind:
  • The OSPF process IDs do not have to match on separate routers, but best practice recommends using the same process IDs across the network.
  • Using the network command to match interfaces.
  • Configuring S1's RID as 1.1.1.1.
  • Setting priorities on the backbone LAN to favor S1 and S2 to become the DR/BDR.
  • Configuring a minimal dead interval of 1 second, with Hello multiplier of 4, yielding a 250-ms Hello interval on the backbone LAN.


R1#
interface FastEthernet0/0
  ip address 10.1.1.1 255.255.255.0
  ip ospf dead-interval minimal hello-multiplier 4
!
router ospf 1
  area 3 nssa no-summary
  area 4 stub no-summary
  area 5 stub
  network 10.1.0.0 0.0.255.255 area 0
  network 10.3.0.0 0.0.255.255 area 3
  network 10.4.0.0 0.0.255.255 area 4
  network 10.5.0.0 0.0.255.255 area 5

R2#
interface FastEthernet0/0
  ip address 10.1.1.2 255.255.255.0
  ip ospf dead-interval minimal hello-multiplier 4
  ip ospf 2 area 0
!
router ospf 2
  area 5 stub

R3#
router ospf 1
! R3 should omit the no-summary keyword, because R3 is not an ABR.
  area 3 nssa
  network 10.0.0.0 0.255.255.255 area 3

R4#
router ospf 1
  area 4 stub
  network 10.0.0.0 0.255.255.255 area 4

S1#
interface Vlan1
  ip address 10.1.1.3 255.255.255.0
  ip ospf dead-interval minimal hello-multiplier 4
  ip ospf priority 255
!
router ospf 1
  router-id 7.7.7.7
  network 10.1.0.0 0.0.255.255 area 0

S2#
interface Vlan1
  ip address 10.1.1.4 255.255.255.0
  ip ospf dead-interval minimal hello-multiplier 4
  ip ospf priority 254
!
router ospf 1
  network 10.0.0.0 0.255.255.255 area 0



OSPF Costs and Clearing the OSPF Process

How OSPF chooses OSPF interface costs:
  1. Set the cost per neighbor using the neighbor <ip-add> cost <value> command. This is only valid on OSPF point-to-multipoint non-broadcast network types.
  2. Set the cost per interface using the ip ospf cost <value> under the interface.
  3. Allow the cost to default based on interface bandwidth and the OSPF Reference Bandwidth (Ref-BW) (default 10^5 Kbps). The formula is Ref-BW / bandwidth (Kbps).
  4. Default based on bandwidth, but change Ref-BW using the auto-cost reference-bandwidth <value> command within the OSPF process.
  5. The IOS interface bandwidth is kept in Kbps and the auto-cost reference-bandwidth units are Mbps.
  6. When choosing the best routes to reach a subnet, OSPF also considers whether a route is intra-area route, inter-area route, E1/N1 route, or E2/N2 route.

Alternatives to the OSPF network Command

  • As of Cisco IOS Software Release 12.3(11)T, OSPF configuration can completely omit the network command, instead relying on the ip ospf <pid> area <area-id> interface subcommand.
  • With the network command, OSPF advertises stub networks for any secondary IP subnets that are matched by the command.
  • The ip ospf area interface subcommand causes any and all secondary subnets on the interface to be advertised as stub networks - unless the optional secondaries none parameter is included.
  • Regardless of the network or ip ospf area command, OSPF will always establish adjacencies over an interface only using the primary IP address. OSPF will never use secondary addresses to establish an adjacency.


OSPF Filtering

  • Intra-area route filtering presents some special challenges with link-state routing.
  • Link-state protocols do not advertise routes - they advertise topology information.
  • SPF loop prevention relies on each router in the same area having an identical copy of the LSDB for that area.
  • Only the router that has originated an LSA is ever allowed to modify its contents.
  • Three major types of OSPF filtering:
  1. Filtering routes, not LSAs: Using the distribute-list command, a router can filter the routes that its SPF process is attempting to add to its routing table, without affecting the LSDB.
  2. ABR Type 3 LSA filtering: A process of preventing an ABR from creating particular Type 3 summary LSAs.
  3. Using the area range no-advertise option: Another process to prevent an ABR from creating specific Type 3 summary LSAs.

Filtering Routes Using the distribute-list Command

  • For RIP and EIGRP, the distribute-list command can be used to filter incoming and outgoing routing updates.
  • With OSPF, the distribute-list in command filters what ends up in the IP routing table, and only on the router on which the command is configured.
  • Note that the redistribute command does control what enters and leaves the LSDB.
  • The following rules govern the use of distribute-lists for OSPF:
  1. The inbound direction applies to the results of SPF - the routes to be installed into the routing table.
  2. The outbound direction applies only to redistributed routes and only on an ASBR; it selected which redistributed routes shall be advertised.
  3. The inbound logic does not filter inbound LSAs; it instead filters the routes that SPF chooses to add to the routing table.
  4. If the distribute-list includes the incoming interface parameter, the incoming interface is checked as if it were the outgoing interface of the route.
  • The distribute-list route-map allows a much greater variety of matching parameters, and much more detailed logic.


OSPF ABR LSA Type 3 Filtering

  • ABRs do not forward Type 1 and 2 LSAs from one area into another, but instead create Type 3 LSAs for each subnet defined in Type 1 and 2 LSAs.
  • Type 3 LSAs do not contain detailed information about the topology of the originating area; instead, each Type 3 LSA represents a subnet, and a cost from the ABR to that subnet.
  • Type 3 LSAs can be filtered where they would normally be created.
  • By filtering at the ABR, before the Type 3 LSA is injected into another area, the requirement for identical LSDBs inside the area can be met, while still filtering LSAs.
  • Configured using the area <area-id> filter-list prefix <name> in|out command.
  • When in is configured, IOS filters prefixes going into the configured area.
  • When out is configured, IOS filters prefixes coming out of the configured area.


Filtering Type 3 LSAs with the area range Command

  • The area range command performs route summarization at ABRs, telling a router to cease advertising smaller subnets in a particular address range, instead creating a single type 3 LSA whose address and prefix encompass the smaller subnets.
  • When the area range command includes the not-advertise keyword, not only are the smaller component subnets not advertised as type 3 LSAs, but the summary route is also not advertised as a type 3 LSA either.
  • As a result, this command has the same effect as the area filter-list command with the out keyword, filtering the LSA from going out to any other areas.


Virtual Link Configuration

  • OSPF requires that each non-backbone area be connected to the backbone area (area 0).
  • OSPF virtual links overcome the limitation of needing a physical connection to the backbone.
  • A virtual link allows a pair of possibly remote routers to create a targeted OSPF session across the IP network.
  • A virtual link endpoint becomes an ABR, with a full copy of area 0's LSDB entries.
  • A virtual link is not a tunnel for data packets; rather, it is a targeted session that allows two remote routers within a single area to become fully adjacent and synchronize their LSDBs.
  • The virtual link is internally represented as an unnumbered point-to-point link between the two endpoint routers and exists in the backbone area, regardless of the area through which it is created.
  • The area through which the virtual link is created is called a transit area and it must be a regular area.
  • As no tunneling is involved, packets routed through this transit area are forwarded based on their true destination addresses, requiring the transit area to know all networks in the OSPF domain, intra-area, inter-area, and external.
  • The area virtual link commands point to the other router's RID, and the transit area over which the virtual link exists.
  • Timers and authentication can be set on the area virtual-link command.
  • It is important to remember that the virtual links themselves are in area 0.

R1#
router ospf 1
  router-id 1.1.1.1
  area 3 virtual-link 3.3.3.3

R3#
router ospf 1
  router-id 3.3.3.3
  area 3 virtual-link 1.1.1.1



Configuring Classic OSPF Authentication

  • Classically three authentication types: none, clear-text, and MD5.
  • SHA-1 recently added (new configuration).
  • Classic OSPF authentication differs significantly from RIPv2 and EIGRP.
  • The basic rules for configuring OSPF authentication are as follows:
  1. Three types available: type 0 (none), type 1 (clear text), and type 2 (MD5).
  2. Enabled per interface using the ip ospf authentication interface subcommand.
  3. The default authentication is type 0 (no authentication).
  4. The default can be redefined using the area authentication under the OSPF process.
  5. The keys are always configured as interface subcommands.
  6. Multiple MD5 keys with different key IDs are allowed per interface, which allows for graceful key migration where a new key can be added without disrupting the adjacencies. The method is simple: To sign sent packets, OSPF always uses the key that was added as the last one on the interface (regardless of the key number). To authenticate the received packets, it uses the key ID that is indicated in the packet.
  • The keys are stored in clear text in the configuration, unless the service password-encryption command is added.

Configuring Extended Cryptographic OSPF Authentication

  • Starting with IOS Release 15.4(1)T, OSPF also supports SHA-HMAC authentication.
  • SHA-HMAC uses key chains similarly to EIGRP or RIPv2.
  • In addition, the key chain definition has been enhanced to select a particular cryptographic algorithm for a particular key.
  • Each key in the key chain must have a cryptographic algorithm configured using a per-key cryptogprahic-algorithm command. Failure to do so will result in OSPF not using that key.
  • Each key in a key chain can be configured with the send-lifetime and accept-lifetime keywords to limit its usability to a particular timeframe. If multiple keys in the key chain are eligible to sign egress packets, the key with the highest key ID will be used. This is different from RIPv2 and EIGRP that select the key with the lowest key ID.
  • The key rollover procedure as used by classic OSPF is not used with key chains. To sign egress packets, OSPF will always use the valid key with the highest key ID in the key chain. To authenticate ingress packets, OSPF will try to use the key indicated in the received packet. There is no key migration pahse of sending multiple OSPF packets signed with different valid keys.
  • The extended cryptographic authentication is enabled per interface using the ip ospf authentication key-chain <name>. Configuring the extended cryptographic authentication using the area OSPF process level command is not supported.
  • Using the extended cryptographic authentication on virtual links is accomplished using the area <area-id> virtual-link <router-id> key-chain <name>.
  • MD5 authentication is one of the supported cryptographic algorithms in key chains. An OSPF router configured for MD5 authentication using the classic commands will be able to interoperate with a router configured using the new key chain style, provided the cryptographic algorithm for the keys in the key chain is MD5. When the new key chain style configuration is used, passwords configured with the ip ospf message-digest-key commands will be ignored.

key chain OSPF
 key 1
  cryptographic-algorithm hmac-sha-256
  key-string CC1E
!
interface GigabitEthernet0/0
 ip ospf authentication key-chain OSPF

R1# show ip ospf interface gi0/0
GigabitEthernet0/0 is up, line protocol is up
! Lines omitted for brevity.
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 10.0.12.2 (Backup Designated Router)
Suppress hello for 0 neighbor(s)
Cryptographic authentication enabled
Sending SA: Key 1, Algorithm HMAC-SHA-256 - key chain OSPF

  • OSPF authentication is a good place for tricky CCIE lab questions - ones that can be solved in a few minutes if you know all the intricacies.

Protecting OSPF Routers with TTL Security Check

  • Protection against DoS attacks on the control plane.
  • Receiving an OSPF packet outside a virtual link or sham link with its TTL less than 255 is a possible indication of a malicious activity. Such packets can be dropped.
  • Activated either on a per-interface basis using the ip ospf ttl-security interface level command, or globally for all interfaces in a particular OSPF process using the ttl-security all-interfaces command.
  • If activated globally, individual interfaces can be exempted using the ip ospf ttl-security disable interface level command.
  • When active, all OSPF packets sourced by that interface have their TTL set to 255, and only packets received with a TTL of 255 are accepted.
  • Both commands have an optional hops <1-254> argument that allows relaxing the TTL Security Check.
  • Setting the hop-count to a particular value makes the TTL Security Check accept OSPF packets with their TTL in the range from 255 down to 255 - hop-count.
  • If ttl-security all-interface hops 100, OSPF accepts all packets with their TTL in the range from 255 down to 155, inclusive.
  • Setting the hop-count to 254 effectively disables the TTL Security check.
  • If the hop-count is not specified, the value of 1 is automatically assumed.
  • The hop-count influences what OSPF packets will be accepted; it has no impact on the TTL of OSPF packets originated by the router, which will remain at 255.
  • The minimum hop-count of 1 might be surprising, considering that OSPF packets sourced by directly connected neighbors will have their TTL set to 255, and there is no reason to allow OSPF packets with a TTL of 254.
  • However, IOS-based Cisco routers exhibit a peculiar behavior in that they appear to decrement the TTL received OSPF packets before handling them over to the OSPF process.
  • Whenever an OSPF packet is received by a router, its TTL is first decremented by 1 (this decrement is skipped if the packet's TTL is equal to 1), and the packet is then passed to OSPF and to TTL Security Check, which will act based on this decremented TTL value.
  • Neither the ttl-security all-interface nor the ip ospf ttl-security have any impact on configured virtual or sham links.
  • The protection is activated with the area virtual-link ttl-security hops or the area sham-link ttl-security hops command. The hop-count argument is mandatory.
  • The hop-count value should be based on the longest possible intra-area path (in terms of number of routers) between the link endpoints.
  • Interfaces toward routers that do not support TTL Security Check shall be configured with the ip ospf ttl-security disable command.

Tuning OSPF Performance

Apart from Hello and Dead timers, OSPF can be significantly tuned in many other ways.

Tuning the SPF Scheduling with SPF Throttling

  • After a router receives an updated LSA, it needs to schedule its SPF to process the update.
  • It is ideal to wait some time for more updated LSAs to arrive, and process multiple updates in a single run.
  • By default, Cisco routers will schedule an SPF run 5 seconds after receiving an updated LSA, and if an updated LSA arrives after this SPF run, the subsequent delay will grow up to 10 seconds.
  • The scheduling of SPF runs can be controlled by a feature called SPF Throttling.
  • SPF Throttling defines a variable-length wait interval between two consecutive SPF runs.
  • Three parameters: spf-start, spf-hold, and spf-max-wait.
  • spf-start defines the initial wait interval before an SPF computation.
  • spf-hold defines a wait time between subsequent SPF runs, and its value doubles for each consecutive SPF run.
  • spf-max-wait is the maximum time between two SPF runs (doubling the spf-hold value is capped at spf-max-wait), and also defines a period during which the network must be stable for the wait interval to be set back to spf-start and the spf-hold to its preconfigured value.
  • If the network has been stable for the last spf-hold period but not for the entire spf-max-wait since the last SPF run, the wait interval returns to the spf-start value but the subsequent wait will still be set to twice the previous spf-hold value.
  • Example (spf-start = 10 sec, spf-hold = 15 sec, and spf-max-wait = 100 sec):
  1. An updated LSA arrives at time T. The router schedules the nearest SPF run at T+10.
  2. Another updated LSA arrives at time T+2. The router stores it in its LSDB and continues waiting.
  3. At T+10, the router runs the SPF and sets the next wait interval to 15 secs (spf-hold). If another updated LSA arrives within 15 seconds since this SPF runs, the nearest SPF will be run at T+25.
  4. One or more updated LSAs indeed arrive between T+10 and T+25. At T+25, the router runs the SPF and sets the next wait interval to twice the previous spf-hold value, that is, 30 sec. If another updated were to arrive within 30 seconds since this SPF run, the nearest SPF will be run at T+55. The network is considered stable if no topology change is detected within 100 seconds since this SPF run, that is, until T+125.
  5. During the next 30 seconds, no updated LSAs arrive. The wait interval is reset back to spf-start, that is, 10 seconds. The nework is not considered stable, though, because 100 seconds since the last SPF has not elapsed yet; therefore, spf-hold remains at 30 seconds.
  6. At T+80, an updated LSA arrives. The router schedules the nearest SPF run at T+90 and waits until this period expires.
  7. At T+90, the router runs SPF and sets the next wait interval to twice the previous spf-hold value, that is, 60 seconds. If another updated LSA arrives within 60 seconds since thi SPF run, the nearest SPF will be run at T+150. The network wil be considered if no topology change is detected within 100 seconds since this SPF run, that is, until T+190.
  8. During the next 60 secs, no updated LSAs arrive. The wait interval is reset back to spf-start, that is, 10 sec. The nework is not considered stable, though, because 100 seconds since the last SPF has not elapsed yet; therefore, spf-hold remains at 60 secs.
  9. No updated LSA arrives till T+190. As a result, the network is considered stable and the spf-hold is set to its initial value of 15 secs. Any topology change detected after this moment will be handled like the beginning of this scenario.
  • Configuration: timers throttle spf <spf-start> <spf-hold> <spf-max-wait>.
  • All arguments are indicated in milliseconds.


Tuning the LSA Origination with LSA Throttling

  • Control the rate at which a particular LSA might be reoriginated by its originating router.
  • The same idea as with SPF Throttling.
  • Three parameters: start-interval, hold-interval, and max-interval.
  • The hold-time will be reset to its configured value only if the LSA was not required to be updated for the entire max-interval since its last update.
  • By defaul, Cisco routers are configured to originate an updated LSA immediately and delay its subsequent origination by 5 seconds and not to progressively increase this interval.
  • start-interval = 0, hold-interval and max-interval = 5000 milliseconds.
  • Configuration: timers throttle lsa all <start-interval> <hold-interval> <max-interval>.
  • The values are again expressed in milliseconds.
  • A router can also be configured to ignore the same LSA upon arrival if it appears to arrive too often.
  • Configuration: timers lsa arrival <msec>.
  • If two or more same LSAs arrive less than <msec> apart, only the first one is accepted an the remaining LSAs are dropped.
  • The default setting is 1000 milliseconds.
  • Obviously, the value of the minimum LSA arrival interval should be smaller than the neighbor's initial hold interval in LSA throttling.
  • Otherwise, a neighbor would be allowed to send an updated LSA sooner than this router would be willing to accept it.


Incremental SPF

  • The SPF calculation can be augmented so that after a topology change only the affected part of the shortest-path tree is recalculated.
  • Activated using the simple ispf command (no additional arguments or parameters).

router ospf 1
 ispf


OSPFv2 Prefix Suppression

  • Maintaining transit link prefixes in LSDBs and routing table is, at least from the connectivity standpoint, largely useless.
  • Not advertising these prefixes can possibly save a significant amount of memory and CPU cycles without impairing the network connectivity.
  • Suppressing transit link prefixes is different for Type 1 and Type 2 LSAs.
  • Keep in mind that the goal of this mechanism is to suppress transit link prefixes, that is, the IP network addresses used on these links, not the transit links themselves.
  • Transit links describe the connections between routers and must continue to be advertised; otherwise, SPF would be unable to construct the shortest-path tree.
  • Type 1 LSA describes a router and its adjacencies (links) to its neighboring objects.
  • There are four possible link types that can be described by a Type 1 LSA:
  1. Point-to-point link to another router: This is a transit link pointing toward the other router's RID. It contains no addressing information and will not be influenced by the prefix suppression mechanism.
  2. Link to a transit network: This is a transit link pointing toward the transit network's DR IP address. While it refers to an IP address of the DR, it contains no further addressing information such as network mask, and will not be influenced by the prefix suppression mechanism.
  3. Stub network: This entry describes the IP prefix used either in a true stub network or a prefix used on a point-to-point link to another router. A router can suppress all stub network entries in a Type 1 LSA that correspond to IP prefixes used on point-to-point links.
  4. Virtual router: This is a virtual transit point-to-point link pointing toward a virtually adjacent router's RID. It contains no addressing information and will not be influed by the prefix suppression mechanism.
  • Therefore, in Type 1 LSAs, suppressing the transit link prefixes is accomplished by omitting stub network entries that contain prefixes on point-to-point interfaces to other routers.
  • The IP prefix of the network can be computed by bitwise ANDing the Link State ID of the LSA and the netmask carried in its payload. Neither of these two fields can be removed from the type 2 LSA without making its format incompatible.
  • To routers that implement RFC 6860, a Type 2 LSA advertising the netmask of 255.255.255.255 is a signal that the LSA contains no IP prefix information. Routers not implementing this RFC will install a host route toward that network’s DR. While the advantage of saving routing table space is lost on such routers, no interoperability issues will be introduced.
  • Configuration: prefix-suppression under the OSPF process.
  • This command will cause the router to suppress all prefixes on all its OSPF-enabled interfaces except loopbacks, secondary IP addresses, and prefixes on passive interfaces.
  • Also possible to active on a per-interface basis: ip ospf prefix-suppression.
  • If the prefix suppression is activated globally, the interface is exempted by using the ip ospf prefix-suppression disable command.

OSPF Graceful Restart (GR)

  • Allows a router to restart while its neighbors continue to forward packets to the restarting router as if it was up and running.
  • "routing through a failure" vs. "routing around a failure"
  • Cisco implemented its own version of graceful restart before RFC 3623 that is called Non-Stop Forwarding (NSF).
  • Cisco supports both NSF and GR; both area configured using nfs commands.
  • Two classes of devices involved in GR/NSF.
  • restart mode = the router undergoing the graceful restart.
  • helper mode = its directly connected neighbors.
  • The neighbors must ignore the lack of Hellos for an indicated grace period, continue to consider the router fully adjacent and report it as fully adjacent in their Type 1 and 2 LSAs, and continue to consider the router a DR for the segment if it was elected as the DR before the graceful restart.
  • Neighbors pretend that the router undergoing a graceful restart is up and running.
  • Only routers with specific hardware can perform the graceful restart themselves because of the obvious need to have forwarding hardware autonomous and independent from the main CPU.
  • NSF-aware device can act only as a helper device.
  • NSF-capable device can act as a helper device and also perform a graceful restart themselves.
  • The following conditions must be true:
  1. The router's hardware construction allows the control plane to restart while the line cards continue to forward packets based on the last version of their forwarding database.
  2. The router whose OSPF process is restarting must notify its neighbors that the restart is happening by sending a "grace LSA", which is a Type 9 opaque LSA with link-local flooding scope, containing the estimated duration of restart (the grace period), the reason of the restart, and on multiaccess networks, the IP address of the restarting router.
  3. The LSA database remains stable during the restart.
  4. All the neighbors support, and are configured for, graceful restart helper mode.
  5. The restart takes place within a specific grace period.
  6. During restart, the neighboring fully adjacent routers must operate in helper mode.
  • Both Cisco and IETF NSF awareness are enabled by default in Cisco IOS.
  • Disable: nsf [cisco | ietf] helper disable under the routing process.


OSPF Graceful Shutdown

  • Allows the OSPF process to update the neighbors that the router is going down.
  • Using a simple shutdown command under the OSPF process, the router will immediately:
  1. Drop all OSPF adjacencies.
  2. Flush all LSAs it has originated (flood them with the MaxAge 3600 seconds).
  3. Send out Hello packets to its neighbors with the DR/BDR fields set to 0.0.0.0 and an empty neighbor list, prompting the neighbors' adjacency states to fall back to the Init state.
  4. Stop sending and receiving OSPF packets.
  • Also on a per-interface basis: ip ospf shutdown.
  • In that case, the router will immediately:
  1. Drop all OSPF adjacencies over that particular interface.
  2. Flood updated LSAs that no longer include that particular interface and adjacencies through other interfaces if any.
  3. Send the neighbors' adjacencies to the Init state.
  4. Stop sending and receiving OSPF packets over that particular interface.
  • Revert back by removing the shutdown or ip ospf shutdown command.

Monday, February 9, 2015

CCIE OCG: OSPF (Chapter 9), Part II

OSPF Design and LSAs

  • Most OSPF design choices directly impact the LSA types in a network and impose restrictions on which neighbors can exchange those LSAs.

OSPF Design Terms

  • Area Border Routers (ABRs) = Routers that connect to different areas.
  • ABRs must connect to area 0, the backbone area, and to one or more other areas.
  • Only a router that is actively attached to multiple areas, including the backbone area, considers itself an ABR and performs the appropriate functions.
  • A router actively attached to multiple areas but not to the backbone area does not consider itself an ABR and does not act like one.
  • Autonomous System Boundary Routers (ASBRs) inject external routes into the OSPF domain.
  • OSPF keeps an independent and separate LSDB for each area to which it is connected.
  • By default, the contents of per-area LSDBs are completely isolated. One LSDB does not leak into another.
  • Only the ABR can translate and carry information between the areas in a controlled way.
  • The SPF is run in each LSDB separately, and the results are combined into the routing table subject to the OSPF path preference rules.
  • Using OSPF areas provides the following benefits:
  1. Generally smaller per-area LSDBs, requiring less memory.
  2. Faster SPF computation.
  3. A link failure in one area only requires a partial SPF computation in other areas.
  4. Routes can be summarized and filtered only at ABRs.
  • The number of routers and subnet does not shrink in multiarea OSPF design, but the LSDB does.
  • An ABR does not pass denser and more detailed Type 1 and 2 LSAs between areas - instead, Type 3 LSAs are passed.

OSPF Path Selection Process

  • OSPF always chooses an intra-area route over an inter-area route for the same prefix, regardless of metric.
  • ABRs ignore Type 3 LSAs learned in a non-backbone area during SPF calculation.


LSA Types

  • Only a router that has originated a particular LSA is allowed to modify or withdraw it.
  • Other routers must process and flood this LSA, but they must never change its contents, block it, or drop it before its maximum lifetime has expired.
  • This makes sure that all routers in an area have the same LSDB contents and the same view of the network.
  • Summarization and route filtering can be done in very limited fashion vs. distance vector protocols where these functions can be performed at any point in the network.

Type 1 LSA - Router

  • One per router per area, listing the router's RID and all interface IP addresses in that area.
  • Represents stub networks as well.
  • Flooded only within its area of origin.

Type 2 LSA - Network

  • One per transit network.
  • Created by the DR on the subnet, and represents the subnet and the router interfaces connected to the subnet.
  • Flooded only within its area of origin.

Type 3 LSA - Net Summary

  • Created by ABRs to represent networks in one area when advertised into another area.
  • Defines the subnets in the origin area, and cost, but no topology data.
  • Flooded only within its area of origin; reoriginated on ABRs.

Type 4 LSA - ASBR Summary

  • Like Type 3 LSA, except it advertises a host route used to reach an ASBR.
  • Flooded only within its area of origin; reoriginated on ABRs.

Type 5 LSA - External

  • Created by ASBRs for external routes injected into OSPF.
  • Flooded to all regular areas.

Type 6 LSA - Group Membership

  • Defined for MOSPF.
  • Not supported by Cisco IOS.

Type 7 LSA - NSSA External

  • Created by ASBRs inside an NSSA, instead of a Type 5 LSA.
  • Flooded only within its area of origin; converted to Type 5 LSA on an ABR toward other areas.

Type 8 - External Attributes

  • Created by ASBRs during BGP-to-OSPF redistribution to preserve BGP attributes of redistributed networks.
  • Not implemented in Cisco routers.

Type 9-11 LSAs - Opaque

  • Used as generic LSAs to allow for easy future extension of OSPF. For example, Type 10 LSA has been adapted for MPLS traffic engineering.
  • These LSAs have different flooding scope: Type 9 has link-local flooding scope, Type 10 has area-local flooding scope, and Type 11 has autonomous system flooding scope equivalent to the flooding scope of Type 5 LSAs (not flooded into stubby areas or NSSAs).

  • Transit network: A network over which two or more OSPF routers have become
    neighbors and elected a DR so that traffic can transit from one to the other.
  • Stub network: A subnet on which a router has not formed any neighbor relationships.


LSA Types 1 and 2

  • Each router creates and floods a Type 1 LSA for itself.
  • These LSAs describe the router, its interfaces (in that area), and a list of neighboring routers (in that area) on each interface.
  • Identified by a link-state ID (LSID) equal to that router's RID
  • Type 2 LSA represents a transit subnet for which a DR has been elected.
  • The LSID is the interface IP address on that subnet.
  • Type 2 LSAs are not created for subnets on which no DR has been elected.
  • Armed with an LSDB with all the Type 1 and 2 LSAs inside an area, the SPF algorithm is able to create a topological graph of the network, calculate the possible routes, and finally choose the best routes.
  • The Type 2 LSA includes references to the RIDs of all routers that are currently neighbors of the DR on that subnet. That information, combined with the Type 1 LSAs for each router connected to the subnet represented by the Type 2 LSA, allows SPF to construct an accurate picture of the network.
  • Be aware of a long-term glitch in the show ip ospf database output: the Link ID column should say Link State ID.
  • While Link State ID is a unique identifier for an entire LSA, a Link ID is a particular entry specifically in a Type 1 LSA body that describes an adjacency to a neighboring object of a router.
  • A single Type 1 LSA identified by a single Link State ID can describe several adjacencies represented by several Link ID entries.
  • These two terms are not interchangeable.
  • The show ip ospf database command lists the LSAs in that router's LSDB in sequential order.
  • To signify a network that is down, the appropriate Type 1 or 2 LSA is either reoriginated and the disconnected network is removed from that LSA, or the entire LSA is prematurely aged by setting its age to 3600 seconds and flooding it, causing it to immediately expire from all LSDBs.


LSA Type 3 and Inter-Area Costs

  • ABRs do not forward Type 1 and 2 LSAs from one area to another.
  • ABRs advertise Type 3 LSAs, which represent subnets described in both Type 1 and 2 LSAs in another area.
  • Describe a simple inter-area destination: the subnet, the mask, and the ABR's cost to reach that subnet.

S2# show ip ospf database
! Lines omitted for brevity
Summary Net Link States (Area 0)
Link ID    ADV Router  Age   Seq#        Checksum
10.3.0.0   1.1.1.1     257   0x80000001  0x00A63C
10.3.2.0   1.1.1.1     257   0x80000001  0x009A45
10.3.13.0  1.1.1.1     261   0x80000021  0x007747

S2# show ip ospf database summary 10.3.0.0
OSPF Router with ID (8.8.8.8) (Process ID 1)
Summary Net Link States (Area 0)
Routing Bit Set on this LSA
LS age: 341
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 10.3.0.0 (summary Network Number)
Advertising Router: 1.1.1.1
LS Seq Number: 80000001
Checksum: 0xA63C
Length: 28
Network Mask: /23
        TOS: 0 Metric: 74


  • Next, S2's routes to all three subnets are listed. S2 calculates its cost based on its cost to reach R1, plus the cost listed in the type 3 LSA.

S2# show ip route ospf
O IA 10.3.0.0/23 [110/75] via 10.1.1.1, 00:05:08, Vlan1

S2# show ip ospf border-routers
OSPF Process 1 internal Routing Table
Codes: i – Intra-area route, I – Inter-area route


i 1.1.1.1 [1] via 10.1.1.1, Vlan1, ABR, Area 0, SPF 18


  • Routers calculate the cost for a Typer 3 LSA route by adding the following:
  1. The calculated cost to reach the ABR that created and advertised the Type 3 LSA. (show ip ospf database summary <link-id>).
  2. The cost as listed in the Type 3 LSA. (show ip ospf border-routers)
  • When a Type 1 or 2 LSA changes in some way, each router in the area runs SPF, but routers inside other areas do not. They only run minor modications - a process called a partial run, partial SPF, or partial route calculation.
  • Type 3 summary LSAs are flooded only within the are into which they were originated by ABRs.
  • An ABR uses only Type 3 LSAs received over a backbone area in its calculation. Type 3 LSAs received over non-backbone areas will be skipped during the ABR's SPF computation, though they are stored in the ABR's LSDB and flooded within that non-backbone area as usual.
  • Only intra-area routes from non-backbone areas are advertised into the backbone; both intra-area and inter-area routes are advertised from the backbone into non-backbone areas.

LSA Types 4 and 5, and External Route Types 1 and 2

  • OSPF allows for two types of external routes, aptly named types 1 and 2.
  • The type determines whether only the external metric is considered by SPF when picking the best routes (external type 2, or E2), or whether both the external and internal metrics are added together to compute the metric (external type 1, or E1).
  • By default, Cisco routers use the E2 metric type in redistribution.
  • When an ASBR injects an external route, it creates a Type 5 LSA for the subnet.
  • The LSA lists the metric and the metric type.
  • The ASBR then floods the Type 5 LSA throughout all regular areas.
  • If the LSA contains the E1 metric, the total cost of the external network is the cost of reaching the ASBR + the E1 cost carried in the LSA.
  • If the LSA contains the E2 metric, this metric is used exactly as it is indicated in the LSA.
  • If there are multiple paths, the path with the least total cost is used. Otherwise, all of them will be used.
  • No additional costs are ever summed with the E2 metric.
  • If there are multiple paths, the path with the lowest E2 metric is used.
  • If there are still multiple paths, the path through the closest ASBR is used.
  • If there ara still multiple paths, all of them will be used.
  • If there are both E1 and E2 routes to the same network, the E1 is always preferred to E2.
  • With both E1 and E2 metric types, it is necessary to compute the metric to the ASBR.
  • Within the area where the ASBR resides, this is simply the least-cost path from the computing router to the ASBR as computed using Type 1 and 2 LSAs.
  • When an ABR floods the Type 5 LSA into another area, it creates a Type 4 LSA, containing the ASBR's RID and the ABR's metric to reach the ASBR.
  • Routers in other areas use the Type 4 LSA to know what ASBRs in other areas exist, what ABRs can be used to reach them, and what is the distance of each ABR to a particular ASBR.
  • For a router in a different area, the total cost of reaching the ASBR = the cost to the ABR + the cost between the ABR and ASBR (as indicated in the Type 4 LSA).
  • Type 4 LSA is not required in the area where the ASBR resides.

R3# show ip ospf database | begin Type-5
Type-5 AS External Link States
Link ID       ADV Router  Age    Seq#          Checksum    Tag 

192.168.1.0   7.7.7.7     1916   0x8000002B    0x0080EF    0
192.168.2.0   7.7.7.7     1916   0x80000028    0x00FEF2    0


R3# show ip ospf database external 192.168.2.0
OSPF Router with ID (3.3.3.3) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA
LS age: 1969
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 192.168.2.0 (External Network Number)
Advertising Router: 7.7.7.7
LS Seq Number: 80000028
Checksum: 0xFEF2
Length: 36

Network Mask: /24
      Metric Type: 2 (Larger than any link state path)
      TOS: 0
      Metric: 20
      Forward Address: 0.0.0.0
      External Route Tag: 0


  • Note about the usage of summary in OSPF:
  1. Type 3 and 4 LSAs are called summary LSAs.
  2. The term LSA summary refers to the LSA headers that identify LSAs and are sent inside DD packets.
  3. The term summary can also be used to refer to summary routes created with the area range and summary-address commands.


Stubby Areas

  • Areas that do not perform any automatic filtering on the type of accepted information are called regular areas.
  • Stubby areas take advantage of the fact that not all areas need to have knowledge about individual external networks.
  • The advantage of knowing the external networks is only visible if there were multiple ABRs in the current area and multiple ASBRs in other areas, so the least-cost paths could be chosen individually.
  • The connectivity to external networks can be equivalently provided to a stubby area by replacing the list of external networks with a simple default route injected by the area's ABRs.
  • If an area is configured as a stubby area, ABRs will stop advertising Type 4 and 5 LSAs into this area.
  • In addition, the ABRs will automatically inject a default route into the area as Type 3 LSA.
  • The connectivity to external networks is still guaranteed but the LSDBs will be sparser.
  • The visibility of intra-area and inter-area networks is not affected in any way.
  • OSPF defines several different types of stubby areas.
  • By definition, all stubby areas stop Type 4 (ASBR summary) and Type 5 (external) LSAs.
  • However, a stubby area might also prevent Type 3 LSAs from being injected, causing the area to stop seeing individual inter-area routes as well.
  • Another variation includes whether a router inside the stubby area can redistribute routes into OSPF, thereby injected an external route.
  • When the name includes "totally", Type 3 LSAs are not passed into the area, except the Type 3 LSA carrying the default route.
  • If the name includes "NSSA", it means that external routes can be redistributed into OSPF by routers inside the stubby area (in Type 7 LSAs, because Type 5 LSAs are prohibited).
  • To configure stubby areas, all routers attached to the area must be configured with the exact same command for each stubby area type.
  • However, in totally stubby areas, non-ABRs should omit the no-summary keyword because the additional Type 3 LSA filtering is performed only by the ABR.
  • An NSSA is still a stubby area in the sense that external routes from other areas are not advertised to it.
  • However, an NSSA can hold an ASBR and perform external route injection.
  • This external information is carried in Type 7 LSAs to distinguish it from normal external routes in Type 5 LSAs, which are still prohibited even in NSSAs.
  • A default route is not advertised into the NSSA automatically.
  • ABRs must be configured with the area <area-id> nssa default-information-originate command.
  • All other non-regular area types will inject a default route automatically, including totally NSSA (NSSA-TS).
  • ABRs convert Type 7 LSAs to Type 5 LSAs before forwarding them into another area.
  • If using NSSAs, N1 refers to NSSA-external Type 1 routes and N2 to NSSA-external Type 2. The differences are equivalent to differences between E1 and E2 routes.


OSPF Path Choices That Do Not Use Cost

  • Under most circumstances, when an OSPF router runs the SPF algorithm and finds more than one possible route to reach a particular subnet, the router chooses the route with the least cost.
  • However, OSPF does considers a few conditions other than cost when making this best-path decision.
  • It is possible for a router to find multiple routes to reach a given subnet where the type of route (intra-area, inter-area, E1/N1, or E2/N2) is different.
  • In these cases, the router should ignore the costs and instead choose the best route based on the following order of preference:
    1. Intra-area routes.
    2. Inter-area routes.
    3. E1/N1 routes (equivalent).
    4. E2/N2 routes (equivalent).
  • When an ABR originates type 3 LSAs on behalf of known routes, it translates only intra-area routes from a nonbackbone area into type 3 LSAs and floods them into the backbone, and it translates both intra-area and inter-area routes from the backbone area into type 3 LSAs and floods them into nonbackbone areas.
  • When an ABR runs the SPF algorithm, it ignores all type 3 LSAs received over nonbackbone areas.
  • The first rule essentially makes sure that the only valid way of one area learning about
    routes in another area is through the backbone, and that the backbone is never fed a
    route that must have already traversed the backbone.
  • The second rule makes sure that an ABR does not traverse a nonbackbone area to reach
    a network that is located in the backbone or in some other nonbackbone area.