Skip to content

Block D: network and backup (26-30)

Task 26: IP addresses

ip -br -4 addr; ip route show default

On our VirtualBox VM:

Interface Address What it is
lo 127.0.0.1 the machine itself
enp0s3 10.0.2.15 NAT, carries the default route
enp0s8 192.168.56.x host-only, used for SSH

Task 27: ping 127.0.0.1

hostname; ping -c 4 127.0.0.1

Run it on the VM and on your own computer.

✅ 4/4 on both, 0% loss.

🔴 127.0.0.1 is always the machine where you run the command.

Task 28: DNS

resolvectl query example.com
getent ahosts example.com

✅ Several addresses came back: two IPv4 and two IPv6.

Task 29: ports and the SSH connection

sudo ss -tlnp
echo $SSH_CONNECTION; ss -tn state established

✅ SSH listens on port 22 (sshd and systemd). $SSH_CONNECTION (client IP and port, server IP and port) matches one of the connections in ss.

Task 30: backup, restore, wrap up

tar -czf ~/linux-practice-backup.tar.gz -C /srv/linux-practice files backups && tar -tzf ~/linux-practice-backup.tar.gz
mkdir ~/restore-check && tar -xzf ~/linux-practice-backup.tar.gz -C ~/restore-check
diff -r /srv/linux-practice/files ~/restore-check/files && diff -r /srv/linux-practice/backups ~/restore-check/backups && echo "restored copy matches"
sudo systemctl stop linux-practice.service; sudo systemctl disable linux-practice.service
echo "enabled: $(systemctl is-enabled linux-practice.service) | active: $(systemctl is-active linux-practice.service)"

✅ No .ssh or passwords in the listing, restored copy matches, and finally disabled and inactive.