Day 2: Namespaces and veth
Goal: Build your first own network from network namespaces and veth cables: two machines directly connected, then two networks routed by the host, with internet access via NAT. Put processes into a namespace and look inside from the outside · Duration: approx. 75 min · Prerequisite: Day 1
Briefing
- A network namespace is a complete, separate network stack in the same kernel: its own interfaces, addresses, routes, neighbor table, firewall rules and sockets. What happens in one namespace, the other doesn’t see.
- A veth pair is a virtual cable with two ends. What goes into one end comes out of the other. If you plug the ends into two namespaces, the two are connected.
- The namespace in which
eth0and your SSH connection live is called the root namespace. In the course we simply say “the host.” - This is exactly how Docker, Podman and Kubernetes build their container networks: one namespace per container (or Pod), one veth pair to the host, routing and NAT on the host. Today you do it by hand.
Drill 2 Drill 3–5
┌────────┐ ┌────────┐ ┌─────────┐ Host ┌──────────┐
│ rot │ │ blau │ │ links │ ┌───────────────────────────┐ │ rechts │
│10.0.0.1├──────┤10.0.0.2│ │eth0 ├───┤h-links ip_forward h-rechts├───┤eth0 │
└────────┘ veth └────────┘ │10.10.1.2│ │10.10.1.1 NAT 10.10.2.1│ │10.10.2.2 │
└─────────┘ └────────────┬──────────────┘ └──────────┘
│ eth0 172.16.0.123
▼ Internet
All commands need sudo: only root may create namespaces
and move interfaces.
Drill 1: Two empty namespaces
You already know the namespace probe from Day 0. Today
you create two that will talk to each other shortly:
# on netz
sudo ip netns add rot
sudo ip netns add blau
ip netns list
ls -l /run/netnsExpected:
blau
rot
total 0
-r--r--r-- 1 root root 0 Nov 23 19:25 blau
-r--r--r-- 1 root root 0 Nov 23 19:25 rot
Inside there’s only lo, and it’s down (the Challenge
from Day 0):
# on netz
sudo ip netns exec rot ip -br a
sudo ip netns exec rot ip link set lo upExpected:
lo DOWN
For ip itself there’s a shortcut:
ip -n rot … is the same as
ip netns exec rot ip …. For all other programs
(ping, curl, ss), you stick with
ip netns exec.
Save your progress? Sign up for free
Drill 2: The first cable
Create a veth pair. Both ends are initially on the host:
# on netz
sudo ip link add veth-rot type veth peer name veth-blau
ip -br link show type vethExpected:
veth-blau@veth-rot DOWN 2e:3f:fd:5b:66:65 <BROADCAST,MULTICAST,M-DOWN>
veth-rot@veth-blau DOWN e6:4e:b2:1e:66:02 <BROADCAST,MULTICAST,M-DOWN>
After the @ is the other end. Now plug the ends into the
namespaces:
# on netz
sudo ip link set veth-rot netns rot
sudo ip link set veth-blau netns blau
ip -br link show type veth
sudo ip netns exec rot ip -br linkExpected: Nothing is visible on the host anymore;
one end is in rot:
lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
veth-rot@if8 DOWN e6:4e:b2:1e:66:02 <BROADCAST,MULTICAST>
@veth-blau has become @if8: the other end
is in a different namespace, and rot only knows it as
interface number 8 “somewhere.”
Set addresses, switch on, ping:
# on netz
sudo ip -n rot addr add 10.0.0.1/24 dev veth-rot
sudo ip -n blau addr add 10.0.0.2/24 dev veth-blau
sudo ip -n rot link set veth-rot up
sudo ip -n blau link set veth-blau up
sudo ip -n blau link set lo up
sudo ip -n blau -br a
sudo ip netns exec rot ping -c2 10.0.0.2Expected:
lo UNKNOWN 127.0.0.1/8 ::1/128
veth-blau@if9 UP 10.0.0.2/24 fe80::7463:11ff:fe72:4b38/64
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.269 ms
64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.107 ms
Tried it:
veth-blauhad the MAC2e:3f:fd:5b:66:65when created, and after being switched on in the namespace76:63:11:72:4b:38. That’s the same udev rule as with the dummies on Day 1 (MACAddressPolicy=persistent): it gives every new interface a fixed MAC computed from the name. If you need a specific MAC, set it after moving the interface.
And to the outside? Nothing:
# on netz
sudo ip -n rot route
sudo ip netns exec rot ping -c1 -W1 172.16.0.1Expected:
10.0.0.0/24 dev veth-rot proto kernel scope link src 10.0.0.1
ping: connect: Network is unreachable
rot only knows its own network. There’s no path to the
host, and so none into the lab either.
Save your progress? Sign up for free
Drill 3: A namespace on the host
Now the pattern containers use: one end of the cable stays on the
host, the other is called eth0 in the namespace. With
peer name … netns … it lands directly at its destination
when created:
# on netz
sudo ip netns add links
sudo ip netns add rechts
sudo ip link add h-links type veth peer name eth0 netns links
sudo ip link add h-rechts type veth peer name eth0 netns rechts
ip -br link show type vethExpected:
h-links@if2 DOWN 3a:4d:66:f3:c6:1a <BROADCAST,MULTICAST>
h-rechts@if2 DOWN 26:7b:06:7b:d1:f7 <BROADCAST,MULTICAST>
Two interfaces named eth0, and neither interferes with
the host’s real eth0: each namespace has its own name space
for interfaces.
Addresses: the host gets .1 in each network, the
namespace gets .2:
# on netz
sudo ip addr add 10.10.1.1/24 dev h-links
sudo ip addr add 10.10.2.1/24 dev h-rechts
sudo ip link set h-links up
sudo ip link set h-rechts up
sudo ip -n links addr add 10.10.1.2/24 dev eth0
sudo ip -n rechts addr add 10.10.2.2/24 dev eth0
sudo ip -n links link set eth0 up
sudo ip -n rechts link set eth0 up
sudo ip -n links link set lo up
sudo ip -n rechts link set lo up
ping -c1 -W1 10.10.1.2 | tail -2
sudo ip netns exec links ping -c1 -W1 172.16.0.123
sudo ip netns exec links ping -c1 -W1 10.10.2.2Expected:
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.203/0.203/0.203/0.000 ms
ping: connect: Network is unreachable
ping: connect: Network is unreachable
The host and links reach each other, but even the host’s
other address (172.16.0.123) is outside any route for
links. The default route is missing, and the gateway is the
host:
# on netz
sudo ip -n links route add default via 10.10.1.1
sudo ip -n rechts route add default via 10.10.2.1
sudo ip -n links route
sudo ip netns exec links ping -c1 -W1 172.16.0.123 | tail -2Expected:
default via 10.10.1.1 dev eth0
10.10.1.0/24 dev eth0 proto kernel scope link src 10.10.1.2
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.186/0.186/0.186/0.000 ms
Save your progress? Sign up for free
Drill 4: The host as a router
links has a route to rechts (the default
route), yet nothing arrives:
# on netz
sudo ip netns exec links ip route get 10.10.2.2
sudo ip netns exec links ping -c2 -W1 10.10.2.2 | tail -2
sysctl net.ipv4.ip_forwardExpected:
10.10.2.2 via 10.10.1.1 dev eth0 src 10.10.1.2 uid 0
cache
2 packets transmitted, 0 received, 100% packet loss, time 1046ms
net.ipv4.ip_forward = 0
Where do the packets go? Listen on both host ends while
links pings. First h-links, then
h-rechts:
# on netz
sudo timeout 3 tcpdump -ni h-links -c4 icmp &
sleep 0.5; sudo ip netns exec links ping -c2 -W1 10.10.2.2 >/dev/null; wait
sudo timeout 3 tcpdump -ni h-rechts -c4 icmp &
sleep 0.5; sudo ip netns exec links ping -c2 -W1 10.10.2.2 >/dev/null; waitExpected:
listening on h-links, link-type EN10MB (Ethernet), snapshot length 262144 bytes
19:25:54.781243 IP 10.10.1.2 > 10.10.2.2: ICMP echo request, id 2603, seq 1, length 64
19:25:55.792406 IP 10.10.1.2 > 10.10.2.2: ICMP echo request, id 2603, seq 2, length 64
2 packets captured
listening on h-rechts, link-type EN10MB (Ethernet), snapshot length 262144 bytes
0 packets captured
The requests arrive at the host and die there. A Linux host only forwards other machines’ packets if forwarding is on. That’s the switch from Day 0:
# on netz
sudo sysctl -w net.ipv4.ip_forward=1
sudo ip netns exec links ping -c2 10.10.2.2 | tail -2
sudo ip netns exec links tracepath -n 10.10.2.2Expected:
net.ipv4.ip_forward = 1
2 packets transmitted, 2 received, 0% packet loss, time 1060ms
rtt min/avg/max/mdev = 0.087/0.130/0.174/0.043 ms
1?: [LOCALHOST] pmtu 1500
1: 10.10.1.1 0.324ms
1: 10.10.1.1 0.040ms
2: 10.10.2.2 0.087ms reached
Resume: pmtu 1500 hops 2 back 2
The replies come back with ttl=63 instead of 64: a
router (the host) sits in between and subtracts one.
tracepath shows the path hop by hop. This time
h-rechts sees both directions:
# on netz
sudo timeout 3 tcpdump -ni h-rechts -c4 icmp &
sleep 0.5; sudo ip netns exec links ping -c2 -W1 10.10.2.2 >/dev/null; waitExpected:
19:26:02.131619 IP 10.10.1.2 > 10.10.2.2: ICMP echo request, id 2622, seq 1, length 64
19:26:02.131658 IP 10.10.2.2 > 10.10.1.2: ICMP echo reply, id 2622, seq 1, length 64
19:26:03.153339 IP 10.10.1.2 > 10.10.2.2: ICMP echo request, id 2622, seq 2, length 64
19:26:03.153467 IP 10.10.2.2 > 10.10.1.2: ICMP echo reply, id 2622, seq 2, length 64
ip_forward applies per namespace. What you switch on
here affects only the host; links and rechts
remain pure end devices.
Save your progress? Sign up for free
Drill 5: To the internet with NAT
links can now reach the host and rechts.
And 1.1.1.1?
# on netz
sudo timeout 4 tcpdump -ni eth0 -c4 icmp and host 1.1.1.1 &
sleep 0.5; sudo ip netns exec links ping -c2 -W1 1.1.1.1; waitExpected:
2 packets transmitted, 0 received, 100% packet loss, time 1008ms
19:26:10.784488 IP 10.10.1.2 > 1.1.1.1: ICMP echo request, id 2676, seq 1, length 64
19:26:11.792504 IP 10.10.1.2 > 1.1.1.1: ICMP echo request, id 2676, seq 2, length 64
The packets leave the VM via eth0, with source
10.10.1.2. The router in the lab doesn’t know this address,
so the reply finds no way back. The host has to replace the source
address with its own: source NAT, called “masquerading”
when the own address changes. A single rule in nftables is enough for
this. nftables itself is the topic of a separate course; here only the
essentials:
# on netz
sudo nft add table ip labor
sudo nft add chain ip labor post '{ type nat hook postrouting priority srcnat; }'
sudo nft add rule ip labor post ip saddr 10.10.0.0/16 oifname eth0 masquerade
sudo nft list table ip laborExpected:
table ip labor {
chain post {
type nat hook postrouting priority srcnat; policy accept;
ip saddr 10.10.0.0/16 oifname "eth0" masquerade
}
}
Read as: packets from 10.10.0.0/16 that go out via
eth0 get the address of eth0 as their source
just before leaving (postrouting).
# on netz
sudo timeout 4 tcpdump -ni eth0 -c4 icmp and host 1.1.1.1 &
sleep 0.5; sudo ip netns exec links ping -c2 -W2 1.1.1.1 | tail -2; wait
sudo conntrack -L -p icmp 2>/dev/null | head -1Expected:
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 4.530/4.736/4.943/0.206 ms
19:26:15.208048 IP 172.16.0.123 > 1.1.1.1: ICMP echo request, id 2697, seq 1, length 64
19:26:15.212759 IP 1.1.1.1 > 172.16.0.123: ICMP echo reply, id 2697, seq 1, length 64
icmp 1 29 src=10.10.1.2 dst=1.1.1.1 type=8 code=0 id=2697 src=1.1.1.1 dst=172.16.0.123 type=0 code=0 id=2697 mark=0 use=1
Outside, only 172.16.0.123 is visible. How the host
knows that the reply belongs to 10.10.1.2 is revealed by
conntrack: the entry remembers both directions, the
original (src=10.10.1.2) and the expected reply
(dst=172.16.0.123). More on this on Day 5.
And names?
# on netz
sudo ip netns exec links getent ahostsv4 deb.debian.org; echo "rc=$?"
sudo ip netns exec links grep nameserver /etc/resolv.confExpected:
rc=2
nameserver 127.0.0.53
Tried it: In the namespace, the same
/etc/resolv.confapplies as on the host, and it points to127.0.0.53, the systemd-resolved stub. But that listens on the host’slo. Thelooflinksis a different one, and nobody answers there.ip netns exechas its own mechanism for this: if/etc/netns/<name>/resolv.confexists, it’s laid over/etc/resolv.conffor commands in that namespace.
# on netz
sudo mkdir -p /etc/netns/links
echo "nameserver 1.1.1.1" | sudo tee /etc/netns/links/resolv.conf
sudo ip netns exec links getent ahostsv4 deb.debian.org | head -1Expected:
nameserver 1.1.1.1
151.101.2.132 STREAM debian.map.fastlydns.net
Save your progress? Sign up for free
Drill 6: Processes in the namespace
A namespace only becomes useful once something runs in it. A small
web server in rechts, started as a normal user:
# on netz
mkdir -p ~/web && echo "Hallo aus rechts" > ~/web/index.html
sudo ip netns exec rechts sudo -u ubuntu python3 -m http.server 8080 --directory /home/ubuntu/web >/tmp/web.log 2>&1 &
sleep 1
sudo ip netns exec rechts ss -tlnp
ss -tln | grep 8080 || echo "auf dem Host lauscht niemand auf 8080"Expected:
State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0 5 0.0.0.0:8080 0.0.0.0:* users:(("python3",pid=2830,fd=3))
auf dem Host lauscht niemand auf 8080
0.0.0.0:8080 means “all addresses,” but only those of
the namespace. Sockets belong to the namespace.
# on netz
sudo ip netns exec links curl -s http://10.10.2.2:8080/
curl -s http://10.10.2.2:8080/
curl -s --max-time 2 http://127.0.0.1:8080/ || echo "rc=$?"
cat /tmp/web.logExpected:
Hallo aus rechts
Hallo aus rechts
rc=7
10.10.1.2 - - [23/Nov/2026 19:26:31] "GET / HTTP/1.1" 200 -
10.10.2.1 - - [23/Nov/2026 19:26:31] "GET / HTTP/1.1" 200 -
It works from links and from the host, but not via the
host’s 127.0.0.1 (rc=7: connection refused).
The log shows the real sources: links arrives routed and
without NAT (the rule only applies on eth0), the host with
its address in the network of rechts.
Finding out from the outside who runs in which namespace:
# on netz
sudo ip netns pids rechts
P=$(pgrep -u ubuntu -f 'http.server 8080')
sudo ip netns identify $P
sudo readlink /proc/$P/ns/net /proc/1/ns/net
ls -iL /run/netns/rechtsExpected:
2829
2830
rechts
net:[4026532449]
net:[4026531840]
4026532449 /run/netns/rechts
A namespace is a kernel object with a number (inode).
/proc/<pid>/ns/net shows which one a process is in;
/run/netns/rechts is just a name pointing to the same
number. PID 1 lives in the root namespace. The first PID from
ip netns pids is the sudo that started the
server.
nsenter enters a process’s namespace, even if there’s no
name for it. That’s how you look inside containers:
# on netz
sudo nsenter --net=/run/netns/rechts ip -br a
sudo nsenter -t $P -n ip routeExpected:
lo UNKNOWN 127.0.0.1/8 ::1/128
eth0@if11 UP 10.10.2.2/24 fe80::58d6:6aff:fe4a:7e54/64
default via 10.10.2.1 dev eth0
10.10.2.0/24 dev eth0 proto kernel scope link src 10.10.2.2
Save your progress? Sign up for free
Drill 7: Capturing on the cable
The host end of a veth is the perfect place for tcpdump:
everything the namespace sends or receives passes through here. A
curl from links, captured on
h-rechts:
# on netz
sudo timeout 4 tcpdump -ni h-rechts -c10 tcp port 8080 &
sleep 0.5; sudo ip netns exec links curl -s http://10.10.2.2:8080/ >/dev/null; waitExpected (shortened):
19:26:46.587202 IP 10.10.1.2.38310 > 10.10.2.2.8080: Flags [S], seq 3578900473, win 64240, options [mss 1460,sackOK,TS val 2771182357 ecr 0,nop,wscale 7], length 0
19:26:46.587363 IP 10.10.2.2.8080 > 10.10.1.2.38310: Flags [S.], seq 1983425519, ack 3578900474, win 65160, options [mss 1460,sackOK,TS val 3552570672 ecr 2771182357,nop,wscale 7], length 0
19:26:46.587472 IP 10.10.1.2.38310 > 10.10.2.2.8080: Flags [.], ack 1, win 502, options [nop,nop,TS val 2771182358 ecr 3552570672], length 0
19:26:46.587816 IP 10.10.1.2.38310 > 10.10.2.2.8080: Flags [P.], seq 1:78, ack 1, win 502, options [nop,nop,TS val 2771182358 ecr 3552570672], length 77: HTTP: GET / HTTP/1.1
19:26:46.598808 IP 10.10.2.2.8080 > 10.10.1.2.38310: Flags [P.], seq 1:186, ack 78, win 509, options [nop,nop,TS val 3552570683 ecr 2771182358], length 185: HTTP: HTTP/1.0 200 OK
19:26:46.599429 IP 10.10.2.2.8080 > 10.10.1.2.38310: Flags [F.], seq 203, ack 78, win 509, options [nop,nop,TS val 3552570684 ecr 2771182370], length 0
The first three lines are the TCP handshake (S,
S., .), then the request, the response and the
end with F (FIN). You’ll take the fields apart on Day 7.
Today, what matters: you can listen at any point in your network.
Save your progress? Sign up for free
Drill 8: What happens on deletion
rot and blau are still attached to the
cable from Drill 2. Delete blau and look in
rot:
# on netz
sudo ip netns del blau
sudo ip -n rot -br linkExpected:
lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
With the namespace, its veth end disappears, and a veth only exists
in pairs: the other end in rot is gone too.
Now the same with rechts, where the web server is still
running:
# on netz
sudo ip netns del rechts
ip netns list
ip -br link show h-rechts
sudo ip netns exec links curl -s --max-time 3 http://10.10.2.2:8080/Expected:
links (id: 2)
rot (id: 0)
h-rechts@if2 UP 26:7b:06:7b:d1:f7 <BROADCAST,MULTICAST,UP,LOWER_UP>
Hallo aus rechts
Tried it:
ip netns delonly removes the name under/run/netns. The namespace lives on as long as a process runs in it, with all interfaces and routes. It’s just invisible toip netns listnow. Only when the last process ends does the kernel clean it up:
# on netz
sudo kill $(pgrep -u ubuntu -f 'http.server 8080')
sleep 1
ip -br link show h-rechtsExpected:
Device "h-rechts" does not exist.
With containers, this is everyday life: as long as a process is
running, the network stays. A “deleted” namespace that still occupies
ports or holds addresses is a classic case for
nsenter -t <pid> -n.
Save your progress? Sign up for free
Exercise: Speed drills
- Create a namespace
s, switch onloin it, show the addresses and delete it again. Target time: 45 s - Start a web server on port 9090 in
links, find out from the outside which namespace it runs in, fetch the page from the host and stop the server. Target time: 2 min - How many veth ends are currently on the host? Target time: 15 s
Solution
# on netz
sudo ip netns add s
sudo ip -n s link set lo up
sudo ip -n s -br a
sudo ip netns del s
sudo ip netns exec links sudo -u ubuntu python3 -m http.server 9090 >/dev/null 2>&1 &
sleep 1
sudo ip netns identify $(pgrep -u ubuntu -f 'http.server 9090')
curl -s -o /dev/null -w '%{http_code}\n' http://10.10.1.2:9090/
pkill -u ubuntu -f 'http.server 9090'
ip -br link show type veth | wc -lExpected:
lo UNKNOWN 127.0.0.1/8 ::1/128
links
200
1
Only h-links remains: you deleted rechts in
Drill 8.
Save your progress? Sign up for free
Challenge
Rebuild rechts as in Drill 3, but only up to and
including lo:
# on netz
sudo ip netns add rechts
sudo ip link add h-rechts type veth peer name eth0 netns rechts
sudo ip addr add 10.10.2.1/24 dev h-rechts
sudo ip link set h-rechts up
sudo ip -n rechts addr add 10.10.2.2/24 dev eth0
sudo ip -n rechts link set eth0 up
sudo ip -n rechts link set lo up
sudo ip netns exec links ping -c2 -W1 10.10.2.2 | tail -2Expected:
2 packets transmitted, 0 received, 100% packet loss, time 1061ms
The host routes (ip_forward is still 1),
rechts is reachable (ping 10.10.2.2 from the
host works), and yet nothing comes back from links. Find
the reason with tcpdump and fix it with a single
command.
Hint: Do the requests arrive at
h-rechts? And does rechts know the way
back?
Solution
# on netz
sudo timeout 4 tcpdump -ni h-rechts -c4 icmp &
sleep 0.5; sudo ip netns exec links ping -c2 -W1 10.10.2.2 >/dev/null; wait
sudo ip netns exec rechts ip route get 10.10.1.2
sudo ip -n rechts routeExpected:
19:27:01.950930 IP 10.10.1.2 > 10.10.2.2: ICMP echo request, id 3175, seq 1, length 64
19:27:02.992855 IP 10.10.1.2 > 10.10.2.2: ICMP echo request, id 3175, seq 2, length 64
RTNETLINK answers: Network is unreachable
10.10.2.0/24 dev eth0 proto kernel scope link src 10.10.2.2
The requests arrive, but there are no replies: rechts
lost its default route during the rebuild and doesn’t know where to send
a reply to 10.10.1.2. A path that works in only one
direction is almost always a missing return route.
# on netz
sudo ip -n rechts route add default via 10.10.2.1
sudo ip netns exec links ping -c2 -W1 10.10.2.2 | tail -2Expected:
2 packets transmitted, 2 received, 0% packet loss, time 1015ms
rtt min/avg/max/mdev = 0.188/0.227/0.267/0.039 ms
Save your progress? Sign up for free
Checkpoint
With links, rechts (after the Challenge)
and the empty rot:
# on netz
ip netns listExpected:
rechts (id: 1)
links (id: 2)
rot (id: 0)
# on netz
sysctl -n net.ipv4.ip_forwardExpected: 1
# on netz
sudo ip netns exec links ping -c1 -W1 10.10.2.2 | grep -o '1 received'Expected: 1 received
# on netz
sudo ip netns exec links ping -c1 -W2 1.1.1.1 | grep -o '1 received'Expected: 1 received
# on netz
sudo nft list table ip labor | grep -c masqueradeExpected: 1
Clean-up
Day 3 builds a new network with bridges. Everything from today has to go, including the NAT rule and forwarding:
# on netz
sudo ip netns del links
sudo ip netns del rechts
sudo ip netns del rot
sudo nft delete table ip labor
sudo rm -r /etc/netns
rm -r ~/web
sudo sysctl -w net.ipv4.ip_forward=0
ip netns list | wc -l
ip -br link
sudo nft list ruleset | wc -lExpected:
net.ipv4.ip_forward = 0
0
lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
eth0 UP bc:24:11:4d:d9:08 <BROADCAST,MULTICAST,UP,LOWER_UP>
0
With the namespaces, h-links and h-rechts
disappear too: no process is running in them anymore.
Practice note
- Container networking is no magic. At its core,
docker rundoes exactly Drills 3 and 5: namespace, veth pair (the host end is calledveth…, in the containereth0), default route to the host, masquerading to the outside. Once you’ve built it by hand, you readip aon a Docker or Kubernetes node without guesswork. - Debugging from the outside.
nsenter -t <pid> -nbringsip,ssandtcpdumpinto a container’s network, even if its image contains no tools. Andtcpdumpon the host end of the veth sees everything the container sends. - One-way means return path. If requests arrive but no replies, first check the route back: missing default route, wrong gateway or missing NAT.