Blog Feed

BGP Next-Hop Processing

  • BGP needs an IGP to perform route recursion.
  • iBGP will not modify next hop as it advertises to its neighbor.
    • Can be modified with ‘neighbor <address> next-hop-self’
      • Update source IP is used as next hop.
    • Next hop can be modified using route map as well.
      • updates being received.
      • Configuration:
        • neighbor <address> route-map <name> in | out
        • Uses set clause
  • Next hop self on edge router
    • Peer can use same next hop on outbound updates to iBGP peers.
    • Same dynamic update group
    • Don’t need to include external links to IGP.
    • cons
      • Hinders fast convergence of external uplink failure.

Changing ‘next hop self’ with route-map:

R8 and R10 are in AS810.1, iBGP peers, and R5 is an EBGP peer. R10 receives BGP routes from R5 via R8, but all next hops stay as is, the inbound IP address of 10.8.8.2 from R5. If R5 does not know how to reach that transit link, it will never add routes into its local RIB from R5. This can be changed with ‘next hop self’ in many ways, this is through a route map.

R8 will advertise next hop self via BGP through the route map method. Again, no functional difference between using the normal ‘next-hop-self’ under the global BGP config and this. Also- the next hop will look like whatever the ‘update source’ is setup as.

BGP Confederations

  • Difficult for migration to because the BGP process has to be deleted/restarted.
  • Configuration:
    • ‘router bgp <sub-as>’
    • ‘bgp confederation-id <main-as>
    • ‘bgp confederation-peers <sub-as1 sub-as>
      • Only Sub-AS that the router is peering with.

Example configuration:

In the example above the scope of the confederations configuration is all within AS 100, and the sub-AS peer is 65005.

R1 is running EBGP (within the confederation) to R5 and iBGP to R6. The confederation configuration is very similar to regular BGP, it just has the two main commands, identifier and peers. The configuration on R3 and R2 are exactly the same except they have different Sub-AS numbers. R3 is below:

192.168.10.1 is L0 of R5

After this configuration on R1, R2, R3, and R5 there’s still no BGP adjacency between the different sub-AS’ – ie. R5 to R1 R3 and R2. The reason for this is because they’re all now technically running EBGP between each other. EBGP has the default rule that peers need to be directly connected, whereas iBGP has the default TTL 255. One of the fixes is to run the neighbor ‘disable-connected-check’.

After the above command is entered in both R1 and R5, adjacency comes up.

Another option to fix this is do EBGP Multi-hop. On R3 we’ll run the below command, as well as R5 for the other side.

The Multi-Hop command defaults to 255, above has added 2.

After entering the command ‘neighbor 192.168.10.1 ebgp-multihop 2’ on both sides, adjacency comes up very quickly. The same thing will be done on R2 to R5.

Now on R5 after neighbor adjacencies are up, ‘show ip bgp’ will show the sub-AS numbers in the path to reach different destinations.

If we look at the ‘normal’ EBGP peering to R8 however, the path to these destinations all appear to be coming from AS 100.

iBGP Route Reflector

  • Eliminates need for full mesh
    • Peering is only needed to RR
    • Similar to OSPF DR
      • Minimizes prefix replication.
      • One update to RR, RR sends to clients.
      • No modification of attributes when reflecting routes.
  • Loop Prevention:
    • Performed through Cluster ID.
      • Discards routes received from its own cluster ID.
    • Sets originator ID attribute to the router-id of RR client on routes.
      • Originator ID received from client and client uses for loop prevention.
  • RR Peering
    • EBGP Peers
    • iBGP Client Peers
    • iBGP Non-Client Peers
  • RR Updates
    • Processes differently depending on type of neighbor/peer.
    • EBGP
      • Passes to EBGP peers, clients, & non-clients.
    • Client learned routes
      • Pass to EBGP Peers, clients, & non-clients.
    • Non-Client learned routes
      • Pass to EBGP Peers and clients.

Large Design

  • Should not use single RR
  • RR Cluster allows for redundancy and hierarchy
  • RRs in same cluster use same cluster-id.
  • Performed via address family
    • no fate sharing
      • ex. IPv4 RR vs. IPv6 RR
  • Inter-cluster peering
    • Can be client or non-client peerings
      • Depends on design
  • Cluster-ID
    • Based on router-id
    • Default is all RR in separate cluster.

