Skip to content

Instantly share code, notes, and snippets.

@proelbtn
Created January 7, 2022 12:16
Show Gist options
  • Save proelbtn/1860e2719d2acd63ad3300fecdbe5c78 to your computer and use it in GitHub Desktop.
Save proelbtn/1860e2719d2acd63ad3300fecdbe5c78 to your computer and use it in GitHub Desktop.
nodes:
- name: R1
image: nicolaka/netshoot
interfaces:
- { name: net0, type: direct, args: R2#net0 }
- { name: net1, type: direct, args: C11#net0 }
- { name: net2, type: direct, args: C21#net0 }
- name: R2
image: nicolaka/netshoot
interfaces:
- { name: net0, type: direct, args: R1#net0 }
- { name: net1, type: direct, args: C12#net0 }
- { name: net2, type: direct, args: C22#net0 }
- name: C11
image: nicolaka/netshoot
interfaces: [ { name: net0, type: direct, args: R1#net1 } ]
- name: C12
image: nicolaka/netshoot
interfaces: [ { name: net0, type: direct, args: R2#net1 } ]
- name: C21
image: nicolaka/netshoot
interfaces: [ { name: net0, type: direct, args: R1#net2 } ]
- name: C22
image: nicolaka/netshoot
interfaces: [ { name: net0, type: direct, args: R2#net2 } ]
node_configs:
- name: R1
cmds:
- cmd: ip link add name vrf1 type vrf table 1001
- cmd: ip link add name vrf2 type vrf table 1002
- cmd: ip link set vrf1 up
- cmd: ip link set vrf2 up
- cmd: ip link set net1 vrf vrf1
- cmd: ip link set net2 vrf vrf2
- cmd: sysctl net.vrf.strict_mode=1
- cmd: sysctl net.ipv4.conf.all.forwarding=1
- cmd: sysctl net.ipv4.conf.all.rp_filter=0
- cmd: sysctl net.ipv6.conf.all.disable_ipv6=0
- cmd: sysctl net.ipv6.conf.all.forwarding=1
- cmd: sysctl net.ipv6.conf.all.seg6_enabled=1
- cmd: ip addr add fd00::1/64 dev net0
- cmd: ip route add fd00:2::/64 via fd00::2
- cmd: ip addr add 10.0.1.254/24 dev net1
- cmd: ip addr add 10.0.1.254/24 dev net2
- cmd: ip sr tunsrc set fd00::1
- cmd: ip route add fd00:1::1 encap seg6local action End.DT4 vrftable 1001 dev vrf1
- cmd: ip route add fd00:1::2 encap seg6local action End.DT4 vrftable 1002 dev vrf2
- cmd: ip route add vrf vrf1 10.0.2.0/24 encap seg6 mode encap segs fd00:2::1 dev vrf1
- cmd: ip route add vrf vrf2 10.0.2.0/24 encap seg6 mode encap segs fd00:2::2 dev vrf2
- name: R2
cmds:
- cmd: ip link add name vrf1 type vrf table 1001
- cmd: ip link add name vrf2 type vrf table 1002
- cmd: ip link set vrf1 up
- cmd: ip link set vrf2 up
- cmd: ip link set net1 vrf vrf1
- cmd: ip link set net2 vrf vrf2
- cmd: sysctl net.vrf.strict_mode=1
- cmd: sysctl net.ipv4.conf.all.forwarding=1
- cmd: sysctl net.ipv4.conf.all.rp_filter=0
- cmd: sysctl net.ipv6.conf.all.disable_ipv6=0
- cmd: sysctl net.ipv6.conf.all.forwarding=1
- cmd: sysctl net.ipv6.conf.all.seg6_enabled=1
- cmd: ip addr add fd00::2/64 dev net0
- cmd: ip route add fd00:1::/64 via fd00::1
- cmd: ip addr add 10.0.2.254/24 dev net1
- cmd: ip addr add 10.0.2.254/24 dev net2
- cmd: ip sr tunsrc set fd00::2
- cmd: ip route add fd00:2::1 encap seg6local action End.DT4 vrftable 1001 dev vrf1
- cmd: ip route add fd00:2::2 encap seg6local action End.DT4 vrftable 1002 dev vrf2
- cmd: ip route add vrf vrf1 10.0.1.0/24 encap seg6 mode encap segs fd00:1::1 dev vrf1
- cmd: ip route add vrf vrf2 10.0.1.0/24 encap seg6 mode encap segs fd00:1::2 dev vrf2
- name: C11
cmds:
- cmd: ip addr add 10.0.1.1/24 dev net0
- cmd: ip route add 10.0.2.0/24 via 10.0.1.254
- name: C12
cmds:
- cmd: ip addr add 10.0.2.1/24 dev net0
- cmd: ip route add 10.0.1.0/24 via 10.0.2.254
- name: C21
cmds:
- cmd: ip addr add 10.0.1.1/24 dev net0
- cmd: ip route add 10.0.2.0/24 via 10.0.1.254
- name: C22
cmds:
- cmd: ip addr add 10.0.2.1/24 dev net0
- cmd: ip route add 10.0.1.0/24 via 10.0.2.254
test:
- name: connectivity test
cmds:
- cmd: docker exec C11 ping -i 0.1 -c 3 10.0.2.1
- cmd: docker exec C12 ping -i 0.1 -c 3 10.0.1.1
- cmd: docker exec C21 ping -i 0.1 -c 3 10.0.2.1
- cmd: docker exec C22 ping -i 0.1 -c 3 10.0.1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment