Sunday, May 3, 2015

400-101: BGP, Part III:I

3.7.d Implement, Optimize and Troubleshoot Routing Policies


3.7d(i) Attribute Manipulation


The BGP Path attributes can be manipulated to influence the BGP best path decision. In short, the BGP best path selection process is based on the following items:

  1. Largest WEIGHT attribute.
  2. Largest LOCAL_PREF attribute.
  3. Locally originated routes (Next hop 0.0.0.0 in the BGP RIB).
  4. Shortest AS_PATH attribute.
  5. Best route ORIGIN attribute: IGP, EGP, INCOMPLETE.
  6. Lowest MED attribute.
  7. EBGP routes are preferred over IBGP routes (and also have lower administrative distance).
  8. The oldest route first (older routes are more stable).
  9. The path that originated from the router with the lowest BGP router ID.
  10. If the router is a route reflector, the lowest CLUSTER_ID attribute length.
  11. Routes received from the peer with the lowest IP address.

The BGP path attributes can be altered in a number of ways to modify BGP routing on a Cisco router—using route maps, attribute maps, prefix lists, AS path access lists, regular expressions, and more.

More information about the BGP path attributes: On The Table: BGP Path Attributes.

Let's look at some common ways to manipulate the BGP path attributes.

 

Manipulating the WEIGHT

  • WEIGHT is a Cisco proprietary attribute.
  • Only locally significant. Not advertised to any BGP peers.
  • WEIGHT values range from 0 to 65,535.
  • Paths that the router originates have a WEIGHT of 32,768 by default, and other paths have a WEIGHT of 0.
  • A higher WEIGHT is preferred.

Per neighbor.
router bgp 100
 neighbor 1.1.1.1 weight 100



Selectively per route(s). Note: private IP addresses are normally filtered in BGP (only used as an example here).

ip prefix-list RFC1918 seq 10 permit 10.0.0.0/8
ip prefix-list RFC1918 seq 20 permit 172.16.0.0/12
ip prefix-list RFC1918 seq 20 permit 192.168.0.0/16
!
route-map WEIGHT-100 permit 10
 match ip address prefix-list RFC1918
 set weight 100
route-map WEIGHT-100 permit 20
!
router bgp 100
 neighbor 1.1.1.1 route-map WEIGHT-100 in



Manipulating the LOCAL PREFERENCE

  • The concept is similar to WEIGHT.
  • Range 0-4294967295.
  • Advertised within the local AS.
  • A higher local preference value is preferred.

 Apply a local preference of 200 to RFC 1918 defined private IP address ranges. Note: private IP addresses are normally filtered in BGP (only used as an example here).

ip prefix-list RFC1918 seq 10 permit 10.0.0.0/8
ip prefix-list RFC1918 seq 20 permit 172.16.0.0/12
ip prefix-list RFC1918 seq 30 permit 192.168.0.0/16
!
route-map LP-200 permit 10
 match ip address prefix-list RFC1918
 set local-preference 200
route-map LP-200 permit 20

router bgp 100
 neighbor 150.1.2.2 route-map LP-200 out


The result.
R2#show ip bgp
BGP table version is 28, local router ID is 150.1.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i10.0.0.0         150.1.3.3                0    200      0 i
*>i172.16.0.0/12    150.1.3.3                0    200      0 i
*>i192.0.2.0        150.1.3.3                0    100      0 100 i
*>i192.168.0.0/16   150.1.3.3                0    200      0 i
*>i198.51.100.0     150.1.3.3                0    100      0 100 i
*>i203.0.113.0      150.1.3.3                0    100      0 100 i



Manipulating the AS_PATH

  • The local AS number is prepended into the AS_PATH attribute when the route is advertised to external BGP peers.
  • The AS_PATH attribute is a common tie breaker for Internet routes. By default, a route received from two ISPs and the preceding attributes unmodified, the AS_PATH length is the deciding factor.
  • A shorter AS_PATH length is preferred.
  • Multiple AS numbers can be manually forced into the AS_PATH, making the length longer and the route less preferred for inbound traffic.

Before manipulation.
R2#show ip bgp
BGP table version is 4, local router ID is 150.1.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 192.0.2.0        150.1.1.1                0             0 100 i
*> 198.51.100.0     150.1.1.1                0             0 100 i
*> 203.0.113.0      150.1.1.1                0             0 100 i



The configuration. Prepend {100 100} into the AS_PATH for RFC 5737 defined public subnets.

ip prefix-list RFC5737 seq 10 permit 192.0.2.0/24
ip prefix-list RFC5737 seq 20 permit 198.51.100.0/24
ip prefix-list RFC5737 seq 30 permit 203.0.113.0/24
!
route-map AS-ADD permit 10
 match ip prefix-list RFC5737
 set as-path 100 100
route-map AS-ADD permit 20
!
router bgp 100
 no synchronization
 neighbor 150.1.2.2 remote-as 200
 neighbor 150.1.2.2 update-source Loopback0
 neighbor 150.1.2.2 ebgp-multihop 2
 neighbor 150.1.2.2 route-map AS-ADD out
 network 192.0.2.0
 network 198.51.100.0
 network 203.0.113.0
 no auto-summary


After manipulation.
R2#show ip bgp
BGP table version is 7, local router ID is 150.1.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 192.0.2.0        150.1.1.1                0             0 100 100 100 i
*> 198.51.100.0     150.1.1.1                0             0 100 100 100 i
*> 203.0.113.0      150.1.1.1                0             0 100 100 100 i


 

Manipulating the MED

  • The MED attribute is advertised to external peers to influence incoming traffic.
  • The neighbor AS propagates the MED within its local AS but does not advertise it outside the AS.
  • A lower MED is preferred.
  • The MED attribute is commonly referred to as the BGP metric.

Adding to the configuration from the previous example. Advertise the routes to BGP neighbor 150.1.2.2 with a MED of 50.

route-map AS-ADD permit 10
 match ip address prefix-list RFC5737
 set metric 50
 set as-path prepend 100 100
!
router bgp 100
 neighbor 150.1.2.2 route-map AS-ADD out


Add R3 to AS 200. Do not manipulate any attributes.