Virtual Route Reflectors:

  • RR does not need to be in data-path
    • No need to forward through RR necessarily, sometimes there for only NLRI.
  • No need to install routes in RIB/FIB if not in data path.
  • Selective RIB
    • Prevents NLRI from being installed in RIB and FIB.
    • ‘table-map <route-map> filter’
    • Can scale to millions of VPNv4 routes.
    • Reflection is occurring, no routing table install.

BGP Confederation:

  • Minimizes iBGP full mesh because it splits autonomous system into multiple autonomous systems.
    • Full mesh remains within sub-AS.
    • Sub-AS to Sub-AS acts like eBGP.
  • Confederation unknown to devices outside of confederation.
  • Typically uses private AS
  • Can use different IGPs within each Sub-AS.
  • Next-hop, Local-pref, and MED are kept across Sub-AS EBGP peerings.
  • Confederation Loop Prevention
    • AS_CONFED_SEQUENCE
    • AS_CONFED_SET
    • Never leaves confederation

RR vs. Confederation:

  • Both accomplish same thing.
  • Migration paths are different.
    • To confederation difficult.
      • Greenfield confederation is much easier.
    • Migration to RR is easy, add peers and remove old ones.

Basic Route Reflector Config:

Below is a set of routers all running as iBGP peers to R5 in AS 100.

Each router has a loopback IP associated with their hostname.

R5 = 5.5.5.5/24
R1 = 1.1.1.1/24
R2 = 2.2.2.2/24
R3 = 3.3.3.3/24
R4 = 4.4.4.4/24
R6 = 6.6.6.6/24

R3 is connected to R4 with the subnet 172.34.0.0/24 and it’s being advertised into BGP, and R5 is receiving that route (ignore RIB failure, ospf is running in background which is preferred over iBGP).

All of the other iBGP peers will not receive this route because of the default rules and loop preventions mechanisms. To allow R5 to pass on these routes to additional iBGP peers, we’ll need to make it function as a Route-Reflector.

After adding the following command, ‘neighbor <neighbor ip> route-reflector-client’, the routers neighboring with R5 are now receiving the advertised route from R3.

R2 receiving route advertised from R3:

iBGP Full Mesh

  • iBGP loop prevention
    • filters routes by default
      • Routes learned via iBGP cannot be passed on to additional iBGP neighbors.
      • Requires full mesh or confederation.
  • Full mesh advantage:
    • All BGP peers learn all paths.
    • All BgP peers know closest egress.
    • Hot Potato Routing.
  • Full mesh disadvantage:
    • Does not scale, too many peerings.
  • Partial mesh
    • mesh, route reflector and confed can interoperate.
    • advantageous for scaling
      • can use RR and pockets of full mesh.
  • Route Reflector
    • RFC 4456
    • RR summarizes routing information and only reflects best path.
    • IGP metrics are taken into account typically with route reflectors.

Peering iBGP vs. EBGP

iBGP:

  • Packets default to TTL 255
    • Neighbors do not have to be connected as long as IGP reachability exists.
  • Peers typically peer via Loopbacks
    • ‘neighbor x.x.x.x update-source l0’
    • Allows rerouting around failed paths via IGP.
    • Required for things like MPLS L3VPN.
  • Loop Prevention
    • iBGP learned routes cannot be advertised on to another iBGP neighbor.
    • BGP requires the following:
      • Full Mesh
      • Route Reflectors
      • Confederation
  • Next Hop Processing
    • Outbound iBGP updates do not modify next-hop regardless of iBGP type.
    • Modifying next hop:
      • ‘neighbor next-hop-self’
      • Route map
        • action – set next-hop
      • IOS 15.1(1)SY – next-hop-self ALL

EBGP:

  • Packets default to TTL 1
    • Can be modified if needed.
    • ‘neighbor ebgp-multihop <ttl>’
    • ‘neighbor ttl-security hops <ttl>’
  • Single hop peers must be directly connected by default.
    • Can be modified if directly connected neighbors peer via Loopbacks.
    • neighbor disable-connected-check.
  • Loop Prevention
    • AS-Path
      • Local ASN is prepended to outbound updates.
      • Inbound updates containing local ASN are discarded.
      • Can be modified with the following:
        • ‘neighbor allowas-in’
        • ‘as-override’
  • Next Hop Processing
    • Outbound EBGP updates have local update-source set to next-hop by default.
    • Modification
      • Route map
        • action – set next-hop
      • ‘neighbor next-hop-unchanged’

General:

  • BGP next hop controls IGP route recursion.
    • BGP knows the next hop but not the outgoing interface.
      • BGP is not a routing protocol by itself.
    • IGP must be able to perform recursion otherwise route cannot be used.
    • Result of failed recursion means route does not get installed into RIB.

BGP Peering

Route advertisements will differ depending on whether the advertisement is occurring over iBGP or EBGP. Some of the important differences have to do with next hops and iBGP full mesh.

Below are three routers running BGP. R8 and R10 are running iBGP in ASN 810.1, while R8 and R5 are running EBGP, R5 being in ASN 100. R8 and R10 have OSPF for internal loopback connectivity. R5 is advertising it’s loopback network 192.168.10.0/24 down to R8, and R10 is advertising a loopback network of 192.168.1.0/24.

R5:

R10:

When R5 tries pinging R10’s advertised loopback, it will not succeed, even though R5 has a valid route via BGP in it’s routing table.

Looking on R10, a ‘show ip bgp’ displays zero ‘>’ next to R5’s route, which means that it was not actually added to the routing table.

Drilling into this even further, BGP shows that the next hop (10.8.8.2, R5) is not accessible in R10’s routing table.

What this displays is how iBGP will advertise to its neighbors. The EBGP peer will advertise 1 hop further into its autonomous system but will not change the next hop. This can be troublesome for iBGP neighbors who do not have route information for the transit to another AS.

A solution to resolve this issue is by doing BGP ‘Next Hop Self’. On R8 the config for this is under the router bgp AS.

The command is after specifying which neighbor this should be applied on. This alone will not change the advertisement. A route refresh needs to occur.

A ‘* out’ will refresh the bgp table without taking the adjacency down.

Now on R10 we’ll see the route added to the routing table and the next hop advertised as R8’s internal Loopback address that R10 is peering with.

Below is an image with another BGP neighbor in the mix, R1. R1 is going to be in AS 100 and an iBGP peer with R5.

R1 and R5 have reachability via OSPF and they’re both peering over their Loopback0 IP addresses.

R1 L0 – 100.100.100.1/24
R5 L0 – 192.168.10.1/24

After the peers are up here’s what a ‘show ip bgp’ looks like on R1:

All looks good except for prefix 192.168.1.0, which is a subnet back on R10 in AS 810.1. The reason for this is the next hop again, 10.8.8.1, is not reachable from R1. A fix for this is to perform next hop self again when setting up peering from R5 to R1, or we can simply inject that route into the OSPF domain for underlying reachability, which is the other option – add the routing into the BGP IGP.

On R5 we can see that 10.8.8.0 is a directly connected network, and all we need to do is add that interface into OSPF, or redistribute connected.

On R5 the 10.8.8.0 subnet is on GigabitEthernet0/3, and below is a route-map matching on that interface.

The route-map will then get added into the OSPF process with redistribution. This will allow only what’s in the route-map to get redistributed.

Now on R1 the 10.8.8.0 network is visible via OSPF, and the BGP table shows R10’s loopback subnet has made it to the RIB.

  • Main Takeway:
    • By default when eBGP advertises a route to a remote AS, the next hop for the remote AS will be the originating advertising router.
      • If this route gets advertised further into iBGP, the route next hop will not change, it will remain the IP of the remote AS router.
        • Fixes for this are advertising transit path into an IGP, or setting the inbound router as next-hop self – ie. next hop self to iBGP peer.

BGP Basics

  • EGP Autonomous System:
    • Set of routing devices under single technical administration.
      • All using an IGP
    • Uses inter-AS routing protocol to determine how to route packets to other ASes.
    • Autonomous System Numbers (ASNs) are allocated by IANA.
  • BGP ASN Values:
    • Originally 2 byte field
      • 0-65535
      • Public – 1-64511
      • Private – 64512-65535
    • New/Current 4 byte field
      • RFC 4893
      • IOS 12.4(24)T and after support this field
      • 0.0 Notation
        • 0.[0-65535] denote original 2 byte field.
        • Needs command ‘bgp asnotation dot’
        • Requires backwards compatibility with old code.
      • 4 byte ASN support negotiated during capability exchange.
        • old BGP speakers are sent ASdot numbers encoded as ASN ‘23456’
          • If ‘23456’ are seen in the AS path, means somewhere in path the 4 byte field was not supported.
        • Real AS-Path encoded with optional transitive attributes
          • AS4_Aggregator and AS4_Path
  • BGP Neighborship:
    • Does not have own transport.
      • TCP 179
    • Different types of neighbors.
    • No need to be directly connected.
    • Neighbors not discovered by default, need neighbor statements.
    • BGP Neighbor statement:
      • Tells process to listen on TCP 179
      • Initiate session to remote address via TCP 179
      • If collision (both devices try initiating session at same time) higher router-id becomes TCP Client, other server.
    • Session:
      • If server does not expect session from client, it will send TCP-Reset
      • ‘show control-plane host open-ports’
      • Client’s packet is sourced from outgoing interface.
        • Can be modified with ‘update-source’ under BGP process.
    • EBGP
      • Neighbors outside of AS
    • iBGP
      • Neighbors inside AS

OSPF Route Filtering

  • Link State protocol, knows entire topology of an area.
  • Most filtering occurs at area borders and autonomous system borders.

Filtering with prefix-list:

In the image above, R5 and R4 are in area 0, R2, R3 and R4 are in area 146. R5 is advertising the the loopback 192.168.5.1/32, which can be seen as an inter area route in R2.

To filter out this route a prefix list will need to be created on the ABR between 146 and 0, which is R4.

Configuration:

Above shows the prefix list is denying specifically the /32 host route. The next sequence down will permit all other prefixes. This list will then get applied to R4’s router OSPF process configuration.

Once the filter-list command is added, R5 no longer will see the subnet that was denied in the prefix list. The ending of the command ‘out’ is in place because we’re filtering a route coming from area 0, out to area 146.

NOTE:

  • Distribute-list is used with a standard access-list to deny traffic WITHIN an area or to a routing table of a specific host.
  • Distribute-list does not stop LSDBs, just stops a route from entering RIB post topology table.
  • Filter-lists are used with prefix-lists to stop an LSA summary (Type 3) from entering an area.
  • Filter-lists need to be completed on the ABR.

OSPF Auth – Cryptographic

  • HMAC-SHA
    • OSPFv2 enhancement
    • For Type 2 Cryptographic Auth
      • Keyed-md5
      • SHA-1
      • SHA-256
      • SHA-384
      • SHA-512
  • OSPF Auth now supports multiple keys, automatic time-based key rotation, and singel key chain for multiple interfaces.
  • Backwards compatible with interface level MD5
    • Keys still must match.

Configuration:

Key Chain:

Interface:

When applying/upgrading the key chain and interface configurations, make sure the message-digest configuration is removed.

OSPF Authentication

  • OSPF Supports authentication against routing injection.
  • Every Hello, Update, LSR includes authentication info.

Auth Types:

  • Type 0 – Null
  • Type 1 – Simple
  • Type 2 – MD5/SHA

Configuration:

  • OSPF Process
    • area <#> authentication
  • Link Level
    • ip ospf authentication
      • Overrides global process
  • Password always configured on the link
    • ip ospf authentication-key
    • ip ospf message-digest key
  • Key IDs must obviously match.
  • Virtual Link
    • Area 0 Interface
    • Inherits rules of authentication
    • Key goes at the interface.
    • Type can be configured globally or at interface.
    • Runs as demand circuit.

Examples:

Authentication between R4 and R5 Area 0:

Router OSPF Process
Router OSPF Process
Interface Message Digest Config
Interface Message Digest Config

This can be confirmed with the ospf interface command: