Hey yo man! Whats UP? Lets talk about IGPs and BGPs (EGPs)!
How my CCIE process is going? I passed (again) the cisco 350-501 SPCORE exam which is the actual written exam for CCIE certification. Last time it was easier than now, maybe I have no MPLS based project at this time. In the other hand I passed the 350-901 which is the DEVCORE exam, now I have 3 NP certification: DevNet, SP, Enterprise. I care about devnet because there is evolving technology part on the lab exam, so it was the part of my preparation.
Actually I prepare myself to the LAB! Rock Yeah!
Understanding BGP is basically an really old topic in Service Provider era. What is BGP? What does it mean that BGP an EGP? What is IGP? Good stuffs from question to question. Lets start with the first one.
What is BGP?
BGP is an EGP. WHat? Border Gateway Protocol is az Exterior Gateway Protocol which is responsible for the ISP or Telco routing strategy in an Autonomus System... Pfffff Its not easy when you do not understand what is EGP and AS (Autonomus System). Exterior Gateway Protocols like BGP and EIGRP work with special network identity which is AS number. AS number was a 16 bit length in the old times, now-times there is old fashion AS numbers (16 bit) and the new style (32 bit) AS numbers can be public and private, just like IP addresses. If you'd like to be an ISP you have to assign public AS number from you local RIR (in a case of Hungary that is RIPE). The technical difference between the old a and new numbering format that is which BGP protocol version and which software implementation you use in your environment. In the old times, BGP implementation an ancient IOS (monolithic) can not support automatically the 32 bit ASN. At now time if you'd like to request an AS your RIR you probably will get a 32 bit number (just like in skyblocks).
EGP routers whose use the same ASNs are inter-AS routers in a case of BGP they use iBGP connection. EGP routers whose use the diffrent ASNs are external-AS routers, in a case of BGP they use eBGP connection.
What are the main differences between the BGPs?
eBGP is used to interconnect routers via BGP whose has different AS numbers. Typically the ISPs should use eBGP to make a public (or private) interconnect between each other. eBGP routes are basically better that iBGP because the eBGP administrative distance in case of cisco is 20 (other vendor can use their own administrative numbering scheme). eBGP IP TTL field is 1, which means in the default case of eBGP the directly connected IPs can establish BGP connection. iBGP TTL field is default 255. iBGP has split horizon mechanizm what is responsible for the loop prevention. In the default iBGP in case of chained network the first BGP router can not advertise its own prefix just for the next iBGP router. The 2nd iBGP router do not advertise the route if it heard from a iBGP neighbor.
eBGP router is prepend its own AS number to the ASpath attribute. In a case iBGP the AS number not prepend to the ASpath attribute. Ok lets talk about what is the ASpath or attribute?
BGP has attributes which are help to decide which prefix has better than other. This topic is called BGP best-path selection procedure.
BGP Best Path Selection
This part of topic is even documented better than this blog can so here is an useful link which is help to understand BGP BPS algorithm :
https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/13753-25.html
https://datatracker.ietf.org/doc/html/rfc4271
What is IGP?
Interior Gateway Protocols can be used for make the infrastructure routing between iBGP peers, because the iBGP has many limitation of scalability, like split horizon problem. The second popular cause of IGP is that the convergence time. IGP protocols can be converged state faster the BGP protocol. BGP protocol is a TCP based protocol with slow timers, however IGPs usually use multicast or L2 CLNS protocols to communicate the routers each other, which mean that can be faster than BGP. The other explanation can be that the routing protocol type, routing protocols can be various based on the routing algorithm and the attributes:
hybrid distance-vector: EIGRP
path-vector: BGP
link-state: OSPF, ISIS
These concepts are very basics, if you do know about them, you have to google it.
The most popular IGPs in the Service Provider Environment are the OSPF and ISIS. I heard about EIGRP use as IGP, but it has a lot of limitation which cause that the two other protocol is better to used.
Both OSPF and IS-IS has LSA or TLV which support MPLS based solutions and these IGPs are ready to make MPLS TE with RSVP and SR too.
There will be more about it in the other post!
Lets make some interesting stuff with LAB.
I think the best way to learn the basics of BGP to test the eBGP iBGP connection and the limitation of iBGP split horizon.
Lets look at the my LAB topology:
In the topology the ASN2 and ASN3 routers are IOS-XE routers the all other one is IOS XR
Tasks:
1. Make sure that every Lo0 is available in the AS20, iBGP connection will be established between Lo0.
2. Make eBGP peer connection between AS20 and other ASs with using loopback0-s IP address.
3. Make all Lo100 accessible in every AS.
For the 1. task you have to make the routing in AS20. Probably you are going to use a dynamic routing protocol which can be advertise the loopbacks and the interface connectivity IPs. In this I am going to use OSPF.
Lets make the configuration plan:
1.
To make sure that all Lo0 has reachable on the AS20 you have to make all AS20 routers OSPF adjacency.
IP address of the interfaces are pre-configured.
Configuration template will be the following in the AS20 routers (IOS-XR):
router ospf $process_id
router-id $Lo0_IP_address <-should use the Lo0 but not necessarily.
area 0!<- we are goint to use backbone area to flood all necessarily LSA in the area.
interface Loopback0 !<- it is necessarily for advertise the Lo0 IP address, you can use passive-interface command to prevent the unnecessarily running OSPF of this interface
!
interface GigabitEthernet0/0/0/x
!
interface GigabitEthernet0/0/0/y
# all router neighbor interface should run OSPF.
!
!
!
To verify OSPF on the router use the following commands:
show ospf neighbor
show route ospf
ping $Lo0_ipaddress
To establish BGP in IOS-XR you need to use the following configuration template
router bgp $ASN
address-family ipv4 unicast
!
neighbor $neighbor1_Lo0_IP
remote-as $ASN
update-source Loopback0
address-family ipv4 unicast
!
!
neighbor $neighbor_Lo0_IP
remote-as $ASN
update-source Loopback0
address-family ipv4 unicast
!
!
To verfify the BGP connection you should use the following commands:
show bgp su
show bgp
You will see that BGP table is empty on all router. Why is it empty? Because:
1. You do not used network statement in address-family ipv4 unicast part.
2. You do not received eBGP advertisement from EBGP peer.
Lets continue the exerices
eBGP connection with Lo0 is a tricky task, because you have to make sure the Lo0 IP address is accessible from the router and you have to care about the eBGP TTL 1.
The solution is going to be the following on IOS-XE routers:
router bgp $ASN
bgp log-neighbor-changes
neighbor $neighbor_IP remote-as $neighbor_ASN
neighbor $neighbor_IP ebgp-multihop 2
neighbor $neighbor_IP update-source Loopback0
!
address-family ipv4
network $Lo100_IP_address mask $Lo100_network_mask
neighbor $neighbor_IP activate
exit-address-family
!
Beacause the Lo0 is accessible throught other connected interface you have to make route.
ip route $neighbor_IP 255.255.255.255 $neighbor_connected_IP
For the XR based routers you should be use the following template:
!
!
router bgp $ASN
address-family ipv4 unicast
network $Lo100_IP_address $Lo0_network_mask
!
neighbor $neighbor_Lo0_IP_ress
remote-as $neighbor_ASN
ebgp-multihop 2 #EBGP TTL is going to be 2 (calculate it!)
update-source Loopback0
address-family ipv4 unicast
route-policy PASS in
route-policy PASS out
# In case of ios-XR a route-polic is mandatory be attached to eBGP connection which responsible for the prefix receiving and advertisement too.
!
!
!
Beacause the Lo0 is accessible through other connected interface you have to make route too.
!
router static
address-family ipv4 unicast
$Lo100_IP_address/mask $neighbor_connected_IP
!
It is looks easy, but eBGP ASN can reach each other?
No, because of BGP split horizon loop prevention mechanism, and the other one is:
- there is no valid next-hop in the iBGP table for the Lo100 IPs.
To make accessible the Lo100 IP address to all BGP router you have to use the following command:
next-hop-self
and
route-reflector-client
The next-hop-self command is typically used by an eBGP router when advertising a route it learned from its eBGP neighbor to its iBGP peers. Why does it do this? Because if it does not, the next-hop IP will be the IP address of the eBGP peer, which is in another AS, thus its IP address is unknown within the local AS.
The route reflector allows all IBGP speakers within your autonomous network to learn about the available routes without introducing loops.
Where have been these commands used? Lets see the topology
To configure these statement you have to configure under the neighbor statement address-family ipv4 unicat section.
router bgp $ASN
neighbor $neighbor_Lo0_IP_address
address-family ipv4 unicast
next-hop-self
router bgp $ASN
neighbor $neighbor_Lo0_IP_address
address-family ipv4 unicast
route-reflector-client
In this case you sould the similar output in the eBGP routers:
Lets close this post but I can write many things about BGP and IGP, but I do not want waste your and my time so see yo in the next topic!