router bgp 100
 neighbor 150.1.3.3 remote-as 200
 neighbor 150.1.3.3 ebgp-multihop 2
 neighbor 150.1.3.3 update-source Loopback0


The result. R2 learns the routes from both R1 (EBGP) and R3 (IBGP; next-hop-self).

R2#show ip bgp
BGP table version is 22, local router ID is 150.1.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i192.0.2.0        150.1.3.3                0    100      0 100 i
*                   150.1.1.1               50             0 100 100 100 i
*>i198.51.100.0     150.1.3.3                0    100      0 100 i
*                   150.1.1.1               50             0 100 100 100 i
*>i203.0.113.0      150.1.3.3                0    100      0 100 i
*                   150.1.1.1               50             0 100 100 100 i

400-101: BGP, Part II

3.7.b Implement and Troubleshoot IBGP and EBGP

 

3.7b(i) EBGP, IBGP


The main difference between internal BGP (IBGP) and external BGP (EBGP) happens in BGP peering (neighbor x.x.x.x remote-as <asn>). IBGP is run between neighbors within the same autonomous system, EBGP is needed between peers in different autonomous systems.

Key behavioral differences between IBGP and EBGP:
  • Administrative distance: 20 for EBGP, 200 for IBGP.
  • By default, EBGP peers have TTL=1, which means the neighbors are assumed to be directly connected.
  • IBGP peers have a default TTL=255.
  • The next-hop is not changed when a route is advertised to an IBGP peer.
  • The next-hop is updated for each EBGP peer.
  • Loop prevention in IBGP: fully meshed neighbors or route reflectors (routes learned from IBGP are not advertised to other IBGP peers, exception route reflectors). The local AS is not included in the AS_PATH attribute when advertising to IBGP peers.
  • Loop prevention in EBGP: the AS_PATH attribute. When a route advertisement is sent out to an external peer, the AS number is written into the AS_PATH attribute. If a BGP speaker receives a route with its own AS in the AS_PATH, the update is silently discarded.


3.7b(ii) The 4-byte AS number


Similar to IPv4, the public AS number space is being allocated quickly. The 2-byte space provides the AS number range 0-65535, of which IANA reserves 64512-65534 for private purposes. Much like IPv6 was introduced to solve the IPv4 depletion problem, the 4-byte AS number has been created to solve the 2-byte AS number depletion problem. The 4-byte AS number format provides over four billion AS numbers. The 2-byte and the 4-byte AS numbers are interoperable. The 2-byte ASNs can be represented in the low-order bits, the high-order values set to 0.

Three ways of representing the 4-byte ASN:
  • asplain is a simple decimal representation of the ASN (0-4294967295).
  • asdot+ breaks the ASN in half into high-order and low-order values (16 bits each). Examples: 65535 = 0.65535, 65536 = 1.0.
  • asdot is a mixture of asplain and asdot+. Anything in the 2-byte AS number range is written in asplain and anything above that is written as asdot+.  

The asplain notation is the Cisco IOS default notation. However, Cisco IOS will support asdot via a configuration option.

 router bgp 1.1
  bgp asnotation dot


The use of the 4-byte ASN is agreed upon BGP Capabilities Advertisement during the initial session negotiation. If the neighbor does not support the new format, BGP uses a reserved 2-byte ASN 23456, called AS_TRANS. Rather than adding its own 4-byte AS number to the AS_PATH, BGP prepends the AS_TRANS. The router also adds a new attribute AS4_PATH, which carries a list of the real AS numbers (both 4-byte and 2-byte). The AS4_PATH is an optional transitive attribute.

Border Gateway Protocol - UPDATE Message

Path Attribute - AS4_PATH: 655361 2621441

Flags: 0xc0: Optional, Transitive, Complete
Type Code: AS4_PATH (17)
Length: 10
AS Path segment: 655361 2621441
Segment type: AS_SEQUENCE (2)
Segment length (number of ASN): 2
AS4: 655361
AS4: 2621441


Path Attribute - AS_PATH: 23456 23456
Flags: 0x40: Well-known, Transitive, Complete
Type Code: AS_PATH (2)
Length: 6
AS Path segment: 23456 23456
Segment type: AS_SEQUENCE (2)
Segment length (number of ASN): 2
AS2: 23456
AS2: 23456


When needed, the AGGREGATOR attribute is modified similarly. The BGP speaker replaces the 4-byte AS number with AS_TRANS and puts the real AS number in a new optional transitive attribute called AS4_AGGREGATOR.


3.7b(iii) Private AS


As briefly mentioned in the previous section, IANA has reserved 1023 AS numbers for private use (64512-65534 inclusive). Private AS numbers operate identically to private IP addresses, they cannot leak into the global routing table. A router should strip off private AS numbers before propagating NLRI to an eBGP peer. To remove the private AS number, use the neighbor x.x.x.x remove-private-as command.

Example:

R1#
router bgp 65001
 neighbor 172.16.0.2 remote-as 2

R2#
router bgp 2
 neighbor 172.16.0.1 remote-as 65001
 neighbor 192.168.0.3 remote-as 3
 neighbor 192.168.0.3 remove-private-as

R3#
router bgp 1
 neighbor 192.168.0.2 remote-as 2


A few conditions that apply:
  • You can only use this solution with external BGP (eBGP) peers.
  • If the update has only private AS numbers in the AS_PATH, BGP removes these numbers.
  • If the AS_PATH includes both private and public AS numbers, BGP doesn't remove the private AS numbers. This situation is considered a configuration error.
  • If the AS_PATH contains the AS number of the eBGP neighbor, BGP does not remove the private AS number.
  • If the AS_PATH contains confederations, BGP removes the private AS numbers only if they come after the confederation portion of the AS_PATH.

Saturday, May 2, 2015

400-101: BGP, Part I

3.7a Describe, Implement and Troubleshoot Peer Relationships


3.7a(i) Peer-group, template

 

Peer Group

  • BGP peer groups reduce CPU utilization and simplify BGP syntax.
  • The routing table is checked only once and the updates are replicated to all peer group members instead of doing it individually for each peer.
  • You can group BGP neighbors that share the same outbound policies.
  • The policies are applied to the group rather than individual peers.
  • The outbound update policy must be identical between the peers but the inbound update policy can be customized for any member of a peer group.

Example:

router bgp 100
 neighbor IBGP peer-group
 neighbor IBGP remote-as 100
 neighbor IBGP update-source Loopback0
 neighbor 1.1.1.1 peer-group IBGP
 neighbor 2.2.2.2 peer-group IBGP
 neighbor 3.3.3.3 peer-group IBGP


Without the peer group the AS number and source interface would have been specified individually for each peer.


Template

  • An optimization of BGP peer groups.
  • Uses the concept of inheritance to apply policies.
  • Two types of peer templates: peer session templates and peer policy templates.
  • Peer session templates are used to group and apply general BGP session establishment configuration.
  • Peer policy templates are used to group and apply NLRI advertisement policies.
  • A peer template can directly or indirectly inherit the configuration from another peer template.
  • A directly inherited template will overwrite any indirectly inherited statements that are duplicated in the directly inherited template.
  • A BGP neighbor can directly inherit only one session template and indirectly inherit up to seven additional session templates.

Example (peer session template):

-- WITHOUT INHERITANCE --

router bgp 100
 template peer-session IBGP
  remote-as 100
  update-source Loopback0
 exit-peer-session
!
 neighbor 1.1.1.1 inherit peer-session IBGP
 neighbor 2.2.2.2 inherit peer-session IBGP
 neighbor 3.3.3.3 inherit peer-session IBGP


-- WITH INHERITANCE --

router bgp 100
 template IBGP
  remote-as 100
  inherit peer-session UPDATE-SOURCE
 exit-peer-session
!
 template UPDATE-SOURCE
  update-source Loopback0
 exit-peer-session
!
 neighbor 1.1.1.1 inherit peer-session IBGP
 neihgbor 2.2.2.2 inherit peer-session IBGP
 neighbor 3.3.3.3 inherit peer-session IBGP



Example (peer policy template):

ip prefix-list DENY-PRIVATE-IP seq 10 deny 10.0.0.0/8
ip prefix-list DENY-PRIVATE-IP seq 20 deny 172.16.0.0/12
ip prefix-list DENY-PRIVATE-IP seq 30 deny 192.168.0.0/16
ip prefix-list DENY-PRIVATE-IP seq 40 permit 0.0.0.0/0 le 32
!
router bgp 100
 template peer-policy IBGP-POLICY
  inherit peer-policy FILTER-PRIVATE 10
  inherit peer-policy NEXT-HOP-SELF 20
 exit-peer-policy
!
 template peer-policy FILTER-PRIVATE
  prefix-list DENY-PRIVATE-IP out
 exit-peer-policy
!
 template peer-policy NEXT-HOP-SELF
  next-hop-self
 exit-peer-policy
!
neighbor 1.1.1.1 inherit peer-policy IBGP-POLICY
neighbor 2.2.2.2 inherit peer-policy IBGP-POLICY
neighbor 3.3.3.3 inherit peer-policy IBGP-POLICY


Inherited peer policy templates are configured with sequence numbers like route-maps.


3.7a(ii) Active, Passive

  • BGP is essentially a standard TCP based protocol, which means that it is client and server based. 
  • Normally, the role of client and server are negotiated dynamically during BGP session establishment (lower BGP RID becomes the server).  
  • The neighbor x.x.x.x transport connection mode {active | passive} command can be used to manually set the client (active) and server (passive) roles.

Example:

R1#
router bgp 100
 neighbor 150.1.2.2 remote-as 100
 neighbor 150.1.2.2 update-source Loopback0

R2#
router bgp 100
 neighbor 150.1.1.1 remote-as 100
 neighbor 150.1.1.1 update-source Loopback0


By default, R1 becomes the server (TCP port 179) because of the lower BGP RID 150.1.1.1.

R1#show ip bgp neighbors | inc BGP neighbor|Local host|Foreign host
BGP neighbor is 150.1.2.2,  remote AS 100, internal link
Local host: 150.1.1.1, Local port: 179
Foreign host: 150.1.2.2, Foreign port: 46662


Let's explicitly specify R1 as the client (active).

R1#
router bgp 100
 neighbor 150.1.2.2 transport connection-mode active


As expected, R1 now operates as the client.

R1#show ip bgp neighbors | inc BGP neighbor|Local host|Foreign host
BGP neighbor is 150.1.2.2,  remote AS 100, internal link
Local host: 150.1.1.1, Local port: 64038
Foreign host: 150.1.2.2, Foreign port: 179



3.7a(iii) States, timers

 

States

 

Idle: BGP is initializing its resources (refuses incoming BGP session requests).
  • Verify that the peers have correct IP address and AS number configuration (BGP does not accept connections from unknown BGP peers).
  • Make sure that the routers can reach each other using the configured IP addresses and TCP port 179.

Connect: BGP is waiting for the transport protocol connection to be completed. If successful, the state transitions to OpenSent (the OPEN message is sent). If unsuccessful, the state transitions to Active. If BGP peers get stuck in the Connect state, it is usually because of a configuration error.
  • Check inbound and outbound TCP connectivity on port 179 (and random TCP port greater than1023).
  • Verify IP addresses and AS numbers.

Active:  BGP is unable to establish a successful TCP connection with its neighbor. A neighbor state that is oscillating between Connect and Active typically indicates a problem with the TCP transport connection.

OpenSent: The BGP peer waits for an OPEN message from its peer. After an OPEN message has been received, it is checked for validity. At this time, all fields in the OPEN message are checked against the local BGP configuration.  In case of errors, an error NOTIFICATION is sent and the state goes back to Idle. If no errors, BGP starts sending KEEPALIVE messages.

OpenConfirm: The local router is waiting for the receipt of a KEEPALIVE message from its peer. Upon receipt of a KEEPALIVE message, the BGP session transitions to the Established state.

Established: BGP peers reach the Established state after they have successfully exchanged OPEN and KEEPALIVE messages. After the peers reach the Established state, they begin to send UPDATE messages containing routing information and KEEPALIVE messages to verify the TCP Connection state. If an error is encountered at any time while a peer is in the Established state, the local peer sends a NOTIFICATION message with the reason for the error and transitions back to the Idle state.


BGP Timers


KEEPALIVE: BGP session "refresh" timer that signals the router's presence to its BGP peers. 60 seconds by default.

HOLD-TIME: BGP session "validity" timer that tells the router how long to wait for a KEEPALIVE (or UPDATE) message from its peer. 180 seconds (3x KEEPALIVE) by default. If the HOLDDOWN timer expires, the neighbor is declared dead and the routes from this neighbor are flushed.

For all neighbors.
router bgp 100
 timers bgp 60 180


Per neighbor.
router bgp 100
 neighbor 1.1.1.1 timers 60 180


The timer values are exchanged during the BGP peer establishment and negotiated to the lower values.

ADVERTISEMENT TIMER: A minimum delay between updates sent to a neighbor. Introduced to maintain a stable routing table. By default, 30 seconds for eBGP peers and 0 seconds for iBGP peers.

router bgp 100
 neighbor 6.6.6.6 advertisement-interval 30


SCAN TIMER: Designed to go over the BGP prefix-tables every 60 seconds (default) and validate if an IGP route to the next-hop is reachable.

router bgp 100
 bgp scan-time 60



NEXT-HOP TRACKING (NHT): An event-driven system to provide faster convergence (optimization over the BGP scan timer). NHT monitors the RIB for next-hop related changes for both iBGP and eBGP prefixes and reports such events to the BGP process.

The delay interval between full routing table walks should match the tuning parameters for the IGP. The default delay interval is 5 seconds, which is an optimal value for a fast-tuned IGP. Aggressively dampening unstable IGP peering sessions is recommended to mitigate possible impact to BGP.

router bgp 100
 bgp nexthop trigger enable
 bgp nexthop trigger delay 5



UPDATE-DELAY: The maximum initial delay before a BGP speaker sends its first update. 120 seconds by default.

router bgp 100
 bgp update-delay 120



AGGREGATE-TIMER: Controls how often routes will be aggregated. Even if  using aggregate-address … summary-only, more specific routes will be advertised and later withdrawn when the timer kicks in.

The range is from 6 to 60 or else 0. The default is 30. A value of 0 disables timer-based aggregation and starts aggregation immediately.

router bgp 100
 bgp aggregate-timer 30



3.7a(iv) Dynamic Neighbors


The BGP dynamic neighbor feature allows BGP peering to a group of remote neighbors that are defined by a range of IP addresses (each range is a subnet) instead of individually configuring each neighbor.

Example: The BGP dynamic neighbor feature is extremely useful in a hub-and-spoke topology. On the hub, BGP dynamic neighbors allows BGP peering based on the peer group without having to use any individual  neighbor statements to specify who those neighbors actually are. The neighbors are learned dynamically. Normal BGP configuration (static neighbor statements) is required on the spokes. Still, the overeall BGP configuration is simplified drastically. BGP dynamic neighbors are an efficient way to support hundreds or even thousands of BGP sessions with minimal configuration.

router bgp 100
 neighbor HUB-AND-SPOKE peer-group
 neighbor HUB-AND-SPOKE remote-as 100
 bgp listen range 192.168.0.0/16 peer-group HUB-AND-SPOKE
 bgp listen limit 200


Optional Commands:
  • bgp listen limit <max-num> sets a limit (maximum number) of BGP dynamic neighbors.
  • neighbor HUB-AND-SPOKE remote-as 100 alternate-as <as-num1> ... <as-num5> identifies up to five alternate AS numbers for listen range neighbors.

Router# show ip bgp summary
BGP router identifier 192.168.3.1, local AS number 100
BGP table version is 1, main routing table version 1
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
*192.168.3.3    4    100    3       3        1      0    0 00:00:37        0
*192.168.3.2    4    100    6       6        1      0    0 00:04:36        0
* Dynamically created based on a listen range command
Dynamically created neighbors: 2/(200 max), Subnet ranges: 1
BGP peergroup HUB-AND-SPOKE listen range group members:
  192.168.0.0/16

Tuesday, April 21, 2015

BGP: Internet Routing Architectures, Part III

Optimal routing solution:
  1. Redundancy: providing multiple alternative paths for the traffic.
  2. Symmetry: having traffic that leaves the AS from an exit point return through the same point.
  3. Load balancing: dividing traffic optimally over multiple links. Extremely challenging because multiple providers control and manipulate traffic that transits any AS.

REDUNDANCY

  • Connectivity is not the responsibility of one entity.
  • At any time, human error, software errors, physical errors, or adverse unforeseen conditions can jeopardize connectivity. Hence, redundancy is desirable.
  • However, the more redundancy a network has, the more unpredictable the traffic entrance and exit points are.
  • Traffic might exit on one point and come back on another.
  • Alternate routes translate into additional routing overhead.
  • Default routes become viable because they minimize resource consumption and provide "maximum" redundancy.
  • Any router advertising the universally known default route 0.0.0.0/0 represents itself as a gateway of last resort for other systems.
  • Default routes can be static or dynamic and they can point to a network or an exit interface.
  • It is important for defaults to disappear dynamically if what they point to disappears.
  • Selected default networks should not be specific subnets.
  • A subnet that is flip-flopping might cause your default to come and go constantly. It is much better to point the default to a major aggregate or supernet that reflects the stability of a whole provider rather than a particular link.
  • Multiple default routes can be used simultaneously.
  • One way to set multiple static defaults is to point to multiple networks (using aggregates if possible for stability reasons) and establish a degree of preference by using the local preference BGP attribute.
  • Another way is to use the distance parameter (the lower distance wins).
  • The distance parameter is not exchanged between routers, so this would work only in the case of one router connected via multiple connections.
  • If a route is associated with an interface, the interface must be unavailable before the route becomes invalid. In some cases, the interface will still be active, even if the virtual circuit has failed.

SYMMETRY

  • Traffic leaving from a given exit point and coming back through the same point.
  • Easy to achieve with a single point.
  • With redundancy (multiple connections), traffic tends to be asymmetrical.
  • In some situations, asymmetrical traffic is acceptable and does not pose significant problems.
  • In general, symmetrical routing is better because it minimizes potential delays that could result otherwise.
  • To accommodate symmetry, you should designate a primary link and make the utmost effort to direct the majority of traffic to flow on this link.

