Entries Tagged as 'BGP'

Four Ways to Originate Prefixs in BGP

The command that we can see originate prefixs in BGP is “show ip bgp reg ^$” . There are four ways to originate prefix.

1. aggregate-address

Aggregate-address in BGP is summarization or superneting like IGP summary-address. When execute this command, the specific route must be in BGP routing table. BGP will advertise both aggregated address and specific routes to the neighbor. If we don’t want specific routes to be advertised, “summary-only” key word need to be used.

2. network statement

When configure “network 192.168.50.0 mask 255.255.255.0″, it actually tell router to import network 192.168.50.0 with subnet mask 255.255.255.0 from IGP route table to LocRIB. If there is no such entry on IGP table, nothing will be installed in LocRIB. If importing is successful, there is an entry on LocRIB which originated by router itself.

3. redistribute

If we have been asked to let router advertise a summary major network 191.1.0.0/16 into BGP, we can create a static route point to Null0. Then, redistribute static route into BGP

router bgp 200
redistribute static
ip route 191.1.0.0 255.255.0.0 Null0

4. inject-map

Inject-map is opposite operation of aggregate-address. Sometimes we call it “de-aggregate”. We need two route-map. One route map is declare injected prefix by using set ip address prefix-list <inject-prefix-list> and some attributes which is needed to be setup. (Weight is default 0 in stead of 32768). The other route map is existed aggregate prefix and its originator by using match ip address prefix-list <aggregate-prefix-list> and match ip route-source prefix-list <originator-prefix-list>.

BGP Best Route Trouble Shooting

When we show ip bgp and observe some routes are not best route (not greater sign in the front), we should first check if next hop is reachable, then, we should check if iBGP synchronization is enabled.

BGP will put learned prefix to Adj-RIB-in. All learned route will pass Input Policy Engine. A path selection algorithm is then performed to determine the best path for each prefix. The resulting best paths are stored in the local BGP RIB (Loc-RIB) and then are submittted to the local IP routing table (IP-RIB) for installation consideration. To make next hop reachable, we can either change next hop by next-hop-self when eBGP peer advertise the prefix to its neighbor, or redistribute BGP to IGP, which we don’t recommend because two manys prefixes injected in to IGP.

If iBGP synchronization is enabled, the router will not use or advertise the prefixes learned from iBGP neighbor until the matching prefixes learned from an IGP. Prefix synchronization between iBGP and IGP to prevent routing loops and black-holing of traffic. Prefix synchronization means that a prefix learned via iBGP is not included in the best-path selection unless that same prefix exists in the IGP. If the IGP is OSPF, the router ID for the prefix in the IGP must also match the router ID of the BGP peer advertising the prefix. Synchronization may be disabled if this AS does not provide transit for another AS or if all routers in the transit path are running BGP. It is generally a good practice to disable prefix synchronization.

BGP Neighbor Features in One Shot

The water in BGP is deep, I should say. However, to make our world simpler, we may summarize our knowledge by one screen shot. For example, to learn BGP neighbor features, we can simply see what options besides neighbor commands. Let’s take a screen shot first.

picture-1

I can safely say that, each commands can be one section on the book or tutorials.

  • For example, we can change EBGP default TTL=1 to 255 by issue ebgp-multihop command. We also can restrict neighbor hop count by issue ttl-security command.
  • allowas-in will be last resort for some AS is partitioned, but it may cause count-to-infinity problem if hop-count is larger.
  • when we issue send-community, then we know what’s well-known four communities are.
  • local-as is tell neighbor that advertised routes are originated by using this AS number. The AS number will be preapended on the real AS.
  • next-hop-self is useful when advertising route to iBGP but the neighbor doesn’t have the route on IGP table. If the iBGP neighbor doesn’t change next-hop value, then it has no way to know how to get that route. next-hop-unchange is useful to solve loop problem when eBGP neighbor set next hop to me and the actual route has to bypass this neighbor.
  • max-prefix is another security feature which only allows certain number of TCP session up.
  • soft-reconfiguration is good feature to ask neighbor re-advertise route without tear down and resetup TCP session. It’s more like command “clear ip bgp * soft“.
  • etc…

BGP Route Reflector Roles

BGP Route Reflector normally has three kinds of peers

  • EBGP Peer
  • Client Peer ( neighbor 1.2.3.4 route-reflect-client )
  • Non-client Peer ( no neighbor 1.2.3.4 route-reflect-client)

Route Reflector can learn from or advertise to all three kinds of peers. However, non-client peer can NOT learn from or advertise to non-client peer. As we can see from the following diagram, Since R3 is non-client, it can NOT advertise route to R4, which is also non-client peer.

BGP RR diagram 1There are two ways to solve this problem.(Of course, many ways can be done to implement this.)

One is to make R3 as Client Peer. Since R3 is Client Peer, it will advertise route to R4.

BGP RR Diagram 2The other is, we make R3 as another RR and make R4 and R2 as Client Peer. If we don’t make R2 as R3’s Client Peer, R2 is non-client peer with R3. Since R3 is RR, R3 is non-client peer with R2. If R3 has no neighbor relationship with R1, then two non-client peer can NOT advertise to each other. Therefore, we make R2 as Client Peer with R3.

BGP RR Diagram 3