Whether we realise it or not, we all use the Internet Protocol (IP) on a daily basis. When you type a website address or a search term into your web browser, for example, it looks up the IP address of that URL (or of a search engine) and then loads the website.
Let’s divide IP addresses into private and public categories. Your WiFi box (and company intranet) will provide you with private IP addresses. They’re in the 10.x.x.x, 172.16.x.x, 172.31.x.x, and 192.168.x.x ranges, with x=0 to 255. Public IP addresses are “public,” as the name implies, and can be accessed from anywhere on the planet. Every website has a unique IP address that can be accessed by anyone, from any location; this is referred to as a public IP address.
Furthermore, IP addresses are divided into two categories: IPv4 and IPv6.
The format of IPv4 addresses is x.x.x.x, with x ranging from 0 to 255. There are 232 (approximately 4 billion) IPv4 addresses available.
IPv6 addresses have a more complicated hexadecimal format. There are 2 128—340 undecillion!—possible IPv6 addresses because the total number of bits is 128, which means there are 2 128—340 undecillion!—possible IPv6 addresses. IPv6 was created in order to deal with the impending exhaustion of IPv4 addresses.
Your WiFi router has a public IP address, which is the WAN (wide-area network) IP address, and any device connected to that WiFi will have the same address. The range provided above identifies the private IP addresses of all devices connected to the same WiFi.
The IP address list can be obtained using the following commands to find public IP addresses for your machine:
- curl ifconfig.me
- curl -4/-6 icanhazip.com
- curl ipinfo.io/ip
- curl api.ipify.org
- curl checkip.dyndns.org
- dig +short myip.opendns.com @resolver1.opendns.com
- host myip.opendns.com resolver1.opendns.com
- curl ident.me
- curl bot.whatismyipaddress.com
- curl ipecho.net/plain
The private IP address of your interfaces can be obtained using the commands below:
- ifconfig -a
- ip addr (ip a)
- hostname -I | awk ‘{print $1}’
- ip route get 1.2.3.4 | awk ‘{print $7}’
- (Fedora) Wifi-Settings→ click the setting icon next to the Wifi name that you are connected to → Ipv4 and Ipv6 both can be seen
- nmcli -p device show