# Guides: IP addresses for developers and users | host.sh

> Practical guides on IP addresses: why your device's IP differs from the one sites see, and how to get the real client IP behind a proxy or Cloudflare.

Short guides on the questions behind an IP lookup. Every fact links to its source: the RFCs, the IANA registries, and the documentation of the software involved.

## The guides

- [Public vs private IP](https://www.host.sh/guides/public-vs-private-ip/index.md): why your computer shows `192.168.1.23` while websites see another address. Private ranges, NAT, carrier-grade NAT, IPv6 temporary addresses, and how to see each address.
- [Client IP behind a proxy](https://www.host.sh/guides/client-ip-behind-proxy/index.md): how to get the visitor's real address behind nginx, Cloudflare, an AWS load balancer, Express or Django, and why `X-Forwarded-For` can be forged.
- [IPv4 vs IPv6](https://www.host.sh/guides/ipv4-vs-ipv6/index.md): why one site shows your IPv6 address and another your IPv4 one, how devices choose, NAT64 on mobile networks, and how to check IPv6 works.
- [Your IP in a script](https://www.host.sh/guides/public-ip-command-line/index.md): your public IP from bash, fish, PowerShell, Python, Node, Go and PHP, with timeouts and a check that the answer is an IP address.

## Tools to try alongside

- [IP lookup](https://www.host.sh/lookup/index.md): your public address, its network and location.
- [IPv6 test](https://www.host.sh/ipv6/index.md): your IPv6 and IPv4 addresses, and which one sites see.
- [curl host.sh](https://www.host.sh/curl/index.md): your address from a terminal or a script.
- [Well-known IPs](https://www.host.sh/ip/index.md): who runs 8.8.8.8, 1.1.1.1 and 9.9.9.9.

## FAQ

### What is the difference between a public and a private IP address?

A public address is reachable on the internet and identifies your router or provider to the sites you visit. A private address, such as 192.168.1.23, is from one of the ranges in [RFC 1918](https://www.rfc-editor.org/rfc/rfc1918), used only inside a home or company network and translated to a public one by NAT.

### How do I get a visitor's IP address behind a reverse proxy?

Read X-Forwarded-For, or your CDN's header such as CF-Connecting-IP, but only on requests from your own proxies, and take the first address from the right that is not one of them, as [MDN describes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-For). The client-IP guide has the settings for nginx, Express, Django and more.

### Do I need an API token to find my own IP address?

No. curl host.sh, the IP lookup and a tokenless API call all give your own address. A token is needed to look up other addresses ([Lookup](https://www.host.sh/docs/lookup/index.md)).

### Will there be more guides?

Yes. Next up is detecting a visitor's country and currency from their IP address.
