Internet Routing – Does Each Router Have All IP Addresses?

internetipip addressipv4routing

I am new to computer networking,and was reading about the topic routing.

According to my understanding,each router has a routing table associated with it.
From that table it could know,which output link to choose for a particular destination, and also the distance.

If thats the case,then each router in 'Internet' has to maintain information about all other routers and hosts connected to Internet.

Since each address is 4 bytes long IPv4,each router would need atmost 17 GB of space to store the IP addresses alone (2^32*4=17179869184 Bytes =17 GB)

Is my understanding wrong ? I am not getting a clear picture of how this works.

Best Answer

So a couple of things - firstly, no, all routers connected to the Internet do not need the entire address space. If the device only has one connection to the Internet, they will have a default route eg: 0.0.0.0/0 pointed towards their upstream router and thats it. This represents any IP address that the router doesn't have a better route for.

Routers inside your ISP may contain the "entire" Internet routing table.

As to the second part of your question around the space required to hold the routing table - Internet routes aren't stored as individual host routes, but summary prefixes. The general rule for IPv4 Internet routes is that no ISP will advertise anything longer then a /24 (eg: a block of 255 addresses) as a single route update, and you will find that a lot of routes are aggregated even further than this (right up to /8s or 65K addresses per prefix).

Over time as the Internet grows, route-deaggregation (eg: taking a larger prefix and breaking it into smaller ones) has caused the number of required Internet routes to grow, and consequently the hardware requirements for holding the table have increased.

As of today (May 2018) there are 717,613 prefixes being advertised, which can be comfortably stored by a router with 2GB of memory with enough left to run the Router OS as well.

If you're interested, I recommend reading through https://www.cidr-report.org for up-to-date prefix counts and aggregation reports.