The veth pair and network namespaces
cheat sheet · Ubuntu 24.04 · iproute2 https://lab.dimsanych.ru/en/wiki/veth/Cheat sheet
-
sudo ip netns add lab-clienta new namespace -
ip netns listwhich namespaces exist -
sudo ip link add lab1 type veth peer lab0a veth pair: lab1 <-> lab0 -
sudo ip link set lab0 netns lab-clientone end into the namespace -
sudo ip -n lab-client address add 192.0.3.10/24 dev lab0 -
sudo ip -n lab-client link set lab0 upip inside the namespace -
sudo ip netns exec lab-client ping -c 2 192.0.2.1any program there -
sudo ip -n lab-client -br linkthe namespace's interfaces -
sudo ip netns delete lab-clientdelete with its end