Public vs. Private IP Address: What's the Difference

June 14, 2022

Introduction

An IP address is a unique numerical ID assigned to each device on the Internet. IP addresses can be public - used on the Internet, and private - used in a local area network (LAN).

Differentiating between a public and private IP address and knowing how they work helps keep your internet activity private and secure.

In this article, you will learn the difference between a public and private IP address.

Public vs. private IP - what's the difference?

What Is a Public IP Address?

A public IP address is an outward-facing IP address used to access the Internet. Public IP addresses are provided by an internet service provider (ISP) and assigned to the router. It is a unique IP address on the Internet.

Other machines and websites use a public IP to identify and communicate with the devices connected to a local area network. A public IP ensures websites, emails, and other online content reach you correctly, acting as a gateway to the Internet.

A public IP address allows users to configure a server (VPN, FTP, etc.), provides remote access to the machine, and many other benefits.

Usually, additional security measures are required when using a public IP address to provide services on the Internet. Those security measures include using a firewall to close unused ports and protocols, separating public services from the LAN using a DMZ network segment, etc.

What Is My Public IP Address?

There are several ways to find your public IP address. Since ISPs assign the public IP, and it is visible to every website you visit, the easiest way is to ask Google.

Navigate to www.google.com and search "what is my IP address." Google's first result is a snippet that shows your public IP:

Obtain your public IP address using Google.

For Linux users, follow our tutorial to obtain your IP address using the hostname or ifconfig command, or via the GUI. Alternatively, use the ip command for an extended range of capabilities compared to ifconfig.

Public IP Ranges

The number of public IP addresses is far greater than the number of private ones because every network on the Internet must have a unique public IP.

All public IP addresses belong to one of the following public IP address ranges:

  • 1.0.0.0-9.255.255.255
  • 11.0.0.0-100.63.255.255
  • 100.128.0.0-126.255.255.255
  • 128.0.0.0-169.253.255.255
  • 169.255.0.0-172.15.255.255
  • 172.32.0.0-191.255.255.255
  • 192.0.1.0/24
  • 192.0.3.0-192.88.98.255
  • 192.88.100.0-192.167.255.255
  • 192.169.0.0-198.17.255.255
  • 198.20.0.0-198.51.99.255
  • 198.51.101.0-203.0.112.255
  • 203.0.114.0-223.255.255.255

Other IP ranges, usually those starting with 10.x.x.x, are within the private IP address range.

What Is a Private IP Address?

Private (internal) IP addresses aren't routed on the Internet, they never leave the local network, and no traffic can be exchanged using private IP addresses. Private IP addresses within the same local network must be unique.

Users cannot access the Internet directly from a private IP address but must route the connection through NAT, which replaces the private IP address with a public one. Thus, NAT hides the private IP, increasing network security.

The network and router assign a private IP address to a device. After receiving or sending data through the public IP address, the router passes that traffic to a specific device using its unique private IP address.

Therefore, by using private IPs, the router properly directs traffic within the network and allows devices on that network to communicate with each other.

What Is My Private IP Address?

Knowing the private IP address is extremely helpful when troubleshooting a faulty internet connection or configuring advanced network settings. Follow the steps below to find your private IP address:

Windows users

1. Press the Windows key and type PowerShell. Click the Windows PowerShell result.

Opening the Windows PowerShell.

2. Run the following command:

ipconfig

The private IP address is under IPv4 Address. For example:

Finding the private IP address in Windows via ipconfig

Linux users

Follow our tutorial to find your private IP address in Linux.

Mac users

1. Click the Apple menu and open System Preferences.

2. In the app list, select Network.

Opening Network settings in macOS.

3. In the left pane, choose the connection you are using to connect to the Internet.

Obtaining the private IP address in macOS.

Your private IP address is under the Status section.

Private IP Ranges

Every private IP address belongs to a specific private IP address range reserved for that purpose by the Internet Assigned Numbers Authority (IANA). A private IP address cannot be used to access the Internet and remains only in the local network.

Since a private IP address never leaves the LAN, the same private IPs appear on different private networks, and they only have to be unique within that single local network.

Each private IP address belongs to one of the following ranges:

  • Class A. Ranging from 10.0.0.0 to 10.255.255.255, it is for large networks and has 8 bits for the network and 24 for hosts.
  • Class B. Ranging from 172.16.0.0 to 172.31.255.255, it is used for medium networks and has 16 bits for the network and 16 for hosts.
  • Class C. Ranging from 192.168.0.0 to 192.168.255.255, it is for smaller networks and has 24 bits for the network and 8 for hosts.

Since private IP addresses are reserved for private networks and need to be unique to that network only, the ranges are much smaller than for public IP addresses.

Difference Between Public and Private IP Address

The crucial difference between a public and private IP address is that the public IP can be seen by other devices on the Internet, while the private IP cannot. Therefore, public IPs are used to interact and communicate online, while private IPs operate within a local network.

The following table summarizes the key differences between a public and private IP address:

CategoryPublic IP AddressPrivate IP Address
ScopeHas a global reach.Only local reach.
CommunicationUsed to communicate over the Internet.Used to communicate within a private network.
UniquenessA unique address not used by other devices on the Internet.An address from a smaller range used by other devices in other local networks.
OriginAssigned by the ISP.Assigned by the router to a specific device on the local network.
RangeAny IP not in the private IP address ranges.Any address from the following ranges:
10.0.0.0 - 10.255.255.255;
172.16.0.0 - 172.31.255.255;
192.168.0.0 - 192.168.255.255
SecurityPublic IPs require additional security measures, they are prone to attacks.Private IPs are secure.
Example82.129.73.11110.0.0.0

FAQs About Public and Private IP Addresses

This section answers some frequently asked questions about public and private IP addresses.

Public IP Address vs. External IP Address

An external IP address is another name for a public IP address - it works outside the local network, allowing users to connect to the Internet and communicate with other public IP addresses worldwide. The addresses you are connecting to are called remote IPs.

A public IP is also referred to as an outward-facing IP.

Private vs. Local vs. Internal IP Addresses

A private IP address is assigned to each device in the local network by the router they are connected to. A private IP establishes communication between devices and allows routers to direct traffic within the local network correctly.

When swapping between public and private IPs, the router uses NAT (network address translation).

Local IP address and internal IP address are only different terms used to refer to a private IP address.

How to Change Public IP Address

Since an ISP assigns a public IP address, users cannot change it. However, there are ways to obtain a different IP address or hide it behind another one.

 Following are different ways to change the public IP address:

1. Use a VPN. A virtual private network (VPN) service hides your public IP address behind a different one. VPNs are often used when online services aren't available in a certain country, and users bypass that restriction by connecting to a VPN server in a location where the services are available.

Popular VPNs include NordVPN, Surfshark, ExpressVPN, CyberGhost, IPVanish, PrivateVPN, etc.

2. Use a proxy. Proxy servers are similar to VPNs but are less secure as they often lack encryption. They work by routing the internet connection through a middleman server, causing the website you visit to pick up the proxy server's IP address instead of your own.

Different types of proxy servers include:

  • HTTP/S proxies. Usually distributed as browser extensions or websites operating as a browser within a browser. They only change the IP address on data exchanged within the browser.
  • SOCKS proxies. General-purpose servers configurable for specific apps.
  • SSH proxies. SSH proxies use an SSH connection for directing traffic. The biggest flaw of SSH proxies is their speed.

3. Use the Tor browser. The Tor browser routes all your traffic through the Tor network, thus changing the public IP to a different one. The network contains thousands of volunteer-run server nodes, concealing your identity with multiple encryption layers.

However, since Tor's encryption system is extensive, sending and receiving traffic takes a long time, which means browsing speed is sacrificed for anonymity.

4. Release old IP by unplugging. Each time you connect to the Internet, your ISP assigns your modem with a public IP address. By unplugging the modem and leaving it off for a while, there is a chance the ISP will recycle the IP and assign it to someone else. When reconnecting, you get a new public IP if the IP was recycled.

However, this method may not work, as the IP assigned depends solely on the ISP, which means you may get the same IP again.

5. Request a different IP. Some ISPs allow users to request a different IP address. Depending on your ISP's policy, you may ask for a new one.

However, most ISPs use dynamic IP allocation systems, recycling and assigning IPs among connected users. Having a dynamic IP means that even if you request a new IP, it will probably change in the future.

To obtain a static IP address that never changes, submit a request to the ISP. Note that a static IP usually involves an application process and an extra fee. After obtaining a static IP, enter it in your device's network settings, and it will remain the same until you change it.

6. Connect to a different network. Disconnecting from the current network and connecting to a different one is another way of obtaining a new IP address. For example, get a new IP by switching from WiFi to a mobile data connection or from one WiFi connection to a different one.

Does My Private IP Address Change?

Since a private IP address is assigned to each device on the network by the router, it can change every time a new connection is made. As long as the device is connected, its local IP address remains the same.

For example, connect a phone and then a laptop to a network. Disconnect them both, and reconnect in reverse - laptop, then phone. The addresses are now different.

How Do I Change My Private IP Address?

Multiple devices connected to a single network usually share the same public IP address. However, each device within the network has its own private IP address. Changing the private IP is typically a step when troubleshooting a malfunctioning device or configuring how certain devices work on the home network.

Renew your local IP address from the router's admin panel or from the device. For example:

Windows users

Follow the steps below to obtain a new private IP address:

1. Run the Windows PowerShell or Command Prompt as an administrator:

Opening the Windows PowerShell as an administrator.

2. Run the following command to release the current IP:

ipconfig /release
Releasing the current private IP address in Windows.

3. Run the following command to obtain a new local IP address:

ipconfig /renew
Renewing the private IP address in Windows using PowerShell.

A new local IP address is assigned to the device.

Mac users

1. Click the Apple logo in the menu bar and open System Preferences.

2. In the app list, select Network.

3. Select the network you are currently using and click Advanced…

Configuring advanced network settings in macOS.

5. Under the TCP/IP tab, click the Renew DHCP Lease button.

Renewing the IP address in macOS.

Your Mac now has a new private IP address.

Linux users

To change the local IP address on Linux, use the ifconfig command.

Note: The ifconfig command is part of the net-tools networking toolkit. If it's not available on your system, install it by running:

sudo apt -y install net-tools

The syntax is:

ifconfig <network_interface_name> <new_ip_address>

For example:

ifconfig enp0s3 192.168.178.32
Setting a new IP address in Linux using ifconfig.

Note: Changing the IP address on Linux requires administrator privileges.

Change IP on the router

Changing the local IP on the router depends on the router manufacturer and firmware version. Change the address by accessing the router's admin dashboard in a browser via its IP address - usually 192.168.0.1 or 192.168.1.1.

For example, the following router admin dashboard is accessible from 192.168.0.1:

Finding the admin dashboard of a router.

After entering the admin username and password, find the options for changing the local IP in your admin dashboard.

Why Do We Need a Private IP Address?

Private IP addresses enable devices to communicate with each other when they are connected to the same local network. Since private IPs aren't visible on the Internet, they boost device security and make it difficult for a user to establish a connection to the device.

Additionally, different private IPs are assigned to each device on a LAN, while they all hide behind a single public IP address. The total amount of public IPs available is much smaller than the number of devices that need to connect to the Internet. That is why all the devices on a single network share one public IP but have different private IP addresses so that traffic is correctly routed.

Why Do We Need a Public IP Address?

Each device connected to the Internet must have a public IP address. The public IP identifies the device to the wider Internet and lets you find the requested information.

A device can use network address translation (NAT) if there is no public IP. Devices with private IPs must use NAT to translate the address to a public one in order to access the Internet and go beyond their personal network.

Who Can See My IP?

Each time a remote server is accessed, i.e., when you visit a website or access something online, an information exchange occurs. The exchange lets the remote machine know how to send messages back to your device. This is done via public IP address.

If the public IP is never shared, the website you are visiting wouldn't be able to reply to your request.

To hide your IP, use a VPN, a proxy server, or a machine with a public, routable IP address.

What Information Can Be Obtained from an IP Address?

An IP address doesn't reveal your precise location and personal information, such as a home address, name, or phone number. However, it reveals your city, ISP, ZIP code, and area code from which you are connecting to the Internet.

Since all devices connected to the local network share the same public IP address, it isn't your physical location that the address reveals. It reveals the geolocation of the ISP's nearest server.

Does the IP Address Change with WiFi?

The public IP address depends on the current network connection. Every device connected to a single network has the same public, outward-facing IP address. Therefore, when connecting to a different WiFi network, the public IP address also changes.

There is only a small chance of getting the same IP address on a different network. If both routers are using the same IP range, you might get the same IP address from the DHCP of both access points.

Can You Hide a Private IP Address?

Both public and private IP addresses can be hidden. While hiding the public IP address usually means that it stays behind another public IP, hiding a private IP means that other devices on the same network will no longer see or be able to communicate with that device.

Although malicious attacks usually come from outside a local network, you may want to hide the private IP address of a certain device from other devices on the network. The easiest way is to change the network type from Home to Public.

Conclusion

This article has presented the key differences between a public and private IP address, along with frequently asked questions related to the topic.

Next, learn more about using the IP command in Linux, or see how to use the ifconfig command if you have an older Linux distribution.

Was this article helpful?
YesNo
Bosko Marijan
Having worked as an educator and content writer, combined with his lifelong passion for all things high-tech, Bosko strives to simplify intricate concepts and make them user-friendly. That has led him to technical writing at PhoenixNAP, where he continues his mission of spreading knowledge.
Next you should read
IMAP vs. POP3 vs. SMTP: What Are the Differences?
April 14, 2022

This article presents the key differences between three popular email transfer protocols - IMAP, POP3, and SMTP.
Read more
Localhost vs. 127.0.0.1
February 24, 2022

Are localhost and 127.0.0.1 synonymous and if not how do they differ? Learn more about the differences and similarities between these two commonly used networking concepts.
Read more
How to Use the nslookup Command
January 13, 2022

Access to Domain Name System (DNS) records of a website is important for troubleshooting network problems. This tutorial introduces nslookup.
Read more
Telnet vs. SSH: How Is SSH Different From Telnet?
May 20, 2021

Telnet and SSH are network protocols used to connect to remote system. This tutorial covers the ways they work, what makes them different, and when to use them.
Read more