How does IP routing work?
The Internet is made up of interconnected large networks that are each responsible for certain blocks of IP addresses; these large networks are known as autonomous systems (AS). A variety of routing protocols, including BGP, help route packets across ASes based on their destination IP addresses. Routers have routing tables that indicate which ASes the packets should travel through in order to reach the desired destination as quickly as possible. Packets travel from AS to AS until they reach one that claims responsibility for the targeted IP address. That AS then internally routes the packets to the destination.