LOAD BALANCING

  • The capability to divide data traffic over multiple connections.
  • A common misconception about balancing is that it means an equal distribution of the load.
  • Equal distribution is difficult, if not impossible to achieve in most scenarios.
  • Load balancing tries to achieve a traffic distribution pattern that will best utilize the multiple links that provide redundancy.
  • Traffic should be thought of as two separate entities: inbound and outbound.
  • Inbound traffic is affected by how the AS advertises its networks to the outside world, whereas outbound traffic is affected by the routing updates coming in from outside ASes.


SCENARIO 1: SINGLE-HOMING

  • A single connection to a service provider.
  • Only a default route required.
  • The least expensive and the most effective method.
  • No need for BGP between the customer and the service provider.
  • Symmetric routing but no redundancy.
  • Obviously, not suitable for satisfying mission-critical data communication requirements.


SCENARIO 2: MULTIHOMING TO A SINGLE PROVIDER

  • Multiple connections to the same service provider.
  • Although not necessary in all cases, BGP will provide the most flexibility.
  • Possible to use a private AS.

Default Only, One Primary Link, and One Backup Link

  • Preference over the default route can be set with administrative distance or local preference if BGP is used.
  • Load balancing is not an option.
  • Inbound traffic is out of the customer's control.
  • The customer could affect incoming traffic by advertising different metrics.

Default, Primary and Backup, Plus Partial Routing

  • Same scenario as before but the customer also accepts partial routing information from the service provider.
  • Local preference is used to manipulate the preference based on AS path or IP prefix.
  • For all other Internet routes not known to the customer, default will be taken in the primary and backup default manner.
  • A totally different approach is for the provider to send its metrics (MED) toward the customer.
  • Less configuration on customer site but totally dependent on the provider delivering accurate MEDs.
  • The customer can influence inbound traffic by advertising different metrics on different links.
  • Some providers encourage their customers to send their internal IGP metrics as BGP metrics.

Default, Primary and Backup, Plus Full and Partial Routing

  • Multihomed to a single provider.
  • Local preference is used to control the customer's outbound traffic, and the metric is used to control the inbound traffic.
  • CAUTION: When dealing with outbound traffic, manipulating exit points for specific routes is dangerous. Routing loops can occur if outbound traffic following an IGP default toward the customer's BGP router is directed toward another router following default to the BGP router.


AUTOMATIC LOAD BALANCING

  • Cisco IOS software supports dynamic load balancing on a single router for identical destinations learned via EBGP that are sourced from the same autonomous system.
  • A Cisco router will keep (locally in its IP routing table) up to six identical BGP routes to the same destination (dictated by the maximum-paths command).
  • However, BGP installs only a single best route by default. BGP Multipath can be used to install multiple paths.
  • When passing on the EBGP updates to the IBGP peers, however, the router will pass only its singular best route for a particular destination.
  • By default, a Cisco router will load balance on a per-destination (host) basis in a round-robin fashion.
  • Does not work in a multiprovider environment.


SCENARIO 3: MULTIHOMING TO DIFFERENT PROVIDERS

Redundancy and geographical restrictions are strong motivations for multihoming.

Default Only, Primary and Backup

  • A customer can set or learn the default routes to the two providers either through static routes or through both providers' dynamic advertisements of default routes.
  • The customer can prefer one default over another by using administrative distance or local preference.

 

Default, Primary and Backup, Plus Partial Routing

  • By accepting partial routing from the providers, the customer does not need to see all Internet routes and can still make best routing decisions.
  • For the more specific routes, BGP will choose the provider link closer to the destination.
  • For other Internet routes, the basic principle of primary and backup default route can be used.

 

Default, Primary and Backup, Plus Full and Partial Routing

  • Accepting full routes from either or both providers is not really necessary unless the customer plans to be a provider itself and advertise full routes to its customers.
  • For effective load balancing, the customer can accept full routing from one or both providers.
  • In some cases, the customer might want to accept full routing from one provider and implement partial/default routing with the other provider

Customer Inbound Traffic

  • In a multiprovider scenario, sending different metrics from the customer's end will not have any effect because the MED value is non-transitive.
  • Only the customer's direct upstream provider will learn the MED value but it is not passed along.
  • Instead, the AS path attribute could be manipulated. By adding bogus AS entries to affect the length would make the route less desirable.

Sunday, April 12, 2015

BGP: Internet Routing Architectures, Part II

BUILDING PEER SESSIONS

  • A BGP neighbor connection can be established within the same AS (internal BGP or iBGP) or between routers in different ASs (external BGP or eBGP).
  • During the OPEN message exchange, peer routers compare ASs to determine if they are in the same or different AS.
  • The difference between iBGP and eBGP is how BGP would process the routing updates and which attributes are carried in internal vs. external BGP.
  • The neighbor negotiation process is mainly the same for internal and external BGP.
  • IP connectivity must exist via a protocol different from BGP.

PHYSICAL vs. LOGICAL CONNECTIONS

  • Indirectly connected external neighbors require extra configuration (multihop eBGP).
  • On the other hand, neighbors within the same autonomous system (internal neighbors) have no restrictions whatsoever on whether the peer is physically connected or separated by multiple IP hops.
  • As long as there is IP connectivity between the two neighbors, BGP requires no additional configuration.
  • Session stability depends on the stability of neighbor IP address.
  • Binding the BGP neighbor connection to a loopback interface will ensure that the BGP session is not reliant on any hardware interface that might be problematic.
  • Other than route reflection, BGP does not readvertise iBGP routes learned from other iBGP peers.
  • Thus, a full mesh within the AS is required.

SYNCHRONIZATION WITHIN AN AS

  • By default, BGP requires that it must be synchronized with the IGP before BGP may advertise transit routes to external ASs.
  • Whenever a router receives an update about a destination from an iBGP peer, the router tries to verify internal reachability for that destination before advertising it to other eBGP peers.
  • The router does this by checking the destination prefix first to see if a route to the next-hop router exists and second to see if a destination prefix in the IGP exists.
  • Otherwise, the router treats the destination prefix as not being synchronized with the IGP and does not advertise it.
  • The BGP rule states that a BGP router should not advertise to external neighbors destinations learned from IBGP neighbors unless those destinations are also known via an IGP. This is known as synchronization.
  • One option is to use default routes on non-BGP routers but this could lead to suboptimal routing or even routing loops.
  • no synchronization will tell BGP to override the synchronization requirement and allow it to advertise routes learned via IBGP, irrespective of the existence of an IGP route.
  • That said, by far the most common configuration in Internet-connected networks is to disableBGP synchronization and rely on a full mesh of IBGP routers. The thought of injecting tens of thousands of routes into an IGP is quite frightening.


