Block D: network and backup (26-30)¶
Task 26: IP addresses¶
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¶
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¶
✅ Several addresses came back: two IPv4 and two IPv6.
Task 29: ports and the SSH connection¶
✅ 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.