Fundamentals

Internet addresses

Easy
45 min

Website Address

In order for online communication to be successful, we need a way to identify and determine the location of a device on the internet. We also need a way to separate networks from each other. The concept is very similar to a traditional home address and the combination of numbers/letters that identifies apartments. For example, all the apartments in a housing complex are located at the same address and they are differentiated using a number and/or letter.

In information technology, this concept is implemented with an IP address and address spaces. Every device on the internet has an IP address, and every internet network has its own address space. IP addresses must also be divided into two categories, private and public addresses. A private address identifies a device within its local network, and it can only be seen by other devices on the same network and the network router. A public address, on the other hand, is used for communication between networks.

For example, when you connect to Google services, your device first communicates with your router using your private address. Then, the router forwards this request to Google using a public address. It is also important to note that due to this, Google services can only see the public address, which is the same for every device on the local network. This address translation is done using a method called network address translation, or NAT for short, and it is one of the tasks of a router.

Domain


Since using the aforementioned IP addresses in everyday life would be impractical and difficult, a concept called domain name has been developed. Domain names, such as google.com or hakatemia.fi, are simply more easily remembered counterparts to IP addresses. For example, we can only imagine what life would be like if every time you wanted to visit Hakatemia's website, you had to type in the address 76.76.21.21. But in order to enjoy these domain names, we first need a tool for their maintenance and creation. This tool is called a name server, in English Domain Name System or DNS.

The main task of the name server is to convert domain names to IP addresses. At this point, it is good to remember that routing ultimately happens with these IP addresses, not domain names. For example, if a user navigates with their browser to the address www.google.com, the user's device first sends that domain name to the name server, and then the name server returns to the device the IP address corresponding to that domain name, for example, 216.58.209.196. Communication between the name server and the device happens with the DNS protocol.

Localhost - My computer

Localhost or the equivalent IPv4 address (127.0.0.1) is the computer's own IPv4 address and can only be accessed on the computer itself. Localhost is a network address assigned to the computer, so it is not an IP address on the internet. Typically, a computer has at least two different IP addresses, one being the mentioned 127.0.0.1 and another that allows the computer to communicate with, for example, your home modem. But whether you are connected to the network, for example, via WiFi or without a network, your computer always has the address 127.0.0.1. So, for example, you can host a website on your computer that can be accessed in a browser using that localhost address.

Address 0.0.0.0

Address 0.0.0.0 is an address that typically appears in routing tables and port listings. This address refers to all addresses simultaneously, so if your device is connected to multiple networks (such as WiFi and cable), you can set a service on your computer to be open to all available networks by setting the service to listen to the address 0.0.0.0. It is important to understand that you cannot actually connect to this address, but you need a specific address for that purpose.

Internet addresses - exercise

Practice what you have learned on the Linux command line.

  • To find out your private IP address, use the command ip address show dev eth0
  • The currently used public IP address can be obtained, for example, by using the command dig @ns1.google.com TXT o-o.myaddr.l.google.com +short
  • To find the IP address corresponding to a domain name, use the command nslookup www.example.com

Exercises

Task 1

Find out the private IP address of your computer and save it in the file ~/private.txt

Task 2

Find out the public IP address of your computer and save it in the file ~/public.txt

Task 3

Find out the www.wikipedia.fi IP address and save it in the file ~/wiki.txt

hakatemia pro

Ready to become an ethical hacker?
Start today.

As a member of Hakatemia you get unlimited access to Hakatemia modules, exercises and tools, and you get access to the Hakatemia Discord channel where you can ask for help from both instructors and other Hakatemia members.