An IP (Internal Protocol) address is a unique identifier that identifies a device on the internet-connected to the TCP/IP protocol and enabled communication over it. One of the most common and popular examples of a network built on IP addresses is World Wide Web and Internet.

The address of each device in an IP subnet (a kind of subset of complete IP range) should always be unique means no two devices on the same subnet can have the same IP address, otherwise, it will cause an IP address conflict.

For IPv4, its format can be 4 octets like x.x.x.x where each octet is 8 bits or 0 to 255 in decimal. Eg. 201.112.192.230. IPv6 addresses support a much larger range and are formatted like y:y:y:y:y:y:y:y where each y is a segment that can range between 0 and FFFF in hexadecimal like 2001:0db8:0001:0000:0000:0ab9:C0A8:0102.

An IP address helps in location addressing of the connected device and for network interface identification.

Also, we need to remember that each connected device can have two types of IP addresses:

  • A private or Internal IP address
  • A public or External IP address

Internal IP addresses are for messaging and connectivity within the internal network. Devices with these addresses are not reachable globally and are accessible within the LAN only. Additionally, the same internal IP can be used across two different network subnets, so they are not necessarily unique identifiers.

Whereas external IP addresses are globally accessible on the internet. Since addresses are unique across the Internet, it also determines the location of the devices from where it is connecting to. Because IANA (Internet Assigned Number Authority) assigns a unique range of addresses across different countries. 

Windows

Using Command Prompt

When you run the command ipconfig on Windows’ Command Prompt, it will list down all the network adapters found on your Windows system. There could be multiple IP addresses in that list based on your connectivity like ethernet, Wi-Fi, etc.

Here’s an example:

How to Find IP Address of Windows, Linux, Mac and Website? linux MacOS Sysadmin windows

Network and Sharing Center

Another method by which you can find your system’s/network adapter’s IP address is by opening Network and Sharing Center. For this, open the Control Panel and go to Network and Internet -> Network and Sharing Center -> Connections: / -> Details.

Here’s what it looks like:

How to Find IP Address of Windows, Linux, Mac and Website? linux MacOS Sysadmin windows

Settings App

Open Settings app from Start menu. Then go to Network & Internet -> Select your connection type (here it is Wi-Fi) -> Hardware Properties. Below is a screenshot showing network details from Settings app:

How to Find IP Address of Windows, Linux, Mac and Website? linux MacOS Sysadmin windows

Linux

Linux offers a range of options to check your system’s IP address. Besides GUI network manager based on the Linux distribution, there is a set of common CLI commands that are mostly supported across different distributions by default. So, we’ll be covering such commands.

ip Command

ip command has a lot of options. To list all network interfaces, use ip a command or specify the name of the network interface as shown below.

$ ip addr show eth0
6: eth0: mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:8c:b4:c4 brd ff:ff:ff:ff:ff:ff
inet 172.23.120.4/20 brd 172.23.127.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::215:5dff:fe8c:b4c4/64 scope link
valid_lft forever preferred_lft forever
$

hostname Command

hostname command with -I flag can list down all IPs attached to your different network interfaces.

$ hostname -I
172.23.120.4 10.42.0.0 10.42.0.1
$

ifconfig Command

Like ip command, ifconfig used to be the default command for viewing/modifying network parameters in a Linux system though it is still supported by a lot of distributions. You can use ifconfig -a to view all network adapters and their IPs or to specify a specific network interface with ifconfig use:

$ ifconfig eth0
eth0: flags=4163  mtu 1500
        inet 172.23.120.4  netmask 255.255.240.0  broadcast 172.23.127.255
        inet6 fe80::215:5dff:fe8c:b4c4  prefixlen 64  scopeid 0x20
        ether 00:15:5d:8c:b4:c4  txqueuelen 1000  (Ethernet)
        RX packets 1339936  bytes 1152733066 (1.1 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 393472  bytes 333379281 (333.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
$

All the above methods will show you the internal IP of your network adapter. To view the external or public IP address from the Linux terminal, you can try any of the below common tools (do note that all these commands communicate with an external service to fetch your public IP):

$ curl ifconfig.me
$ curl ident.me
$ curl ipinfo.io/ip
$ dig  short myip.opendns.com @resolver1.opendns.com
$ host myip.opendns.com resolver1.opendns.com

Mac

On Mac, you can either follow GUI or terminal method to get your IP address.

GUI Method

  • Open System Preferences from Apple menu.
  • Click View in top menu and select Network.
  • Choose the right network connection from left menu.
  • On the right, you’ll be able to see the IP address of your Mac.

CLI Method

  • Open the terminal on your Mac.
  • Now, for ethernet connection you can use ipconfig getifaddr en1 command to get the IP address.

Ex:

[email protected] ~ % ipconfig getifaddr en1
192.168.1.117
[email protected] ~ % 

IP of Websites

Besides your system’s private and public IPs, there’s public IP of websites on the Internet that you communicate over web browsers or other applications. Though you use DNS names to open a website or talk to it, computers use IP addresses in the backend to make this communication work.

We can query the IP of a website using some commonly available utilities on any system like ping, nslookup and dig. Though ping is not something exclusively used to fetch IP, it does fetch the IP in the process and it can be viewed in the output. Further, it’s a common utility available across the different OS. Here are all these commands in action:

ping

$ ping -c4 wikipedia.com
PING wikipedia.com (91.198.174.194) 56(84) bytes of data.
64 bytes from ncredir-lb.esams.wikimedia.org (91.198.174.194): icmp_seq=1 ttl=57 time=7.53 ms
64 bytes from ncredir-lb.esams.wikimedia.org (91.198.174.194): icmp_seq=2 ttl=57 time=7.58 ms
64 bytes from ncredir-lb.esams.wikimedia.org (91.198.174.194): icmp_seq=3 ttl=57 time=7.56 ms
64 bytes from ncredir-lb.esams.wikimedia.org (91.198.174.194): icmp_seq=4 ttl=57 time=7.59 ms

--- wikipedia.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 7.532/7.564/7.591/0.022 ms
$

You can explore more ping command examples.

nslookup

$ nslookup wikipedia.com
Server:         127.0.0.53
Address:        127.0.0.53#53

Non-authoritative answer:
Name:   wikipedia.com
Address: 91.198.174.194
Name:   wikipedia.com
Address: 2620:0:862:ed1a::3

$

dig

$ dig  short wikipedia.com
91.198.174.194
$

If you don’t have a terminal handy or in case, you’re not comfortable using it, fear not. There are numerous whois tools available that can get you the IP details of a website right from the browser.

One such great whois utility can be accessed from Geekflare Tools.

How to Find IP Address of Windows, Linux, Mac and Website? linux MacOS Sysadmin windows

You can simply enter the domain name of the website you are looking to find the IP and click on Find Host button and the tool will show you the website’s IP as well as some other cool information like location and hosting details about it.

How to Find IP Address of Windows, Linux, Mac and Website? linux MacOS Sysadmin windows

Conclusion

IP address is an intrinsic part of how the Internet works today. In this article, we’ve covered how private and public IP is different and how we can identify the IP address assigned to a network interface covering Windows, Linux, and Mac systems.