What is my IP address?
Note : Concepts quickly discussed here are dealt deeper in network section.
Before defining an
IP address (Internet Protocol),
lets get serious and think about Santa 😁.
Every child know he must send his present whishlist to “Heaven road,
North Pole”. To get an answer, he must write its own address in the
The same principle happens when your boring colleague shows you a cat video on Youtube : the computer knows where to find Youtube, and Youtube knows where sending video data.
Every device has its own address when connected to the internet : IP address. However, computers aren't childrens, they use a set of numbers as addresses, i.e “192.0.2.2”. Too bad for Santa 🎅.
But, how devices can find a website address? Is there a directory ?
That's an interesting idea. Indeed, there is something like a directory. Read about domain names to learn more about it.
There is two kind of IP : public and local (or private). Most of the time, your internet service provider (ISP) gave you a router. The router is connected to the internet and has a public IP. Your computer access the internet through the router. The router gave your device a local IP:
image from : http://sindhusps.blogspot.com/2018/03/private-vs-public-ip.html
Remember this :
- Local IP is useful for traffic inside your private network, meaning between devices connected to your router (phone, computer, printer) : on the left in the picture.
- Public IP is used to acces your network from the outside : it is used in the world wide web.
To self-host your server, it is very handy to have a static public IP address. Try to choose an Internet provider that offer one. If you can't, there are solutions such as getting an IPv6, Dynamic DNS or a VPN (explained later), but they are quite complicated.
If you want to know what is your public IP, you can visit one of these links (there are more):
That should be enough for now 😁.
To get the local IP of a device, your server I guess, enter
Below, I suggest to filter results with grep:
# ifconfig |grep inet
You'll see such things:
inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 inet 127.0.0.1 netmask 0xff000000 inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255 inet6 fe80::feaa:14ff:fe65:5f86%re0 prefixlen 64 scopeid 0x1
Wait, am I supposed to understand this ? 😲
Not yet, let's look at it together :
inet6 means the following IP is an IPv4 or an IPv6.
127.0.0.1: localhost addresses, IPV6 and IPV4. This is not the IP we are looking for.
- Ip starting with
192.168.are, most of the time your local IP. The first is in IPv6 form, the later in IPv4 form.
If I want to read your self-hosted website, all I know is your public IP address. This leads me to your router, however, the website is hosted on your server beind the router. The router must redirect me to your server, he knows his local IP. Next page explain how to do it 😉
Next page →