SOURCES OF ROUTING UPDATES

 

DYNAMICALLY INJECTING INFORMATION INTO BGP

Two options:
  1. Purely dynamic: redistribution from an IGP to BGP (the redistribute command).
  2. Semidynamic: only certain IGP routes are injected into BGP (the network command).
  • If BGP does not find an exact match for routes redistributed via the network command, they will not be advertised.
  • If the mask is not specified with the network command and auto-summarization is enabled (default), existence of any subset of the classful prefix will result in the advertisement of the classful prefix.

INJECTION OF UNWANTED OR FAULTY INFORMATION

  • Redistributing the whole IGP into BGP could result in the advertisement of private addresses or internal addresses that are supposed to be used within the AS only.
  • In mutual redistribution, information that was injected from the outside into the AS could be sent back to the Internet as having originated from the AS.
  • Careful filtering is required to guard against these undesired consequences.
  • Some IGPs can inherently differentiate between internal and external routes.
  • For other IGPs, special route tagging can distinguish between internal and external routes.

UNSTABLE ROUTES

  • A process called route dampening penalizes and ultimately discontinues advertisement of fluctuating routes, depending on their degree of instability. Route advertisements may be suppressed for minutes or even hours (until they stabilize).
  • One way to minimize route instability is through aggregation. When an aggregate route announcement represents more than one route, the fluctuation of any single route does not cause fluctuation in the aggregate itself.

STATICALLY INJECTING INFORMATION INTO BGP

  • The most effective method of ensuring route stability.
  • IGP routes (or aggregates) to be advertised to BGP peers are manually defined as static routes.
  • If the route is advertised to the Internet from a single point, advertising a route that is actually down is not a big issue.
  • Hosts trying to access that destination will fail irrespective of whether the route is advertised.
  • On the other hand, if a route is advertised to the Internet from multiple points, advertising the route statically at all times might end up black-holing the traffic.

ORIGIN OF ROUTES

  • BGP considers the networks advertised via the network command or via aggregation as being internal to the AS and will include the ORIGIN attribute in each route as being IGP (i).
  • On the other hand, whenever a route is injected into BGP via redistribution (whether statically or dynamically), the ORIGIN of the route will be INCOMPLETE because the redistributed routes could have come from anywhere.
  • Aggregated routes will assume the worst ORIGIN value of all the component routes.
  • The ORIGIN attribute is used by the BGP decision process to favor one route over another.

BGP ROUTES: ADVERTISEMENT AND STORAGE

  • A route is defined as a unit of information that pairs a destination with the attributes of a path to that destination.
  • Routes are stored in the Routing Information Bases (RIBs): namely, the Adj-RIBs-In, Loc-RIB, and the Adj-RIBs-Out.
  • Adj-RIB-Out: Routes that will be advertised to other BGP speakers.
  • Loc-RIB: Routes that will be used by the local BGP speaker, and the next hop for each of these routes must be present in the local BGP speakers forwarding information base (FIB).
  • Adj-RIBs-In: Routes that are received from other BGP speakers.
  • If a BGP speaker chooses to advertise a route, it may add to or modify the route's path attributes before advertising it to the peer.

THE BGP RIB

  • Three distinct parts: Adj-RIB-In, Loc-RIB, and Adj-RIB-Out.
  • If a route is not placed in the Loc-RIB, it cannot be placed in the Adj-RIB-Out for advertisement to peers.

BGP DECISION PROCESS 

  • Based on the attribute values.
  • Only one best path is chosen, in the following preference order:
  1. If the next-hop is inaccessible, the route is ignored.
  2. WEIGHT (Cisco proprietary attribute, local to the router).
  3. LOCAL PREFERENCE.
  4. AS_PATH.
  5. ORIGIN type (IGP < EGP < incomplete).
  6. The lowest MED value.
  7. eBGP paths over iBGP paths.
  8. The route via the closes IGP neighbor. Follow the shortest path to the BGP NEXT_HOP.
  9. The lowest BGP ROUTER_ID.
  • If BGP Multipath is enabled, some steps could be bypassed, and all paths with the same AS_PATH length and MED value could be installed into the routing table.


BGP PATH ATTRIBUTES

  • A set of parameters that describe characteristics of a prefix (route).
  • Well-known mandatory: must be recognized by all BGP implementations and included in every UPDATE message.
  • Well-known discretionary: must be recognized by all BGP implementations but may or may not be sent in a particular UPDATE message.
  • Optional transitive:
  • Optional non-transitive:
  • Unrecognized non-transitive optional attributes must be quietly ignored and not passed along to other BGP peers.

ORIGIN (Type Code 1)

  • A well-known mandatory attribute that defines the origin of the path information.
  • 0: IGP - NLRI that is interior to the originating AS.
  • 1: EGP - NLRI learned via EGP.
  • 2: INCOMPLETE - NLRI learned by some other means.

AS_PATH (Type Code 2)

  • A well-known mandatory attribute that is composed of a sequence of AS path segments.
  • Inside the AS, the AS_PATH information is intact. However, when sending routes to eBGP peers, the AS that originates the route adds its own AS number.
  • Thereafter, each AS that receives the route and passes it on to other eBGP peers will prepend its AS number to the list.
  • Prepending is the act of adding the AS number to the beginning of the list.
  • Loop prevention: If the route is advertised to an AS whose AS number is already present in the AS_PATH, the UPDATE is ignored.

NEXT_HOP (Type Code 3)

  • A well-known mandatory attribute that defines the next-hop IP address.
  1. For eBGP, the next-hop is the IP address of the neighbor that announced the route.
  2. For iBGP, for routes that originated inside the AS, the next-hop is the IP address of the neighbor that announced the route.
  • A recursive IP lookup might be required for a router to know where to send the packet.
  • If a next-hop cannot be reached, BGP considers the route inaccessible.

