86 lines
1.5 KiB
Markdown
86 lines
1.5 KiB
Markdown
# 🌐 Phase 2: Networking
|
|
|
|
> Goal: Machines communicate — ping, SSH, file transfers
|
|
|
|
---
|
|
|
|
## 🎯 Exercise 1 — Ping & IPs
|
|
|
|
```bash
|
|
# Check your network
|
|
ip addr show eth0
|
|
ip route
|
|
|
|
# Ping the other lab VM
|
|
ping -c 4 10.0.1.2 # From alpine-1 → alpine-2
|
|
ping -c 4 10.0.1.1 # From alpine-2 → alpine-1
|
|
|
|
# Check ARP table
|
|
ip neigh
|
|
|
|
# Advanced network tools
|
|
ip addr # All interfaces
|
|
ip route # Routing table
|
|
traceroute 10.0.1.2 # Path between VMs
|
|
```
|
|
|
|
### 📝 Questions:
|
|
1. What's the MAC address of the other VM?
|
|
2. Can you ping alpine-hop (10.0.1.3) from alpine-1?
|
|
|
|
---
|
|
|
|
## 🎯 Exercise 2 — SSH Keys
|
|
|
|
```bash
|
|
# Generate an SSH key
|
|
ssh-keygen -t ed25519
|
|
|
|
# Copy to the other VM
|
|
ssh-copy-id root@10.0.1.2
|
|
|
|
# Test passwordless login
|
|
ssh root@10.0.1.2 'hostname; uptime'
|
|
```
|
|
|
|
---
|
|
|
|
## 🎯 Exercise 3 — File Transfer
|
|
|
|
```bash
|
|
# SCP (secure copy)
|
|
echo "Secret message" > /root/secret.txt
|
|
scp /root/secret.txt root@10.0.1.2:/root/
|
|
|
|
# RSYNC (sync directories)
|
|
rsync -av /root/lab/ root@10.0.1.2:/root/lab-backup/
|
|
```
|
|
|
|
---
|
|
|
|
## 🎯 Exercise 4 — Network Services
|
|
|
|
```bash
|
|
# Check listening ports
|
|
ss -tlnp
|
|
|
|
# Start a simple HTTP server on alpine-1
|
|
python3 -m http.server 8080 &
|
|
|
|
# Access it from alpine-2
|
|
curl http://10.0.1.1:8080/
|
|
|
|
# Kill the server
|
|
kill %1
|
|
```
|
|
|
|
---
|
|
|
|
## ✅ Phase 2 Checklist
|
|
- [ ] Ping between VMs
|
|
- [ ] SSH key-based auth
|
|
- [ ] File transfer with `scp` / `rsync`
|
|
- [ ] Network services
|
|
|
|
**Previous:** [[Phase 1 - Walking]] | **Next:** [[Phase 3 - Users and Files]]
|