Skip to content

Instantly share code, notes, and snippets.

@staybuzz
Last active April 19, 2021 14:03
Show Gist options
  • Save staybuzz/bb9d97f8a903f1988ccfd585ed4d88af to your computer and use it in GitHub Desktop.
Save staybuzz/bb9d97f8a903f1988ccfd585ed4d88af to your computer and use it in GitHub Desktop.
#/!bin/bash
sudo ip l add veth1 type veth peer name veth2
sudo ip netns add host01
sudo ip netns add host02
sudo ip l set veth1 netns host01
sudo ip l set veth2 netns host02
sudo ip netns exec host01 ip l set up dev veth1
sudo ip netns exec host01 ip a add 10.0.0.1/24 dev veth1
sudo ip netns exec host02 ip l set up dev veth2
sudo ip netns exec host02 ip a add 10.0.0.2/24 dev veth2
sudo ip netns exec host01 ip a
sudo ip netns exec host02 ip a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment