Tell if an ipv4 address is public or private

ip addressipv4Networknetworking

I've read the below thing, in a website.

According to standards set forth in Internet Engineering Task Force
(IETF) document RFC-1918 , the following IPv4 address ranges are
reserved by the IANA for private internets, and are not publicly
routable on the global internet:

10.0.0.0/8 IP addresses: 10.0.0.0 – 10.255.255.255
172.16.0.0/12 IP addresses: 172.16.0.0 – 172.31.255.255
192.168.0.0/16 IP addresses: 192.168.0.0 – 192.168.255.255

My doubt is

  1. Should private addresses be only from the above mentioned ip range or can they have any ip address range?
  2. Can public ip address be from the above mentioned ip addresses ? If so then will that be valid in the internet?
  3. Can I tell 100% by looking at the ip address as they're private if they fall in the above ip address range?

Best Answer

1 - Yes, to do things properly you should only use IP addresses within those 3 networks as private addresses.

2 - No, those addresses are not routable on the Internet, any decent internet service provider (ISP) will drop any packet that has one of this addresses as either source or destination.

3 - yes.

You can read the whole RFC1918 here (it is short).

Related Topic