Skip to content

Instantly share code, notes, and snippets.

@Shikugawa
Created December 18, 2022 09:15
Show Gist options
  • Save Shikugawa/6173cc490cdb2d58fac622cf277cf849 to your computer and use it in GitHub Desktop.
Save Shikugawa/6173cc490cdb2d58fac622cf277cf849 to your computer and use it in GitHub Desktop.
nodes:
- name: R1
image: frr-centos8:latest
docker_run_extra_args: --entrypoint bash
sysctls:
- sysctl: net.vrf.strict_mode=1
- sysctl: net.ipv4.ip_forward=1
- sysctl: net.ipv4.conf.all.rp_filter=0
- sysctl: net.ipv4.conf.default.rp_filter=0
- sysctl: net.ipv6.conf.all.forwarding=1
- sysctl: net.ipv6.conf.all.disable_ipv6=0
- sysctl: net.ipv6.conf.all.seg6_enabled=1
- sysctl: net.ipv6.conf.default.forwarding=1
- sysctl: net.ipv6.conf.default.disable_ipv6=0
- sysctl: net.ipv6.conf.default.seg6_enabled=1
interfaces:
- { name: net10, type: direct, args: R2#net10 }
- { name: net2, type: direct, args: HostA1#net0 }
- name: R2
image: frr-centos8:latest
docker_run_extra_args: --entrypoint bash
sysctls:
- sysctl: net.vrf.strict_mode=1
- sysctl: net.ipv4.ip_forward=1
- sysctl: net.ipv4.conf.all.rp_filter=0
- sysctl: net.ipv4.conf.default.rp_filter=0
- sysctl: net.ipv6.conf.all.forwarding=1
- sysctl: net.ipv6.conf.all.disable_ipv6=0
- sysctl: net.ipv6.conf.all.seg6_enabled=1
- sysctl: net.ipv6.conf.default.forwarding=1
- sysctl: net.ipv6.conf.default.disable_ipv6=0
- sysctl: net.ipv6.conf.default.seg6_enabled=1
interfaces:
- { name: net10, type: direct, args: R1#net10 }
- { name: net2, type: direct, args: HostA2#net0 }
- name: HostA1
image: nicolaka/netshoot
docker_run_extra_args: --entrypoint bash
interfaces:
- { name: net0, type: direct, args: R1#net2 }
- name: HostA2
image: nicolaka/netshoot
docker_run_extra_args: --entrypoint bash
interfaces:
- { name: net0, type: direct, args: R2#net2 }
postinit:
cmds:
- cmd: |
cat <<EOF >frr.r1.conf
segment-routing
srv6
locators
locator default
prefix 2001:db8:1:1::/64
!
!
!
!
router bgp 1
bgp router-id 1.1.1.1
no bgp default ipv4-unicast
neighbor 2001:13::2 remote-as 1
!
address-family ipv4 vpn
neighbor 2001:13::2 activate
exit-address-family
!
segment-routing srv6
locator default
!
!
router bgp 1 vrf CUST-A
bgp router-id 1.1.1.1
no bgp default ipv4-unicast
neighbor 2001:13::2 remote-as 1
!
address-family ipv4 unicast
sid vpn export auto
rd vpn export 1:100
rt vpn export 99:99
rt vpn import 99:99
import vpn
export vpn
redistribute connected
neighbor 2001:13::2 activate
exit-address-family
!
EOF
- cmd: |
cat <<EOF >frr.r2.conf
segment-routing
srv6
locators
locator default
prefix 2001:db8:1:2::/64
!
!
!
!
router bgp 1
bgp router-id 2.2.2.2
no bgp default ipv4-unicast
neighbor 2001:13::1 remote-as 1
!
address-family ipv4 vpn
neighbor 2001:13::1 activate
exit-address-family
!
segment-routing srv6
locator default
!
!
router bgp 1 vrf CUST-A
bgp router-id 2.2.2.2
no bgp default ipv4-unicast
neighbor 2001:13::1 remote-as 1
!
address-family ipv4 unicast
sid vpn export auto
rd vpn export 1:100
rt vpn export 99:99
rt vpn import 99:99
import vpn
export vpn
redistribute connected
neighbor 2001:13::1 activate
exit-address-family
!
EOF
- cmd: docker cp frr.r1.conf R1:/etc/frr/frr.conf
- cmd: docker cp frr.r2.conf R2:/etc/frr/frr.conf
node_configs:
- name: R1
cmds:
- cmd: ip addr add 2001:13::1/64 dev net10
- cmd: ip addr add 192.168.0.1/24 dev net2
- cmd: ip link add CUST-A type vrf table 10
- cmd: ip link set CUST-A up
- cmd: ip link set net2 vrf CUST-A
# - cmd: ip route add fc00:2::/64 via 2001:13::2 dev net10
# - cmd: ip route add fc00:1::10/128 encap seg6local action End.DT4 vrftable 10 dev CUST-A
# - cmd: ip route add 192.168.1.0/24 vrf CUST-A nexthop encap seg6 mode encap segs fc00:2::10 dev net10
- cmd: sed -i -e 's/bgpd=no/bgpd=yes/g' /etc/frr/daemons
- cmd: /usr/lib/frr/frrinit.sh start
- name: R2
cmds:
- cmd: ip addr add 2001:13::2/64 dev net10
- cmd: ip addr add 192.168.1.1/24 dev net2
- cmd: ip link add CUST-A type vrf table 10
- cmd: ip link set CUST-A up
- cmd: ip link set net2 vrf CUST-A
# - cmd: ip route add fc00:1::10 via 2001:13::1 dev net10
# - cmd: ip route add fc00:2::10/128 encap seg6local action End.DT4 vrftable 10 dev CUST-A
# - cmd: ip route add 192.168.0.0/24 vrf CUST-A nexthop encap seg6 mode encap segs fc00:1::10 dev net10
- cmd: sed -i -e 's/bgpd=no/bgpd=yes/g' /etc/frr/daemons
- cmd: /usr/lib/frr/frrinit.sh start
- name: HostA1
cmds:
- cmd: ip addr add 192.168.0.2/24 dev net0
- cmd: ip route add default via 192.168.0.1
- name: HostA2
cmds:
- cmd: ip addr add 192.168.1.2/24 dev net0
- cmd: ip route add default via 192.168.1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment