Networking

What Is an IP Address? IPv4 vs IPv6, Public vs Private Explained

By NileVPS Team · Published · 5 min read

اقرأ المقال بالعربي

An IP address is the number that identifies a network interface on an IP network, much like a postal address identifies a building. Every packet that crosses the internet carries a source and a destination address, and routers use those numbers to move it closer to its target hop by hop. When you rent a VPS you receive at least one public IP address, and knowing what it is, how it differs from private addresses, and how IPv6 fits in will make firewall rules, DNS records and troubleshooting far less mysterious.

IPv4: the classic format

An IPv4 address is 32 bits long and written as four decimal numbers from 0 to 255 separated by dots, for example 203.0.113.10. That gives roughly 4.3 billion possible addresses, which turned out to be far too few for a world of phones, laptops, servers and smart devices. The regional registries have long since run out of fresh IPv4 blocks, which is why IPv4 addresses are now a scarce, traded resource and why many providers charge for them separately.

IPv6: the long-term answer

An IPv6 address is 128 bits long and written as eight groups of four hexadecimal digits separated by colons, such as 2001:0db8:0000:0000:0000:0000:0000:0010. Two shortening rules make it readable:

  • Leading zeros in each group can be dropped: 0db8 becomes db8.
  • One run of consecutive zero groups can be replaced by ::, so the example becomes 2001:db8::10.

The address space is so large that a single server commonly receives a whole /64 subnet, which is about 18 quintillion addresses. IPv6 also removes the need for NAT in most designs, because every device can have a globally unique address. Firewalls therefore matter just as much on IPv6 as on IPv4: a rule set that only covers IPv4 leaves the IPv6 side open.

Public vs private addresses

Public addresses are globally routable and unique on the internet. Private addresses are reserved for internal networks and are never routed on the public internet.

RangeTypeTypical use
10.0.0.0/8Private IPv4Large internal and cloud networks
172.16.0.0/12Private IPv4Internal networks, Docker defaults use part of it
192.168.0.0/16Private IPv4Home and office routers
100.64.0.0/10Carrier-grade NATISPs sharing one public IP among customers
127.0.0.0/8LoopbackThe machine talking to itself
169.254.0.0/16Link-localAutomatic addressing when no DHCP is available
fc00::/7Unique local IPv6Private IPv6 networks
fe80::/10Link-local IPv6Present on every IPv6 interface
::1Loopback IPv6IPv6 version of localhost

A useful rule for servers: bind databases and admin tools to 127.0.0.1 or a private network address, and expose only the services that must be public.

CIDR notation and subnets

You will often see addresses written with a slash, like 10.0.1.0/24. The number after the slash is the prefix length: how many leading bits identify the network. The remaining bits identify hosts inside it.

  • /32 in IPv4 (or /128 in IPv6) is a single address. Firewall rules allowing only your office IP use this.
  • /24 is 256 IPv4 addresses, of which 254 are usable for hosts in a classic subnet.
  • /64 is the standard size for an IPv6 subnet.

When a cloud firewall asks for a source, 0.0.0.0/0 means every IPv4 address and ::/0 means every IPv6 address.

NAT: why your home has one public IP

Network Address Translation lets many private devices share one public IPv4 address. Your router rewrites outgoing packets so they appear to come from its public address and remembers which internal device started each connection. This is why you can browse from home but nobody on the internet can open a connection to your laptop directly. Servers usually avoid this limitation by having their own public address, which is exactly what makes a VPS reachable for websites, game servers and remote desktops.

Static vs dynamic addresses

Home connections often receive dynamic addresses that change periodically. Servers need static addresses so DNS records stay valid. A VPS keeps its primary IP for as long as the server exists. Some platforms also offer floating or additional IPs that can be moved between servers, which helps with failover.

Inspecting IP addresses on a server

On Linux:

# Show all addresses on all interfaces
ip -br address

# Show only IPv4 or only IPv6
ip -4 addr show
ip -6 addr show

# Show the routing table and default gateway
ip route
ip -6 route

# Ask an external service which public IP you appear as
curl -4 https://ifconfig.me
curl -6 https://ifconfig.me

On Windows Server, run ipconfig /all in a command prompt or Get-NetIPAddress in PowerShell.

If the address shown inside the VPS matches the one in your control panel, the server is directly on a public IP. If you only see a private address, traffic is reaching you through NAT, and you would need port forwarding at the gateway.

Practical checklist for a new VPS

  • Note both the IPv4 and IPv6 address and create matching A and AAAA records. Our DNS guide explains how.
  • Apply firewall rules to both address families.
  • Restrict SSH or RDP to your own IP with a /32 rule when your address is stable.
  • Keep internal services on loopback or a private network.
  • Check that the reverse DNS (PTR) of the IP matches your hostname if you send email.

Ready to get a server with its own public IPv4 and IPv6? See the plans on our pricing page.

FAQ

Can two servers have the same IP address?

Two devices cannot share the same public address on the internet at the same time without special techniques such as anycast. Private addresses, however, are reused in millions of separate networks, which is why 192.168.1.1 exists in countless homes.

Do I still need IPv4 if my server has IPv6?

Yes, in most cases. A meaningful share of visitors and services still connect over IPv4 only, so a public website should be reachable on both. IPv6-only servers can work for internal systems or behind a proxy that offers IPv4.

Does an IP address reveal my exact location?

No. Geolocation databases estimate a country or city from an address, and they are often wrong at city level. For a server, the IP indicates the data center region, which is one reason the location you choose affects latency for your users.

Related guides