Created
August 26, 2021 08:16
-
-
Save cathay4t/abea4d5229cee2248472c0bbf9451c96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ip link add blue type vrf table 10 | |
ip link add red type vrf table 20 | |
ip netns add ns_pod1 | |
ip netns add ns_pod2 | |
ip link add veth_pod1 type veth peer net1 | |
ip link add veth_pod2 type veth peer net2 | |
ip link set veth_pod1 netns ns_pod1 | |
ip netns exec ns_pod1 ip link set veth_pod1 up | |
ip link set net1 up | |
ip link set veth_pod2 netns ns_pod2 | |
ip netns exec ns_pod2 ip link set veth_pod2 up | |
ip link set net2 up | |
ip link set net1 master blue | |
ip link set net2 master red | |
ip link set blue up | |
ip link set red up | |
ip netns exec ns_pod1 ip addr add 2001:100::2/64 dev veth_pod1 | |
ip netns exec ns_pod2 ip addr add 2001:100::4/64 dev veth_pod2 | |
ip addr add 2001:100::1/64 dev net1 | |
ip addr add 2001:100::3/64 dev net2 | |
ping 2001:100::2 -I blue -c 1 | |
ping 2001:100::4 -I red -c 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment