Lab QEMU¶
Hampir semua langkah sudah diotomasi oleh tests/qemu/lab.sh, yang dijalankan dari root repository.
Topologi¶
| VM | vCPU / RAM | NIC data | Akses |
|---|---|---|---|
| r1 | 3 / 3 GB | eth1 → R2 (unit 0 + unit 100 VLAN 100), eth2 WAN (QEMU NAT), eth3 → s1 (port access VLAN srv 20, gateway irb.20) |
SSH :2221, VNC :5901 |
| r2 | 3 / 3 GB | eth1 → R1, eth2 → c1 (port trunk VLAN cli 30, gateway irb.30) |
SSH :2222, VNC :5902 |
| c1 | 1 / 1 GB | 10.30.0.10/24 di VLAN 30 ber-tag (enp0s4.30), route ke s1 via R2 |
SSH :2223, VNC :5903 |
| s1 | 1 / 1 GB | 10.20.0.10/24, iperf3 -s |
SSH :2224, VNC :5904 |
- Setiap "kabel" adalah pasangan socket UDP di host, jadi tidak butuh root, bridge, atau tap.
- NIC management (
enp0s3) setiap VM tetap di Linux. - Port dataplane router ditunjuk lewat slot PCI (
0000:00:04.0=eth1, dan seterusnya), sehingga tidak bergantung pada nama NIC.
Kebutuhan host¶
- Linux x86-64 dengan KVM (
/dev/kvm). Tanpa KVM tetap jalan, tapi sangat lambat. - RAM 10 GB, 8 core, disk 15 GB. Bisa diubah lewat
ROUTER_MEM,ROUTER_CPUS,HOST_MEM,HOST_CPUS.
sudo apt install qemu-system-x86 qemu-utils cloud-image-utils socat openssh-client curl virt-viewer imagemagick
Langkah¶
- Siapkan: unduh image Debian 12, buat disk, cloud-init.
- Nyalakan keempat VM (boot pertama 1–2 menit per VM):
- Install router di r1 dan r2:
- Konfigurasi dari
tests/qemu/r1.cmdsdanr2.cmds, yang membuat alamat, VLAN, route, NAT, dan user: - Uji:
==> CID Router lab test
PASS R1 VPP is running
PASS R2 VPP is running
PASS R1 eth1/eth2 are VPP linux-cp pairs
PASS R1 -> R2 direct link (10.0.12.2)
PASS R2 -> R1 direct link (10.0.12.1)
PASS R1 -> R2 over VLAN 100 (10.100.0.2)
PASS Static routes: loop 1.1.1.1 -> 2.2.2.2
PASS VPP FIB on R1 has 2.2.2.2/32 via eth1
PASS R2 -> WAN gateway through R1 (forward + NAT)
PASS R1 NAT44 session for R2 exists
PASS R2 -> internet DNS through R1 NAT (dig @8.8.8.8)
PASS R1 irb.20 is the gateway of VLAN srv (BVI in bridge-domain 20)
PASS R1 eth3 is an access port of VLAN srv
PASS R2 eth2 trunk carries VLAN 30 (tag popped)
PASS s1 -> irb.20 gateway (access port, untagged)
PASS c1 -> irb.30 gateway (trunk, VLAN 30 tagged)
PASS c1 -> s1 through irb.30, R2, R1, irb.20 (VPP forwarding)
PASS R1 root has the factory empty password
PASS R1 user admin: login shell is the CLI
PASS R1 user admin (super-user) can configure
PASS R1 user noc (read-only) cannot configure
PASS R1 user admin password is cidr123 (shadow)
PASS R1 noc cannot read root files via 'cidr-cli -f'
PASS R1 noc sees no password hashes
PASS R1 config files are root-only (0600)
PASS R1 eth1 VPP counters show traffic
Result: 26 passed, 0 failed
Apa yang dibuktikan tiap test
| Test | Bukti |
|---|---|
| linux-cp pairs | VPP memegang NIC dan membuat cermin eth1/eth2 di Linux |
| Direct link | Alamat dari CLI sampai ke VPP (Linux → linux-nl → VPP); ARP dan ICMP lewat VPP |
| VLAN 100 | Unit ber-vlan-id (sub-interface 802.1Q) berjalan di VPP |
| Loopback → loopback | Static route: CLI → FRR → kernel → linux-nl → FIB VPP |
| FIB VPP | Route benar-benar ada di tabel forwarding VPP |
| R2 → WAN lewat R1 | Forwarding murni VPP dan NAT44 |
| irb + access/trunk | VLAN menjadi bridge domain VPP; irb menjadi gateway; tag trunk dilepas saat masuk bridge |
| c1 → s1 | Trafik client (VLAN 30 ber-tag) ke server (VLAN 20 tanpa tag) dirutekan lewat dua irb dan dua router |
| User & file | Model login, kelas, password, dan perlindungan hash |
Login¶
| User | Password | Masuk ke |
|---|---|---|
root |
(kosong) | Shell Linux, ketik cli (hanya console/layar) |
admin |
cidr123 |
CLI router, kelas super-user |
noc (r1) |
noc12345 |
CLI router, kelas read-only |
Layar dan SSH¶
Setiap VM bisa dibuka lewat layar dan lewat SSH.
| Host | Layar |
|---|---|
| Desktop Linux | Jendela cidr-r1, cidr-r2, … langsung muncul |
| Server tanpa desktop | VNC: r1 localhost:5901, r2 :5902, c1 :5903, s1 :5904 |
Lab di server lain? Buat tunnel VNC dari laptop:

Pilihan VM_DISPLAY: auto (default), gtk, sdl, vnc, none. Jendela VM tidak bisa ditutup dengan tombol X, supaya VM tidak mati tanpa sengaja.
Perintah lab.sh¶
| Perintah | Fungsi |
|---|---|
prepare |
Image, disk, cloud-init |
start vm\|all |
Nyalakan VM |
install r1\|r2 |
Salin repo dan jalankan installer |
configure r1\|r2 |
Muat tests/qemu/<vm>.cmds lewat CLI |
push r1\|r2 |
Salin repo saja |
test |
Test suite |
bwtest [streams] [detik] |
Uji trafik |
view, screenshot, console, ssh |
Akses |
stop vm\|all, destroy |
Matikan VM, atau hapus seluruh lab (~/cidr-lab) |
qemu-cmd vm |
Tampilkan perintah QEMU lengkap |
Di Proxmox¶
Buat VM Debian 12 dengan 2–3 NIC virtio. Hubungkan NIC dataplane kedua router ke bridge yang sama (misalnya vmbr1 tanpa uplink), lalu jalankan install.sh --ports ... di masing-masing router.