When i traceroute a website, i get the IPs of all the routers in the path between me and the website. Who owns all those routers? Are they organized in a particular kind of building?
As Zac67 wrote the Internet is a network of different networks. Each of these network is identified by an unique Autonomous System Number (ASN). These networks are run by different companies who connect either directly or through some internet exchange, e.g. DECIX or AMSIX (which are the two biggest exchanges in the world.) The routing information is exchanged via BGP(Border Gateway Protocol) which uses ASN to determine the way from you to your destination. For BGP the shortest connection is the one passing the fewest AS. Some variants of traceroute have a -A option to print the ASN.
Rotuers may be in the same physical location, but they are most likely distributed all over the world. Sometimes router IPs have reverse DNS records which may indicate where a router might be located. Also the time between the hops is a good indication of the distance between the different hops.
# traceroute -A example.com traceroute to example.com (188.8.131.52), 30 hops max, 60 byte packets 1 172.16.41.1 (172.16.41.1) [*] 0.205 ms 0.228 ms 0.268 ms 2 184.108.40.206 (220.127.116.11) [AS3320] 6.130 ms 6.131 ms 6.196 ms 3 18.104.22.168 (22.214.171.124) [AS3320] 6.436 ms 6.878 ms 6.842 ms 4 126.96.36.199 (188.8.131.52) [AS3320] 10.931 ms 10.910 ms 10.901 ms 5 ffm-b4-link.telia.net (184.108.40.206) [AS1299] 11.039 ms 11.042 ms 11.059 ms 6 ffm-bb2-link.telia.net (220.127.116.11) [AS1299] 97.179 ms ffm-bb1-link.telia.net (18.104.22.168) [AS1299] 100.643 ms 100.741 ms 7 prs-bb3-link.telia.net (22.214.171.124) [AS1299] 100.567 ms * 100.471 ms 8 ash-bb2-link.telia.net (126.96.36.199) [AS1299] 101.906 ms 102.459 ms 102.741 ms 9 ash-b1-link.telia.net (188.8.131.52) [AS1299] 98.662 ms ash-b1-link.telia.net (184.108.40.206) [AS1299] 102.746 ms 102.916 ms 10 verizon-ic-315152-ash-b1.c.telia.net (220.127.116.11) [AS1299] 101.037 ms 101.933 ms 101.943 ms 11 ae66.core1.dcb.edgecastcdn.net (18.104.22.168) [AS15133] 119.499 ms 101.537 ms ae65.core1.dcb.edgecastcdn.net (22.214.171.124) [AS15133] 96.683 ms 12 126.96.36.199 (188.8.131.52) [AS15133] 101.364 ms 98.214 ms 102.234 ms 13 184.108.40.206 (220.127.116.11) [AS15133] 101.360 ms 102.262 ms 102.408 ms
In the example above I'm going from Deutsche Telekom, AS3320 (hop 2-4) , through Telia, AS1299 (hop 5-10) to Verizon, AS15133.
Between hop 5 and 6 there is a huge time increase form 11ms to 97ms which means that the packet has most likely traveled through one of the transatlantic cables between Europe and the US.
You may also guess the location from the reverse DNS names, e.g. ffm is a indicator for either a router in Frankfurt Main, Germany or an router interface in direction to Frankfurt. This might also be totally out of date and totally misleading when these records are not updated when the network is changing.
Who owns all those routers?
The operators of the networks your traffic passes over.
The IP address often gives hints, either through reverse DNS or through ASN lookups as to who owns the router and where it is located, but it's important to realise that these are only hints for a couple of reasons.
- The owner of the IP address block is not always the same as the owner of the router. In general both ends of a layer 2 link will be from the same address block, so when two provider's networks are linked together it's perfectly normal for one of those providers to have a router interface with an address from the other provider.
- Records are not always updated in a timely manner.
Time differences in the traceroute can also give a hint, if the time barely changes it's probably in the same city, if there is a big step in time you are probably looking at a longer distance link, though you could also be seeing congestion.
Are they organized in a particular kind of building?
It depends on the purpose of the router. Some Routers may be used to build out an ISPs core network, these will likely be placed in locations that have a good choice of connectivity options. Usually that means carrier neutral datacenters in a major city, sometimes a particular area of the city. Other routers may be placed in locations that are more convenient for serving customers such as a telephone exchange.
The Internet is a network of networks. Companies and other organization connect their network ("peer") to exchange data and form a larger network.
Some of them have sufficient connections and bandwidth, so they sell access to their network and subsequently to the others (Internet service providers).
Others cover large distances and have a great number of connections (carriers) that they sell access to their network to smaller ISPs.
What you see in a traceroute are addresses from your own router(s), then from your ISP, then from one or more carriers, and finally from the server hoster (roughly - servers may be hosted at your own ISP, the ISP may peer directly with the hoster, ...).