+
+
+
+ TODO:
+ eBGP/iBGP session
+ Graphs
+
+ /**********************************************/
+ /* A no-bullshit guide to a bullshit protocol */
+ /**********************************************/
+ We can think of the Internet as a network of networks which are all connected in some way. We will refer to
+ these networks as Autonomous Systems(AS) in this article.
+
+ Now, how do we connect these AS's in a sane way? This is where BGP comes in. BGP, which stands for `Border
+ Gateway Protocol`, enables different AS's to exchange information with each other, e.g. communicating with each
+ other.
+
+ There are three main challenges BGP has to solve:
+ - Scalability: The Internet is BIG. BGP needs to scale well to be feasible in a large scale.
+ - Privacy: Networks don't want to divulge internal topologies (topology = how a network is structured)
+ - Policy enforcement: The Networks themselves need to have control over where to send and recieve traffic.
+
+ Other protocols, like Link-Sate routing, do not solve these challenges.
+
+ BGP's key concept, which it revolves about, is called *path-vector routing*, where it adertises the entire
+ AS-level path.
+ Now, what is an AS-level path? We'll get to that in a minute.
+
+ Before that, why do we need even BGP? The problem is that sending data over the internet costs money. If we want
+ to minimize the costs of sending data, we need to find routes which cost as little as possible. This is also why
+ BGP is a "follow the money" protocol. Different ASes only connect with each other if they can save money that
+ way.
+
+ There are two policies we can use to define this routing:
+ - Selection: Which path to use (only relevant for outbound traffic)
+ - Export: Which path to advertise (only relevant for inbount traffic)
+
+ TODO: add graphs here
+
+ ===============================================
+ eBGP and iBGP
+ ===============================================
+
+ BGP comes in two flavors: eBGP and iBGP.
+ The e/i stands for external/internal
+
+ External BGP sessions connect border routers in different ASes. These are therefore use to learn routes to
+ external destinatons
+
+ TODO: add graph
+
+ Internal BGP sessions connect the routers in the same AS. These are used to split up externally-learned routes
+ internally. These are tehn announces exernally(to other ASes) again, using eBGP sessions.
+
+ BGP itself is a pretty simple protocol composed of four basic messages:
+ - open: establish a BGP session (using TCP)
+ - notification: report unusual conditions
+ - update: inform neighbor of a new best route
+ - can be a change or a removal of a best route
+ - keepalive: inform neighbor that connection is alive
+
+ update messages carry an IP prefix together with a set of attributes:
+ /*********************/
+ /* IP prefix */
+ /*********************/
+ /* Attributes */
+ /* */
+ /* */
+ /* */
+ /* */
+ /*********************/
+
+ There are four types of different attributes:
+ - NEXT-HOP
+ - AS-PATH
+ - LOCAL-PREF
+ - MED
+
+