====== Cheatsheet for ip netns ====== /sbin/ip netns del ns-downloads /sbin/ip netns add ns-downloads /sbin/ip link add v-down-root type veth peer name v-down-peer /sbin/ip link set v-down-peer netns ns-downloads /sbin/brctl addif br-lan v-down-root /sbin/ip link set v-down-root up /sbin/ip netns exec ns-downloads /sbin/ip addr add 10.0.0.34/16 dev v-down-peer /sbin/ip netns exec ns-downloads /sbin/ip link set v-down-peer up /sbin/ip netns exec ns-downloads /sbin/ip link set lo up /sbin/ip netns exec ns-downloads /sbin/ip route add default via 10.0.0.1 root@misaka:~# /sbin/ip netns exec ns-downloads ifconfig lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 v-down-peer: flags=4163 mtu 1500 inet 10.0.0.34 netmask 255.255.0.0 broadcast 0.0.0.0 inet6 fe80::6cb8:4aff:fe27:b3b0 prefixlen 64 scopeid 0x20 ether 6e:b8:4a:27:b3:b0 txqueuelen 1000 (Ethernet) RX packets 1168 bytes 363742 (355.2 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 363 bytes 148875 (145.3 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 /sbin/ip netns del ns-downloads ===== See Alsos ===== - https://blogs.igalia.com/dpino/2016/04/10/network-namespaces/ - https://wiki.archlinux.org/index.php/Network_bridge - https://github.com/systemd/systemd/issues/2741 - https://github.com/Jamesits/systemd-named-netns {{tag>ip netns cheatsheet}}