ipdetecto.com logo
ipdetecto.com
My IPSpeed
Knowledge Hub
HomeKnowledge HubCommands Finding Public Private Ip Addresses
© 2026 ipdetecto.com
support@ipdetecto.comAboutContactPrivacyTermsllms.txt
Basics
5 MIN READ
Apr 19, 2026

Commands for Finding Public and Private IP Addresses

Read RFC1918 interface addresses with ip and hostname, discover the active default egress path with ip route get, learn the WAN IPv4 seen by peers via HTTPS echo services, and interpret CGNAT and IPv6 temporary addresses.

Private (local) addresses

On Linux, ip -br a lists interfaces with CIDRs. RFC1918 IPv4 space (10/8, 172.16/12, 192.168/16) and ULA IPv6 (fd00::/8) are not globally routable—they identify you on a LAN or VPN overlay, not on the public internet.

Which path is used?

ip route get 1.1.1.1 shows the source IP and outbound interface the kernel would select. That source is what upstream NAT may translate to a public address.

Public (egress) discovery

HTTPS services such as ifconfig.me or api.ipify.org return the IPv4 or IPv6 address their server saw on the TCP connection—use curl -4 or curl -6 to force a family. Behind CGNAT several subscribers may share one public IPv4; the address can change between sessions.

Windows and macOS

PowerShell: Get-NetIPAddress -AddressFamily IPv4 | Where PrefixOrigin -ne WellKnown for configured addresses; still use an external echo for WAN. macOS: ipconfig getifaddr en0 for common Wi-Fi.

Related: public vs private IP, how to find your IP address, routing table commands, curl vs wget.

Frequently Asked Questions

Q.Why does curl ifconfig.me differ from what my router WAN page shows?

You might be hitting IPv6 while the router page shows IPv4, or traffic exits via VPN/proxy while the router reports the ISP handoff. Align address family flags and disconnect VPN for a clean test.

Q.Is 100.64.0.0/10 my public IP?

No—that is CGNAT shared space between ISP and carrier-grade NAT gear. Peers on the open internet still see a different translated address at the ISP edge.

Q.Why do IPv6 addresses keep changing on my laptop?

Privacy extensions generate temporary global addresses for outbound connections while a stable SLAAC address may remain for inbound—document which address type your firewall rules target.

Q.Does hostname -I show my public IP?

Usually not—it prints locally configured addresses on all interfaces, mostly private or link-local. Use explicit egress tests for WAN.

Q.How do corporate proxies affect public IP checks?

curl through HTTP_PROXY may show the proxy’s egress IP, not your laptop’s. Unset proxy variables or use curl --noproxy '*' for a direct path when diagnosing NAT.

Q.Why does ip addr show multiple IPv4 on one NIC?

Aliases, VIPs, or containers attached to macvlan/bridge interfaces—map each address to a service before assuming which one NAT uses.

Q.Can I find public IP without third-party websites?

Yes—query your own cloud instance’s logs, use STUN for some VoIP stacks, or run `dig +short myip.opendns.com @resolver.opendns.com` style tricks, still trusting that resolver path.

Q.How is this different from checking open ports?

Address discovery tells you which IP the world might see; port checks confirm which TCP/UDP services accept connections. Combine both when debugging remote access.
TOPICS & TAGS
public IP command lineprivate IP address commandip route getcurl ifconfigCGNAT public IP