Table of Contents
What you will read?
If you’re running a VPS with Ubuntu 24.10, finding its public or private IP address is simple using terminal commands. Here’s how to do it.
Step 1: Use ip Command (For Private IP)
To check your internal/private IP address:
ip a
Look for the section that starts with inet under your main network interface (usually eth0 or ens3):
inet 192.168.0.10/24
That 192.168.x.x or 10.x.x.x address is your private IP.
Step 2: Get Public IP Using curl
Most VPS providers assign a public IP, which you can get with:
curl ifconfig.me
Or:
curl -s https://ipinfo.io/ip
This will return your VPS’s public IP address, which is reachable from the internet.
Step 3: Use hostname -I for Simpler Output
If you just want a clean list of IPs assigned to your machine:
hostname -I
This shows both private and public IPs, space-separated.
Step 4: Check IP via ip route get
This command can show the IP used to reach the internet:
ip route get 1.1.1.1
Output:
1.1.1.1 via 192.168.1.1 dev eth0 src 203.0.113.45 uid 1000
Here, src 203.0.113.45 is your public IP.
That’s it — using these commands, you can quickly find your VPS IP address on Ubuntu 24.10 whether it’s public or private. Let me know if you need help configuring static IPs or DNS settings next.