MULTI_EXIT_DISC (MED) (Type Code 4)

  • An optional non-transitive attribute that is used to discriminate among multiple exits points to a neighboring AS.
  • A hint to external neighbors about the preferred path into an AS that has multiple entry points.
  • When BGP passes the routing update to another AS, the MED is reset to 0 (unless the outgoing MED is explicitly set to a specific value).
  • When the route is originated by the AS itself, the most common practice is for the MED value to follow the internal IGP metric of the route.
  • MEDs from different ASs are not comparable.
  • Still, for administrators who have a reason to do so, Cisco offers the bgp always-compare-med router command, which tells BGP to compare MEDs from different ASs for the same route.
  • When providers don't use MEDs or other attribute manipulation techniques to prefer the best-exit path, it's often referred to as closest-exit or hot potato routing.

LOCAL_PREF (Type Code 5)

  • A well-known discretionary attribute that is used to inform other BGP speakers in its own AS of the preference for an advertised route.
  • A higher local preference is preferred.
  • Exchanged between iBGP peers only.
  • Cisco proprietary WEIGHT attribute is similar.
  • The difference is that the weight parameter is local to the router and is not exchanged between routers, even internal to an AS.

ATOMIC_AGGREGATE (Type Code 6)

  • A well-known discretionary attribute that is used to inform other BGP speakers that the local system chose a less-specific route.

AGGREGATOR (Type Code 7)

  • An optinal transitive attribute that contains the last AS number that formed the aggreagate and the IP address of the BGP speaker that formed the aggregate route.

COMMUNITY (Type Code 8)

  • An optional transitive attribute that specifies all routes with this attribute belonging to the communities listed in the attribute.

ROUTE FILTERING AND ROUTE MANIPULATION

  • A BGP speaker can choose what routes to send and receive.
  • Route filtering is essential in defining routing policies.
  • Routes permitted through a filter can have their attributes manipulated.
  • Manipulating the attributes affects the BGP decision process used to identify the best routes to a given destination.
  • Both the inbound and outbound filtering can be applied to the peer and protocol levels.
  • Inbound filtering indicates that the BGP speaker is filtering routing updates received from other peers, whereas outbound filtering limits the routing updates advertised from the BGP speaker to other peers.
  • Both eBGP and iBGP filtering behavior is the same.
  • Three actions:
  1. Identifying the routes.
  2. Permitting or denying the routes.
  3. Manipulating the attributes.
  • After a route matches an instance, it is considered identified and will not be compared to any further instances. Hence, the order in which the instances are checked is important.
  • If the route proceeds to be compared against the entire list of instances and there is still no match, the route is discarded.
  • Prefix lists are currently the preferred mechanism to be used for filter routing information.
  • Trying to identify the AS_PATH list consists of comparing the list to what is called a regular expression.

PEER GROUPS

  • A group of BGP neighbors that share the same update policies.
  • Saves the administrator from repetitive configuration and the BGP router itself from parsing the policies sequentially for each individual neighbor.
  • With peer groups, the router formulates the update once, based on the policies of the peer group, and then floods the same update to all the neighbors that fall within the group.

BGP-4 AGGREGATION

  • Aggregation applies to routes that do not exist in the BGP routing table (contrary to the network command, which applies to rotes that do exist in the IP routing table).
  • Aggregation can be performed if at least one more-specific route of the aggregate exists in the BGP routing table.

Examples:
  1. Sending the aggregate route only and suppressing more specific routes.
  2. Sending the aggregate route and the more specific routes. Typical in a multihomed ISP scenario. Normally, the ISP does not want to advertise the more-specific routes further to the NAP, so it has the originating AS tag all the more-specific routes with the community attribute NO_EXPORT.
  3. Sending the aggregate route and a subset of more-specific routes.

Thursday, April 9, 2015

BGP: Internet Routing Architectures, Part I

HOW BGP WORKS

  • BGP is a path vector protocol used to carry routing information between autonomous sytems.
  • Path vector signifies that BGP carries a sequence of AS numbers that identifies the AS path. Also used for loop prevention.
  • BGP uses TCP port 179.
  • All the transport reliability is taken care of by TCP. No need to design this feature into the protocol itself.
  • BGP speakers = routers that run BGP.
  • BGP neighbors or peers = routers that form a TCP connection to exchange routing information.
  • Initially, all BGP routes are exchanged. Only incremental updates are sent as the network information changes.
  • Four message types: OPEN, NOTIFICATION, KEEPALIVE, and UPDATE.
  • BGP neighbors exchange OPEN messages to determine the connection parameters.
  • NOTIFICATION is sent in case of disagreement between the peers, and as a result, the session is not established or is torn down if already established.
  • UPDATE messages advertise BGP routes. Indicate a list of destinations that can be reached through that BGP speaker, and the related path attributes.
  • KEEPALIVE messages are sent periodically (every 60 seconds by defaut) between the BGP peers to ensure that the connection stays up.
  • A table version number keeps track of the current instance of the BGP routing table. Incremented at each change. A rapidly incrementing table version is usually an indication of network instability.


BGP MESSAGE HEADER FORMAT


+++++++++++++++++++++++++++++++++++++++++++
|       Marker       |   Length  |  Type  |
+++++++++++++++++++++++++++++++++++++++++++


  • Depending on the message type, there might or might not be a data portion following the header.
  • For example, KEEPALIVE messages consist of the message header only.
  • The Marker field (16 bytes) is used to either authenticate incoming BGP messages or detect loss of synchronization between two BGP peers.
  1. If the type is OPEN or OPEN+no authentication, the Marker field must be all 1s.
  2. Otherwise, the Marker field will be computed based on part of the authentication mechanism.
  • The Length field (2 bytes) indicates the total BGP message length.
  • The Type field (1 byte) indicates the message type (OPEN, UPDATE, NOTIFICATION, KEEPALIVE).


BGP NEIGHBOR NEGOTIATION

  • The OPEN Message.
  • BGP peers agree on a BGP version number. BGP tries to negotiate the highest common version.
  • The AS number is advertised in the OPEN message.
  • The Hold time indicates the maximum amount of time in seconds that may elapse between the receipt of successive KEEPALIVE or UPDATE messages.
  • The BGP neighbors negotiate to select the Hold time value which is lower.
  • The Hold timer could be 0, in which case the timers are never reset. The minimum Hold timer is 3 seconds.
  • BGP ID is also transported in the OPEN message. Typically the highest loopback IP address.
  • Optional parameters include the authentication information parameter.


