Traffic forwarding with BGP labels
In our previous example we could see that both networks (A/24 and B/24) had to be a part of LDP exchange and, therefore, had to be learned by the transit routers. That, to a degree, defeats the purpose of MPLS where one of our goals is to avoid that. So what do we do, or can we do to avoid that ?
The answer to that question is BGP. Let's have a look at the following diagram
Here we still have our core routers (R1-R6) participating in OSPF exchange advertising their loopbacks into Area 0 (just for simplicity) - remember, all core routers need to be able to reach each other, that's a bare minimum.
We also have them exchange MPLS labels yet we no longer advertise Networks A/24 and B/24 into the underlay. We are going to use BGP overlay to carry the traffic across the core and going to build an adjacency between our Edge routers R1 and R6 and then exchange the routes for these two networks.
As a result of the above our labels are going to look something like this (I'm omitting a few columns for simplicity here)
Router | Prefix | Local Label | Remote Label |
R1 | 6.6.6.6/32 | 100 | 200 |
R2 | 6.6.6.6/32 | 200 | 300 |
R3 | 6.6.6.6/32 | 300 | 500 |
R5 | 6.6.6.6/32 | 500 | 600 |
R6 | 6.6.6.6/32 | 600 |
And for another prefix
Router | Prefix | Local Label | Remote Label |
R6 | 1.1.1.1/32 | 600 | 500 |
R5 | 1.1.1.1/32 | 500 | 300 |
R3 | 1.1.1.1/32 | 300 | 200 |
R2 | 1.1.1.1/32 | 200 | 100 |
R1 | 1.1.1.1/32 | 100 |
In other words, the above is making our core aware of how to deliver traffic between our edge routers.
The next step here is to bring up an iBGP (technically can be an eBGP) session between our edge routers R1 and R6 and start exchanging the routing information about prefixes A/24 and B/24 thus making our transit network absolutely unaware of those prefixes.
Let's dig into how exactly this is going to work.
- R1 will try to bring up an adjacency with R6. It will look into the routing table and will find an MPLS path to R6 through the core. The core, in turn, will carry this traffic over and back.
- Once the session is established and the edge routers completed routing information exchange R1 will have something like this in it's RIB
Router | Prefix | Next hop |
R1 | B/24 | 6.6.6.6/32 |
Now lets have a look at what will happen when Network A/24 is trying to reach Network B/24
- R1 will receive the packet and perform a RIB lookup finding a next hop for B/24 as 6.6.6.6
- R1 will preform RIB lookup looking for a way to reach that next hop and will find an MPLS enabled interface with a label 200 (R2)
- R1 will inject an MPLS "tag" of 200 into the packet and forwards on to R2
- R2 will swap 200 for 300 and then forward further on to R3
- The above repeats until the packet reaches R6 where the MPLS label is popped and the IP packet is forwarded to the destination of B/24
All in all, this allows for a seamless IP transit while keeping the core completely unaware of the end to end traffic
