Skip to content

Instantly share code, notes, and snippets.

@rwestphal
Last active February 5, 2019 02:53
Show Gist options
  • Save rwestphal/1f21d83324bed58c29c0e15167814fcf to your computer and use it in GitHub Desktop.
Save rwestphal/1f21d83324bed58c29c0e15167814fcf to your computer and use it in GitHub Desktop.
# +---------+ +---------+
# | | | |
# | CE1 | | CE2 |
# | | | |
# +---------+ +---------+
# ce1-eth0|(.10)(.20) (.10)(.20)|ce2-eth0
# | |
# |2001:db8:1::/64 2001:db8:2::/64|
# | |
# rt1-eth0| |rt3-eth0
# +---------+ +---------+ +---------+
# | | | | | |
# | RT1 |rt1-eth1 rt2-eth0| RT2 |rt2-eth1 rt3-eth1| RT3 |
# | 4000::1 +-------------------+ +-------------------+ 4000::3 |
# | 5000::1 | 3000:1::/64 | | 3000:2::/64 | 5000::3 |
# +---------+ +---------+ +---------+
# rt1-eth2| |====================tun-pref=====================| |rt3-eth2
# | | | |
# | +====================tun-npref====================| |
# | |
# | +---------+ |
# | | | |
# | 3000:3::/64 | RT4 | 3000:4::/64 |
# +------------------------+ +------------------------+
# rt4-eth0| |rt4-eth1
# +---------+
---
routers:
ce1:
links:
ce1-eth0:
peer: [rt1, rt1-eth0]
frr:
zebra:
config: |
interface ce1-eth0
ipv6 address 2001:db8:1::10/64
ipv6 address 2001:db8:1::20/64
!
staticd:
delay: 1
config: |
ipv6 route ::/0 2001:db8:1::1
ce2:
links:
ce2-eth0:
peer: [rt3, rt3-eth0]
frr:
zebra:
config: |
interface ce2-eth0
ipv6 address 2001:db8:2::10/64
ipv6 address 2001:db8:2::20/64
!
staticd:
delay: 1
config: |
ipv6 route ::/0 2001:db8:2::3
rt1:
links:
rt1-lo1:
rt1-eth0:
peer: [ce1, ce1-eth0]
rt1-eth1:
peer: [rt2, rt2-eth0]
rt1-eth2:
peer: [rt4, rt4-eth0]
shell: |
# Tunnel for preferred packets (PPR)
ip -6 tunnel add tun-pref mode ip6ip6 remote 4000::3 local 4000::1
ip link set dev tun-pref up
# Tunnel for non-preferred packets (no PPR)
ip -6 tunnel add tun-npref mode ip6ip6 remote 5000::3 local 5000::1
ip link set dev tun-npref up
# These addresses can be removed as soon as pbrd supports onlink interface nexthops
ip -6 address add 8000::1/64 dev tun-pref
ip -6 address add 9000::1/64 dev tun-npref
frr:
zebra:
config: |
interface rt1-lo1
ipv6 address 4000::1/128
ipv6 address 5000::1/128
no link-detect
!
interface rt1-eth0
ipv6 address 2001:db8:1::1/64
no link-detect
!
interface rt1-eth1
ipv6 address 3000:1::1/64
no link-detect
!
interface rt1-eth2
ipv6 address 3000:3::1/64
no link-detect
!
pbrd:
config: |
pbr table range 10000 20000
!
nexthop-group NG-pref
nexthop 8000::2 tun-pref
!
nexthop-group NG-npref
nexthop 9000::2 tun-npref
!
pbr-map PPR-POLICY seq 10
match src-ip 2001:db8:1::10/128
match dst-ip 2001:db8:2::10/128
set nexthop-group NG-pref
!
pbr-map PPR-POLICY seq 20
match src-ip ::/0
set nexthop-group NG-npref
!
interface rt1-eth0
pbr-policy PPR-POLICY
!
isisd:
config: |
interface rt1-lo1
ipv6 router isis 1
!
interface rt1-eth1
ipv6 router isis 1
isis hello-interval 3
!
interface rt1-eth2
ipv6 router isis 1
isis hello-interval 3
!
router isis 1
net 47.0023.0000.0000.0000.0000.0000.0000.1900.0001.00
is-type level-1
!
rt2:
links:
rt2-eth0:
peer: [rt1, rt1-eth1]
rt2-eth1:
peer: [rt3, rt3-eth1]
frr:
zebra:
config: |
interface rt2-eth0
ipv6 address 3000:1::2/64
no link-detect
!
interface rt2-eth1
ipv6 address 3000:2::2/64
no link-detect
!
isisd:
config: |
interface rt2-eth0
ipv6 router isis 1
isis hello-interval 3
!
interface rt2-eth1
ipv6 router isis 1
isis hello-interval 3
!
router isis 1
net 47.0023.0000.0000.0000.0000.0000.0000.1900.0002.00
is-type level-1
!
rt3:
links:
rt3-lo1:
rt3-eth0:
peer: [ce2, ce2-eth0]
rt3-eth1:
peer: [rt2, rt2-eth1]
rt3-eth2:
peer: [rt4, rt4-eth1]
shell: |
# Tunnel for preferred packets (PPR)
ip -6 tunnel add tun-pref mode ip6ip6 remote 4000::1 local 4000::3
ip link set dev tun-pref up
# Tunnel for non-preferred packets (no PPR)
ip -6 tunnel add tun-npref mode ip6ip6 remote 5000::1 local 5000::3
ip link set dev tun-npref up
# These addresses can be removed as soon as pbrd supports onlink interface nexthops
ip -6 address add 8000::2/64 dev tun-pref
ip -6 address add 9000::2/64 dev tun-npref
frr:
zebra:
config: |
interface rt3-lo1
ipv6 address 4000::3/128
ipv6 address 5000::3/128
no link-detect
!
interface rt3-eth0
ipv6 address 2001:db8:2::3/64
no link-detect
!
interface rt3-eth1
ipv6 address 3000:2::3/64
no link-detect
!
interface rt3-eth2
ipv6 address 3000:4::3/64
no link-detect
!
pbrd:
config: |
pbr table range 10000 20000
!
nexthop-group NG-pref
nexthop 8000::1 tun-pref
!
nexthop-group NG-npref
nexthop 9000::1 tun-npref
!
pbr-map PPR-POLICY seq 10
match src-ip 2001:db8:2::10/128
match dst-ip 2001:db8:1::10/128
set nexthop-group NG-pref
!
pbr-map PPR-POLICY seq 20
match src-ip ::/0
set nexthop-group NG-npref
!
interface rt3-eth0
pbr-policy PPR-POLICY
!
isisd:
config: |
interface rt3-lo1
ipv6 router isis 1
!
interface rt3-eth1
ipv6 router isis 1
isis hello-interval 3
!
interface rt3-eth2
ipv6 router isis 1
isis hello-interval 3
!
router isis 1
net 47.0023.0000.0000.0000.0000.0000.0000.1900.0003.00
is-type level-1
!
rt4:
links:
rt4-eth0:
peer: [rt1, rt1-eth2]
rt4-eth1:
peer: [rt3, rt3-eth2]
frr:
zebra:
config: |
interface rt4-eth0
ipv6 address 3000:3::4/64
no link-detect
!
interface rt4-eth1
ipv6 address 3000:4::4/64
no link-detect
!
isisd:
config: |
interface rt4-lo1
ipv6 router isis 1
!
interface rt4-eth0
ipv6 router isis 1
isis hello-interval 3
isis metric 100
!
interface rt4-eth1
ipv6 router isis 1
isis hello-interval 3
isis metric 100
!
router isis 1
net 47.0023.0000.0000.0000.0000.0000.0000.1900.0004.00
is-type level-1
!
switches:
frr:
base-configs:
all: |
hostname %(node)-%(daemon)
password 1
log file %(logdir)/%(node)-%(daemon).log
log commands
zebra: |
!debug zebra kernel
!debug zebra rib detailed
debug zebra rib
debug zebra packet
pbrd: |
debug pbr map
debug pbr zebra
debug pbr nht
debug pbr events
isisd: |
debug isis zebra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment