Example: Multi-AS netlab Topology
A few weeks ago, Urs Baumann posted a nice example illustrating the power of netlab: a 10-router topology running OSPF, IS-IS, and BGP:
He didn’t post the underlying topology file, so let’s create a simple topology to build something similar.
defaults.device: frr
provider: clab
- We’ll use FRRouting-based routers (line 1) because we want to be able to run this thing in GitHub Codespaces.
- We’ll have to run them in containers (line 2).
groups:
_auto_create: True
c_65000:
module: [ bgp ]
members: [ r01 ]
bgp.as: 65000
p_65100:
module: [ ospf, bgp ]
members: [ r02, r03, r04, r05 ]
bgp.as: 65100
p_65200:
module: [ isis, bgp ]
members: [ r06, r07, r08, r09 ]
bgp.as: 65200
c_65002:
module: [ bgp ]
members: [ r10 ]
bgp.as: 65002
The easiest way to create a large number of similar nodes is to use node groups:
- Group members will be created automatically (line 5)
- The first group (left customer) has a single member running BGP in BGP AS 65000 (line 6-9).
- The second group defines the left provider (lines 10-13). It has four members running OSPF and BGP in AS 651000.
- The rest of the above defines the right provider (lines 14-17) and the right customer (18-21)
We also need links between routers. Yet again, we’ll use link groups to create them:
links:
- group: p_65100
prefix.ipv4: True
members: [
r02-r03, r02-r03, r02-r04, r02-r04,
r03-r05, r03-r05, r04-r05, r04-r05 ]
- group: p_65200
prefix.ipv4: True
members: [
r06-r07, r06-r08, r07-r09, r08-r09 ]
- group: interas
members: [
r01-r02, r01-r03,
r04-r06, r05-r07,
r08-r10, r09-r10 ]
- The first group defines unnumbered IPv4 links within AS 65100 (lines 24-28). The member list is pretty long, as Urs wanted to have two parallel links between pairs of routers (and I love how one could write lists in YAML ;)
- The second group defines unnumbered IPv4 links within AS 65200 (lines 29-32). This group has only four members.
- The final group (lines 33-37) defines all links between autonomous systems.
That’s it. Save the file as topology.yml
and execute netlab up
. Don’t want to invest time into building your own netlab infrastructure? Use GitHub Codespaces:
- Start a new GitHub Codespace
- Change directory to
routing/multi-as
- Execute netlab up and wait a bit
- Wait for another 30 seconds to get the routing protocols up and running.
- Connect to r01 with netlab connect r01 and execute a traceroute:
r01(bash)#traceroute -s 10.0.0.1 r10
traceroute to r10 (10.0.0.10) from 10.0.0.1, 30 hops max, 46 byte packets
1 eth5.r02 (10.1.0.2) 0.003 ms 0.001 ms 0.001 ms
2 r04 (10.0.0.4) 0.001 ms 0.001 ms 0.001 ms
3 eth3.r06 (10.1.0.10) 0.001 ms 0.001 ms 0.001 ms
4 r08 (10.0.0.8) 0.000 ms 0.000 ms 0.001 ms
5 r10 (10.0.0.10) 0.001 ms 0.000 ms 0.001 ms
Not only did netlab create a running network for you, but it also set up reverse DNS mappings to display the (numbered) interfaces your traceroute probes are traversing.