How does tools like ping, or any other tool that uses the tcp/ip protocol know that for example 192.168.1.1 or 10.0.0.1 is a local ip address while 126.96.36.199 or 188.8.131.52 are public? are 192.168.x.x and 10.0.x.x hardcoded to be preserved for local use?
Well, they are reserved by RFC 1918 for use in private networks.
But that doesn't actually matter much. You can obtain a block of "public" IP addresses from RIPE or whatever, and use it for your private network, and everything will still work. The reservation is needed only for political reasons, to allow admins to set up their own private networks without any trouble.
For example, when you configure an Ethernet card on Windows with IP address
In other words, you told the OS that all addresses within the
To view the routing table:
Editing the routing table can be done with the same tools. For example, to mark all of
Public and private IP addresses are defined in RFC. These are private IP addresses:
Also these IP addresses are loopback:
Others are public.
Most of tools does not need to know public or private IP addresses.