There are two types of BGP peers, internal BGP (iBGP) and external BGP (eBGP) (Figure: BGP configuration).
iBGP is used to communicate with peers in the same autonomous system. Routes received from an iBGP peer in the same autonomous system are not advertised to other iBGP peers (unless the router is a route reflector) but can be advertised to an eBGP peer.
eBGP is used to communicate with peers in different autonomous systems. Routes received from an router in a different AS can be advertised to both eBGP and iBGP peers.
Autonomous systems share routing information, such as routes to each destination and information about the route or AS path, with other ASs using BGP. Routing tables contain lists of known routers, reachable addresses, and associated path cost metrics to each router. BGP uses the information and path attributes to compile a network topology.