Explore Configurations of Unfamiliar Devices with netlab
Apart from IP multicast and QoS, netlab can configure commonly used networking technologies across dozens of devices from most networking vendors. Why don’t you use all that embedded knowledge (supported by hundreds of integration tests) to help you configure unfamiliar devices?
You don’t have to install VM or container managers (Vagrant/containerlab), or beg vendors to give you access to device VMs/containers, to get working device configurations. All you need is a Python package that works on Windows1, macOS, or Linux.
It’s as simple as this:
- Install networklab Python package. As we’re dealing with a one-off test, use a virtual environment:
$ python3 -m venv nlt
$ source ./nlt/bin/activate
$ pip3 install networklab
If you feel adventurous and don’t mind running a script downloaded from a random website through sh, use the phenomenal uvx.sh service to install netlab (visit uvx.sh to find out the corresponding Windows command):
$ curl -LsSf uvx.sh/networklab/install.sh | sh
Compared to what we had to deal with, UVX is condensed PFM.
-
Even better, open the netlab-examples repository as a GitHub Codespace.
-
Find the most appropriate lab topology in netlab examples, integration tests, BGP labs, IS-IS labs, or EVPN/VXLAN labs2. You could also try to cajole your AI buddy into creating a working netlab topology3.
-
Copy the topology URL
-
Find the netlab device name in the supported platforms table
-
Download the topology and create all the configuration files with netlab create -d device -o config url. If you want to use a device that’s only available as a container (Cisco IOL, SR Linux), add -p clab option.
For example, use the following command to create EVPN/VXLAN bridging configuration for a Cisco IOS/XE router (IOL):
$ netlab create -d iol -p clab -o config https://github.com/bgplab/evpn/blob/main/evpn/1-bridging/solution.yml
- Treat the downloaded lab topology as a scratchpad and adjust it to your needs.
- Some topologies have hard-coded devices. Edit them and remove all mentions of device attributes
- Integration tests often include validation part or extra plugins that help make tests work (with warnings) across semi-supported devices. Edit that out.
- Retry as often as needed ;), replacing the URL with downloaded.yml (the name of the downloaded topology file).
- Explore the
node_filesdirectory. It has a separate subdirectory for each node in the lab topology; each subdirectory contains a file for every configuration module (technology) used on the node. For example, these are the files we’d get for the S1 switch running Cisco IOL:
$ ls node_files/s1
bgp evpn ifstate initial ospf vlan vxlan
Here’s a sample Cisco IOL VLAN and VXLAN configuration:
!
bridge-domain 100
member Ethernet0/2 service-instance 100
!
interface Ethernet0/2
service instance 100 ethernet
encapsulation untagged
interface nve1
no shutdown
source-interface Loopback0
host-reachability protocol bgp
member vni 100100 ingress-replication
And here’s the EVPN part (it has an extra route-map that is used only on EBGP sessions):
!
bridge-domain 100
member evpn-instance 100 vni 100100
!
l2vpn evpn instance 100 vlan-based
encapsulation vxlan
replication-type ingress
rd 10.0.0.1:100
route-target import 65000:100
route-target export 65000:100
!
route-map evpn_nh_unchanged permit 10
set ip next-hop unchanged
!
router bgp 65000
address-family l2vpn evpn
neighbor 10.0.0.2 activate
neighbor 10.0.0.2 send-community both
Obviously, you could also ask your favorite AI buddy to create the device configs directly ;)
-
I know of people using netlab on Windows Subsystem for Linux. As we’ll be using only Python functionality, everything should also work on Windows. ↩︎
-
Some labs include
solution.ymltopology. ↩︎ -
It works better if you include pointers to https://netlab.tools/ and https://github.com/ipspace/netlab-examples in the prompt. ↩︎