Your computer has at least two IP addresses, and knowing which is which is crucial for understanding how you connect to the internet.
Let’s see your local IP address in action. Open your terminal or command prompt. On macOS or Linux, type ip addr show or ifconfig. On Windows, type ipconfig.
Here’s what you might see on a Linux system:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:1a:2b:3c:4d:5e brd ff:ff:ff:ff:ff:ff
inet 192.168.1.105/24 brd 192.168.1.255 scope global dynamic eth0
inet6 fe80::21a:2bff:fe3c:4d5e/64 scope link
valid_lft forever preferred_lft forever
The inet 192.168.1.105/24 line is your local IP address. The /24 is CIDR notation, indicating that the first 24 bits of the address (which corresponds to 255.255.255.0 in subnet mask terms) define the network, and the remaining bits identify your specific device on that network. 192.168.1.105 is your device’s unique identifier within your local network. This is the address your router uses to send data to your computer.
Now, for your public IP address. This is the address the rest of the internet sees you as. It’s assigned to your router by your Internet Service Provider (ISP). To find it, you can use a simple command-line tool like curl to query a public DNS server that will report your IP back to you.
On macOS or Linux, open your terminal and type:
curl ifconfig.me
On Windows, you can use PowerShell:
Invoke-RestMethod -Uri "http://ifconfig.me/ip"
The output will be a single IP address, for example: 73.192.45.10. This is your public IP address. It’s how external websites and services identify your connection.
The reason you have two is fundamental to how home networks function. Your router acts as a gateway. It has a public IP address assigned by your ISP, and it manages a private network for your devices. When your computer sends data to a website, the request first goes to your router. The router then rewrites the source IP address from your computer’s local IP to its own public IP before sending it out to the internet. When the website responds, it sends the data back to your router’s public IP. Your router then knows which device on its local network originally made the request and forwards the data accordingly. This process is called Network Address Translation (NAT).
The most surprising thing is that your public IP address is not fixed. Unless you pay extra for a static IP, your ISP will periodically change your public IP address. This is known as a dynamic IP address. Your router will receive a new IP from the ISP’s pool of available addresses during a process called DHCP lease renewal. This is generally transparent to you, but it means that if you’re running a server at home or need consistent remote access, you’ll need to use a dynamic DNS service to keep a hostname pointed to your ever-changing public IP.
Understanding this distinction is key to troubleshooting network issues, setting up port forwarding on your router, or even just knowing what information you’re revealing when you browse the web.
The next thing you’ll want to learn is how to check the IP addresses of other devices on your local network.