>_ IzzyLab

Hands-on task

This task is step 1 of the course “Networking: first steps”

Find your IP address

easy~4 min

Every machine on a network has an IP address — that's how other machines find it. Find the IPv4 address of this sandbox — the one on its network card — and write it to /root/my_ip.txt.

You need just the address itself — four numbers separated by dots, without a mask like /24 at the end. The service address 127.0.0.1 won't do: every machine has it.

What you'll practise:
  • ip a
  • IP address
  • network interfaces

Topic breakdown

An IP address is a machine's number on the network; packets use it to find their destination. The familiar form is IPv4: four numbers from 0 to 255 separated by dots, for example 10.0.5.17.

The address belongs not to the machine as a whole but to its network interface — a network card. There can be several interfaces, each with its own address. To see them all, run ip a (short for ip address):

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 ...
    inet 127.0.0.1/8 scope host lo
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...
    link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
    inet 10.0.5.17/24 brd 10.0.5.255 scope global ens3
    inet6 fe80::5054:ff:fe12:3456/64 scope link

Here the network card ens3 has the address 10.0.5.17. The /24 tail is the mask: it says which part of the address is the network number and which is the machine's number within it. The inet6 lines are addresses in the newer IPv6 format, and link/ether is the card's hardware MAC address.

Every machine has the lo interface (loopback). Its address 127.0.0.1 means "myself": packets sent to it go nowhere and come back to the same machine. That's why it's no good as the server's address for others.

What's checked

  1. File /root/my_ip.txt created
  2. The address is written without a mask
  3. It's the address of the sandbox's network card

What it looks like