3 ms·
First, TCP and DNS don't come into it: they both piggyback on IP (TCP directly; DNS via UDP in typical use), so IP is all that's really relevant. BGP is how ro
by jemfinch 14y ago
First, TCP and DNS don't come into it: they both piggyback on IP (TCP directly; DNS via UDP in typical use), so IP is all that's really relevant.
BGP is how routers communicate with each other. Every major edge router for a network is typically connected to many other edge routers for other networks. Each router announces what amounts to their complete routing table: i.e., for every IPv4/IPv6 address that they know how to route, they announce what networks it traverse on the way to the destination.
When a router is deciding which router an IP packet should hop to next, it looks at the packet's destination IP address and consults an in-memory data structure that it has constructed based on the BGP announcements of the routers to which it's connected. Modulo refining nuances (MED/PREF), it looks for two things:
1. It routes the packet according to the most specific network it saw announced. If it sees a packet destined for 1.2.3.4, and one connected router A is announcing a route for 1.2.3.0/24, and another connected router B is announcing a route for 1.2.0.0/16, it will pass along the packet to router A, all other things being equal.
2. As a tiebreaker for announcements with the same network specificity, it looks at the "AS path": the set of networks that the packet will traverse. It picks the router with the shortest path: the least number of traversed networks.
So the answer to your direct question is that BGP is "somewhere else": it's what routers use to communicate to each other "How will you route this IP packet?" and then make reasonable decisions about how they should send packets around the network.
- count 14y agoTo be clear - BGP runs on TCP port 179, so it sits in TCP segments, and those are inside IP packets.