Each ISP is responsible for:
- Deciding where to send it's own packets,
- From whom to receive packets, and
- Whether any received packets will be send on somewhere else.
- All of the above is by agreement with a transit provider.
The agreement with the transit provider allows:
- The advertisement of customer routes to other ISPs, thereby soliciting inbound traffic toward the customer from them
- The advertisement of other ISPs' routes (usually but not necessarily in the form of a default route or a full set of routes to all of the destinations on the Internet) to the ISP's customer, thereby soliciting outbound traffic from the customer towards these networks.
This is done using the Border Gateway Protocol.
An ISP uses BGP to configure it's "edge" routers.
Note also that the route from ISP (A) to ISP (C) may be different to the route from ISP (C) to ISP (A).
In addition, routing can change if part of the internet is broken, for example if there a fibre cut on one of the undersea cables (which happens suprisingly often).
In this case traffic may be directed by a long (and apparently inefficient) route because the shorter route is no longer possible until repairs are made.
In extreme cases this traffic routing may add 100s of ms of delay to internet traffic.
Example:
- Internet traffic from the UK to India normally goes via the Middle East. - A couple of years ago there was a major undersea cable outage in the Egypt area and all traffic between the UK and India was rerouted via the US.
- This was a disaster for VoIP (Video) customers, and took months to fix.
What is the difference between "Peering" and "Transit"?
The economic arrangements that allow networks to interconnect directly and indirectly are called "peering" and "transit":
- Peering: when two or more autonomous networks interconnect directly with each other to exchange traffic. This is often done
without charging for the interconnection or the traffic.
- Transit: when one autonomous network agrees to carry the traffic that flows between another autonomous network and all other networks.
Since no network connects directly to all other networks, a network
that provides transit will deliver some of the traffic indirectly via
one or more other transit networks. A transit provider's routers will
announce to other networks that they can carry traffic to the network
that has bought transit. The transit provider receives a "transit fee"
for the service.
ISP (A) has a direct route to ISP (B), and ISP (B) has a route to ISP (C)? So it's absolutely natural for ISP (A) to route to (B) to reach (C). Because that the fastest path for ISP (A), yet they use a more complicated path that is way worse than an ideal path from (B)
Everything depends on:
What agreements there are between ISPs A, B and C.
Whether any of A, B, or C are backbone carriers (transit providers)
Whether there are any other parties between A and B, and between B and C (just because there is a route doesn't mean there is a direct connection with no other party in between).
You haven't provided any of this information so we cannot give your a better answer. If any one of A, B or C is your ISP please ask them.
If you can provide traceroutes for A > B, B > C and A > C we might be able to guess some more ...
ISP (B) has both peering to A and C, but A uses Transit when connecting to C
This is the answer to your question. B does not have transit agreements with A and C.
Further reading