Tcp – How does BGP work over TCP

bgpinternetlayer3layer4tcp

As far as I know we are using routing protocols to achieve Layer 3 connectivity, I am confused with the fact that BGP works over TCP which is L4. How can L4/TCP be established without prior L3 connectivity?

Best Answer

TCP/IP sockets establish an end-to-end connection through the network, between two specifically addressed end points. BGP uses TCP/IP to communicate between routers (any devices exchanging routing information.) The information exchanged is used by the BGP peers, to better choose the way they choose where to send, (aka, next-hop) packets that they need to transmit.

At the very edges of the Internet, things are easy; "everything is this way," towards your Internet provider. More in the middle, a router might have multiple choices. So it uses TCP/IP to move BGP traffic amongst its routing neighbors. The BGP information then tells the router which paths to prefer when there are multiple ways for a packet to get where it's going.

The end points (e.g. web browsers) and the routers are speaking TCP/IP. But the routers are using TCP/IP, (BGP communications composed of TCP/IP packets) to talk about what to do with the other TCP/IP packets they need to route.