BGP FINITE STATE MACHINE

 

1. Idle.
BGP initializes its resources, initiates a TCP transport connection, and starts listening for a connection that may be initiated by a remote peer.

2. Connect.
BGP is waiting for the transport protocol connection to be completed. If successful, the state transitions to OpenSent (the OPEN message is sent). If unsuccessful, the state transitions to Active.

3. Active.
BGP tries to acquire a peer by initiating a transport protocol connection. If expired, BGP restarts the ConnectRetry timer and falls back to the Connect state. The state might go back to Idle in case of other events, such as Stop event. A neighbor state that is oscillating between Connect and Active typically indicates a problem with the TCP transport connection.

4. OpenSent.
BGP is waiting for an OPEN message from its peer. In case of errors, an error NOTIFICATION is sent and the state goes back to Idle. If no errors, BGP starts sending KEEPALIVE messages.

5. OpenConfirm.
BGP waits for a KEEPALIVE message. If a KEEPALIVE is received, the state goes to Established, and the neighbor negotiation is complete.

6. Established.
The final stage in the neighbor negotiation. BGP starts exchanging UPDATE packets with its peers.


NOTIFICATION MESSAGE

  • Always sent whenever an error is detected.
  • After that, the peer connection is closed.

++++++++++++++++++++++++++++++++++++++++++
|  Error  | Error subcode |     Data     |
++++++++++++++++++++++++++++++++++++++++++


  • The Error code indicates the type of the notification.
  • The Error subcode provides more information about the nature of the error.
  • The Data field contains data relevant to the error, such as a bad header or an illegal AS number.

KEEPALIVE MESSAGE


  • Periodic messages exchanged between peers to determine whether peers are reachable.
  • The Hold time is the maximum amount of time that may elapse between the receipt of successive KEEPALIVE or UPDATE messages.
  • A recommended KEEPALIVE rate is 1/3 of the Hold time.
  • If the Hold timer is 0, periodic KEEPALIVE messages are not sent.
  • The KEEPALIVE message is a BGP header with no data following it.


UPDATE MESSAGE AND ROUTING INFORMATION


  • Basic blocks of an UPDATE message:
  1. Network Layer Reachability Information (NLRI).
  2. Path Attributes.
  3. Unfeasible Routes.

+++++++++++++++++++++++++++++++++++
|   Unfeasible routes length      |
+++++++++++++++++++++++++++++++++++
|   Withdrawn routes              |
+++++++++++++++++++++++++++++++++++
|   Total path attribute length   |
+++++++++++++++++++++++++++++++++++
|   Path attributes               |
+++++++++++++++++++++++++++++++++++
|     Length     |    Prefix      |
+++++++++++++++++++++++++++++++++++
|                                 | 
|      <length, prefix>           |  
|                                 |
+++++++++++++++++++++++++++++++++++


  • The NLRI (IP prefix route) indicates the networks being advertised.
  • The Path Attribute list enables BGP to detect routing loops and gives it flexibility to enforce local and global routing policies.

NETWORK LAYER REACHABILITY INFORMATION (NLRI)

  • The NLRI is the part of the BGP UPDATE message that lists the set of destinations about which BGP is trying to inform its other BGP neighbors.
  • The NLRI consists of one or more instances of the 2-tuple format <length, prefix>, where length is the number of the subnet mask that a particular prefix has.
  • Example: <19, 198.24.160.0> = 198.24.160.0/19.
  • Withdrawn routes have the same format.
  • An UPDATE message with no new NLRI or Path Attribute information is used to advertise only routes to be withdrawn from service.

PATH ATTRIBUTES

  • A set of parameters used to keep track of route-specific information.
  • Format: <attribute type, attribute length, attribute value>.
  • Four categories:
  1. Well-known mandatory.
  2. Well-known discretionary.
  3. Optional transitive.
  4. Optional non-transitive.
  • Well-known attributes are always transivite.
  • Well-known mandatory: Has to exist in the BGP UPDATE packet. Must be recognized by all BGP implementations. If missing, a NOTIFICATION error is generated, and the session is closed.
  • Well-known dicretionary: Recognized by all BGP implementations but might or might not be sent in the BGP UPDATE message.
  • Optinal transitive: The BGP implementation should accept the attribute and pass it along to other BGP speakers.
  • Optional non-transitive: The attribute is quietly ignored and not passed along to other BGP peers.

BGP CAPABILITIES NEGOTIATION

  • The purpose is to introduce a new optional parameter to BGP-4 called Capabilities.
  • Supported capabilites are included in the OPEN message.
  • If a peer supports a given capability, the speaker can use the capability with the peer.
  • If not supported, the BGP speaker receives a NOTIFICATION error message and attempts to reestablish the connection without sending the Capabilities parameter to the peer.

MULTIPROTOCOL EXTENSIONS FOR BGP

  • MP-BGP is negotiated via BGP capabilities.
  • Provides a backward-compatible extension to the BGP-4 protocol that let it carry information fro network layer protocols other than IPv4, such as IPv6 and IPX.
  • Two new attributes: Multiprotocol Reachable NLRI (MP_REACH_NLRI) and Multiprotocol Unreachable NLRI (MP_UNREACH_NLRI).
  • MP_REACH_NLRI and MP_UNREACH_NLRI are optional non-transitive attributes.
  • Interdomain multicast routing is the most common use of BGP's multiprotocol extensions.

TCP MD5 SIGNATURE OPTION

  • Help BGP protect itself from spoofed TCP segments and TCP resets in particular.
  • The TCP segment carries a digest message based on information known only to the connection end points.
  • When TCP receives a signed segment, the receiver must validate it by using its local key to
    calculate its own digest and compare the value with that of the received digest. 
  • If the comparison results in unequal values, the segment should be discarded and must not produce any response to the sender.
  • The MD5 key is never exchanged via the connection and that only the end points should be aware of the value.
  • There are performance implications that result in significantly increased delay with BGP message processing and generation.

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).