Home / Linux / How to Check Your VPS Public and Private IP

How to Check Your VPS Public and Private IP

Find your VPS public and private IPs using safe commands (ip, hostname, curl) and understand the difference.

Views: 21 Unique: 16 Updated: 2026-03-20

What this is

This guide shows how to identify your VPS private (internal) IP and public (internet) IP.

What it is for

  • Configure DNS, firewalls, and SSH access
  • Debug connectivity issues
  • Know which IP is exposed to the internet

Prerequisites

  • SSH access

Step-by-step

Step 1) Check private IPs (interfaces)

ip a

What it does: Lists network interfaces and their IPs.

Expected output: Interfaces like eth0 with an inet address (often 10.x, 172.16-31.x, 192.168.x).

Step 2) Show the main private IP (quick)

hostname -I

Expected output: One or more internal IPs.

Step 3) Check public IP (from the internet perspective)

curl -s ifconfig.me
curl -s https://api.ipify.org

What it does: Asks an external service “what IP do you see?”

Expected output: A public IPv4/IPv6 address.

Warnings & notes

  • On some providers, your server may have multiple IPs (IPv4 + IPv6).
  • Private IP is used for internal networks (VPC/VLAN) and is not reachable from the internet.

Final verification

ip route

Expected output: Shows your default route (which interface is used to reach the internet).

Conclusion

Now you can identify both the private IP (inside the server) and the public IP (seen from the internet), which is essential for networking and security tasks.

Back to category