"Everyone on the Internet has at least one unique AS number, and
they use BGP to advertise their networks to their peers. BGP is a
path-vector protocol, because it advertises the paths required to
get to a certain destination. BGP does not say anything about how a
packet will get routed within the AS, nor does it know about the
entire network as OSPF does. BGP can be called a distance-vector
protocol, because it’s similar, excluding a few twists.
"BGP itself is a Layer 4 protocol that sits on top of TCP. BGP
is much simpler than OSPF, because it doesn’t have to worry
about the things TCP will handle. This works because BGP is very
connection-oriented anyway, since it requires two manually
configured peers, who configure their routers then exchange routes.
BGP peers (neighbors) will generally be directly connected, but
some masochists like to set up BGP sessions between multi-hop
peers—which is okay, since BGP uses TCP (port 179) and
doesn’t rely on broadcasts or link-local multicast."