OS & Linux Engineering / LINUX NETWORKING & SERVICE DIAGNOSIS / OSX-029
Binding Mystery
Explore concept graphPraktik dan verifikasi mandiri
Lab: Binding Mystery
Konsep 1 / 3
Predict Linux IPv4 loopback and wildcard listening behavior without assuming remote reachability.
Compare bind 127.0.0.1, 0.0.0.0 and 10.200.30.1 for an otherwise identical server, listing accepted local IPv4 destinations.
Kasus yang berbeda dari contoh: Add a specific veth-only bind case rather than repeating the first two binding options.
Bukti yang bisa kamu periksa
- Three binding predictions plus a warning that 0.0.0.0 does not guarantee external access.
Jika ingin lanjut
Investigate assigned interface addresses, routing and socket state.
Jika terputus: Resume by contrasting server bind address and client destination address.
Konsep 2 / 3
Use ip addr, ip route, ss and curl as independent reachability observations.
Diagnose port 9090 on a different veth prefix, recording one interface, one route and one listener observation before changing any configuration.
Kasus yang berbeda dari contoh: Use a new port and address and write a diagnosis before changing the bind.
Bukti yang bisa kamu periksa
- Three factual observations, predicted fault boundary and proposed minimal repair.
Jika ingin lanjut
Build a real veth-backed namespace lab to test from a peer.
Jika terputus: Start with interface → route → socket → curl as separate tests.
Konsep 3 / 3
Demonstrate that peer namespace localhost is not host localhost, then prove an interface-specific bind correction in a disposable lab.
Repeat with a new namespace name and port 9090, record ss/curl before and after binding to the host's veth address, then clean up.
Kasus yang berbeda dari contoh: Use a new port and namespace, and compare interface-specific bind against wildcard rather than reusing the sample output.
Bukti yang bisa kamu periksa
- Named peer namespace, IP/route and socket observations, host/peer curl comparison, explanation of wildcard exposure and cleanup.
Jika ingin lanjut
Link these findings to the HTTP lifecycle G1/G2 assessment and the remaining production readiness module.
Jika terputus: Recall why peer lo and host lo are independent, even if both have address 127.0.0.1.
Manual netns lab — VM Linux disposable saja
Perlu hak root/CAP_NET_ADMIN, iproute2, curl dan Node. Command berikut mengubah interface/namespace; jangan jalankan pada server produksi.
sudo ip netns add cs101-peer
sudo ip link add cs101-host type veth peer name cs101-peer0
sudo ip link set cs101-peer0 netns cs101-peer
sudo ip addr add 10.200.30.1/30 dev cs101-host
sudo ip link set cs101-host up
sudo ip -n cs101-peer addr add 10.200.30.2/30 dev cs101-peer0
sudo ip -n cs101-peer link set lo up
sudo ip -n cs101-peer link set cs101-peer0 up
ip -br addr
sudo ip -n cs101-peer addr
sudo ip -n cs101-peer routeDi host terminal pertama, buat server loopback:
node -e 'require("node:http").createServer((q,r)=>r.end("ok")).listen(8080,"127.0.0.1")'Di terminal kedua, bandingkan:
ss -lntp '( sport = :8080 )'
curl --noproxy '*' --connect-timeout 2 http://127.0.0.1:8080/
sudo ip netns exec cs101-peer curl --noproxy '*' --connect-timeout 2 -v http://10.200.30.1:8080/Hentikan server (Ctrl+C), kemudian coba bind spesifik ke host veth IP dan ulangi peer curl:
node -e 'require("node:http").createServer((q,r)=>r.end("ok")).listen(8080,"10.200.30.1")'Jika masih gagal, telusuri routing, firewall dan state veth; jangan mengarang observasi. Setelah menghentikan server, bersihkan hanya resource lab:
sudo ip netns del cs101-peer
sudo ip link del cs101-host 2>/dev/null || trueBinding Mystery — peer namespace reachability
Buktikan akses lokal ke API host dan kegagalan akses peer saat bind ke 127.0.0.1, lalu ulangi setelah bind aman ke IP host veth. Cantumkan hasil ip, ss, curl, serta pengaruh routing dan firewall.
Latihan manual — jalankan sendiri di lingkunganmu. Kriteria di bawah adalah pemeriksaan mandiri, bukan penilaian otomatis.
Kriteria selesai
- Tampilkan IP dan route host/peer dengan ip addr dan ip route, bukan berdasarkan dugaan.
- Bandingkan socket 127.0.0.1:8080 vs 10.200.30.1:8080 menggunakan ss -lntp.
- Bandingkan curl localhost host dengan curl peer ke host veth IP, bukan peer 127.0.0.1.
- Jelaskan bahwa 0.0.0.0 wildcard memperluas alamat yang diterima, tidak membuka firewall atau routing.
- Pastikan hasil fixture Linux dibedakan dari lab netns sungguhan; catat permission blocker secara jujur.
- Hentikan server dan hapus named netns/veth lab setelah pengujian.
Kriteria verifikasi mandiri
- Bisa memisahkan masalah address binding, interface, route dan policy firewall.
- Bisa menjelaskan 127.0.0.1 tidak dibagi antar-network-namespace.
- Mempunyai bukti lokal fixture dan, jika punya akses, observasi manual netns veth.
- Memilih bind address spesifik ketimbang wildcard ketika exposure harus dibatasi.