‘BGB is the routing protocol of The Internet’. First thing you learn about the Internet when you start reading about it is that it is a ‘network of networks’. Each of these smaller networks is usually under one organisations control – usually an ISP. In BGP these networks are called ‘autonomous systems’, which can have a group of IP addresses assigned to them.
We don’t usually run BGP in our personal networks, but once we break out of our own managed networks we will link into a network that IS running BGP. Networks running BGP try and find the best route to an IP address by finding out the fastest way to its Autonomous system that has the IP included in it.
The metric for what makes the best route is much more complicated than any of the routing protocols we have looked at. It is also the only exterior gateway protocol in use today. It’s much slower than IGP protocols, but also needs less processing power – which is a good trade off seeing as there are millions of routers that make up the Internet.
BGP Routers do not form neighbours by themselves, they have to be set manually. That said if all the Routers are managed by the same organisation (they are all in the same autonomous system) an ISP might decide to set them all up with an IGP in the interest in speed.
BGP relies on batch updates to push out routes, if you use eBGP (external BGP – routes exchanged outside the autonomous system) then the interval is 30 seconds, if you’re using iBGP (internal BGP – routes exchanged inside the autonomous system) then the interval is just 5 seconds.
This is the connection that we are going to be establishing BGP on.
So the first thing you will do when configuring a Router to use BGP is set it up to use BGP along with its autonomous system number. The autonomous system number you need to have assigned to you and it will be a number between 0 and 65535. In this example we will use 24601. Each router can only be in one autonomous system.
Then you set up a neighbor. – most of the commands in BGP config start with neighbor [IP ADDRESS] [OTHER COMMAND], and there are pages and pages of config options. The command we’ll be puttin in first is neighbor [IP ADDRESS] [REMOTE-AS] – so we will be defining the AS that IP iss associated with. In this case it’s an evil remote network so its AS number will be 666.
Note – this is also how the Router knows it’s running eBGP. If the AS number was the same on both ends it would be iBGP.
It can take a scary amount of time for that neighbour relationship to come up. But once it’s up yay – that’s all there is to a very basic eBGP setup.
Advertising out using the network command
BGP doesn’t form neighbor relationships using the network command, they are input manually. The network command in BGP world takes a route from the routers internal Routing table, and then advertises it to the outside world. And it has to be exact.
To demonstrate this I am going to add a loopback address to Router1 of 184.108.40.206 255.255.0.0 so a /16 network (interface Loopback 1 -> ip address 220.127.116.11 255.255.0.0). And add it to the Routing table (ip route 18.104.22.168. 255.255.0.0 Loopback 1) and then advertise it out with the neighbor command network [IP ADDRESS] mask [SUBNET MASK]
We can confirm that this has been sent out by jumping onto Router2 and running show ip bgp:
And we can also see it in the Routing table:
The first command to verify this is the show ip bgp summary command.
There is also a show ip bgp neighbor command which shows you a whole bunch of information, most of which you don’t care about at this level.
There is also a show ip bgp command – which is essentially show ip route – but BGP flavoured.