That’s a Heavy Load – Generating Routes with Routem

Standard

Have you ever wanted your lab to have a bunch of routes because the more the merrier – but don’t feel like making a bunch Loopback networks and also don’t want to write a TCL script etc to make them for you because being lazy is awesome?  Well now you can use routem in your VIRL lab to do all the heavy lifting for you.

This entry will go over playing around with VIRL’s “lxc-routem” node to do some control plane level route generation.

First things first, in VIRL make a new topology. Because my VIRL install isn’t local I set my Management network to be “Shared flat network” if you don’t do this the routem node will use the internal range for the management interface.

routem-001

In the design tab connect a lxc-routem and a router together, it doesn’t really matter which router image you use since routem is the star of the show today. I personally like to rename the nodes so I made the names a bit more concise and UPPERCASE.

routem-002routem-003

Next press the “Build initial configurations” button to generate the lxc initial config.
routem-004

By default it will put the ROUTEM1 node in a /30 network with the highlighted ifconfig command. For the purposes of this lab lets change the statement to be the following:

#!/bin/sh
 ifconfig eth1:0 up 192.168.11.100 netmask 255.255.255.0
 ifconfig eth1:1 up 192.168.11.101 netmask 255.255.255.0
 ifconfig eth1:2 up 192.168.11.102 netmask 255.255.255.0
 ifconfig eth1:3 up 192.168.11.103 netmask 255.255.255.0

routem-006If your not overly familiar with Linux, we are adding 4 IPs in the 192.168.11.0/24 subnet to the Eth1 interface.

For the router you can either re-ip the interface when you connect to the device or change the config like so.

routem-005

routem-007

With the prep work done let’s fire it up and start the nodes.

routem-008

Log into the ROUTEM1 server with cisco/cisco and verify the IP addresses are what we expect. There will still be a /30 on the main eth1 interface but it isn’t hurting anybody 🙂

cisco@ROUTEM1$ ip addr show eth1 
824: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
 link/ether 3a:ea:7c:6b:16:a5 brd ff:ff:ff:ff:ff:ff
 inet 10.0.0.6/30 brd 10.0.0.7 scope global eth1
 valid_lft forever preferred_lft forever
 inet 192.168.11.100/24 brd 192.168.11.255 scope global eth1:0
 valid_lft forever preferred_lft forever
 inet 192.168.11.101/24 brd 192.168.11.255 scope global secondary eth1:1
 valid_lft forever preferred_lft forever
 inet 192.168.11.102/24 brd 192.168.11.255 scope global secondary eth1:2
 valid_lft forever preferred_lft forever
 inet 192.168.11.103/24 brd 192.168.11.255 scope global secondary eth1:3
 valid_lft forever preferred_lft forever

So we now have a fancy server! But how do we use it? Fortunately VIRL included configuration examples in the VIRL UWM admin page.

routem-009

There are quite a few different options here but lets go with BGP -> v4 Unicast to get things started. Under the examples they provide config snippets for Cisco routers and routem.

routem-010

Copy the routem config to a notepad and make the changes you need for your particular lab.

  • The update-source is mandatory and should point to one of the IPs on the server, if you don’t use it you’ll get a error message on the Cisco side, you can have as many BGP instances as you want.
  • The number after the network command is how many networks to generate.
  • The aspath controls how many AS numbers to use, you can either statically enter in the AS numbers you want in the path or you can use the random keyword to randomly generate number of ASNs.

routem-011.png

Next create a bgp.txt using vi or nano paste in the config and and save the file. Of course you can name the file to be whatever makes sense to you.

cisco@ROUTEM1$ vi bgp.txt
#routem config
router bgp 1001
neighbor 192.168.11.1 remote-as 1
neighbor 192.168.11.1 update-source 192.168.11.101
network 1 1.1.1.0/24 5
metric 1 5
network 2 2.2.2.0/24 10
metric 2 8
locpref 2 120
sendall
#
router bgp 1002
neighbor 192.168.11.1 remote-as 1
neighbor 192.168.11.1 update-source 192.168.11.102
network 1 3.3.3.0/24 1000
aspath 1 random 5
network 2 4.4.4.0/24 500
aspath 1 random 3
nlricount 1
redoattr 1
sendall

Finally we start the instance with routem -f bgp.txt

cisco@ROUTEM1$ routem -f bgp.txt 
Version 2.1(8)(routem_august21.2015) by khphan on Fri Aug 21 15:52:13 PDT 2015
Copyright (c) 1998-1999, 2002-2003, 2007-2009, 2014 by cisco Systems, Inc.
All rights reserved.
ROUTEM:start reading config file :Fri Feb 5 20:57:57 2016
(bgp:2 bmp:0 ospf:0 isis:0 bfd:0 tcp:0 msdp:0 traff:0)
ROUTEM:finish reading config file :Fri Feb 5 20:57:57 2016

Now on the router side we configure BGP (first change the IP address if you didn’t do the autonetconfig)

R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.11.101 remote 1001
R1(config-router)#neighbor 192.168.11.102 remote 1002
R1(config-router)#
*Feb 5 20:59:27.725: %BGP-5-ADJCHANGE: neighbor 192.168.11.101 Up 
*Feb 5 20:59:28.441: %BGP-5-ADJCHANGE: neighbor 192.168.11.102 Up

And we now have quite a few BGP routes! ROUTEM is a powerful tool for study that supports quite a few protocols to play with including RIP, OSPF, ISIS, and more!

R1(config-router)#do sh bgp ipv4 uni sum | be Neighbor
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.11.101 4 1001 11 1011 1516 0 0 00:06:44 15
192.168.11.102 4 1002 1509 1013 1516 0 0 00:06:44 1500
R1(config-router)# do sh bgp ipv4 unicast 
BGP table version is 1516, local router ID is 150.1.0.1
 Network Next Hop Metric LocPrf Weight Path
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
 r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
 x best-external, a additional-path, c RIB-compressed, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
 *> 1.1.1.0/24 192.168.11.101 5 0 1001 i
 *> 1.1.2.0/24 192.168.11.101 5 0 1001 i
 *> 1.1.3.0/24 192.168.11.101 5 0 1001 i
 *> 1.1.4.0/24 192.168.11.101 5 0 1001 i
 *> 1.1.5.0/24 192.168.11.101 5 0 1001 i
 *> 2.2.2.0/24 192.168.11.101 8 0 1001 i
 *> 2.2.3.0/24 192.168.11.101 8 0 1001 i
 *> 2.2.4.0/24 192.168.11.101 8 0 1001 i
 *> 2.2.5.0/24 192.168.11.101 8 0 1001 i
 *> 2.2.6.0/24 192.168.11.101 8 0 1001 i
 *> 2.2.7.0/24 192.168.11.101 8 0 1001 i
 *> 2.2.8.0/24 192.168.11.101 8 0 1001 i
 *> 2.2.9.0/24 192.168.11.101 8 0 1001 i
 *> 2.2.10.0/24 192.168.11.101 8 0 1001 i
 *> 2.2.11.0/24 192.168.11.101 8 0 1001 i
 Network Next Hop Metric LocPrf Weight Path
 *> 3.3.3.0/24 192.168.11.102 0 1002 25846 51320 i
 *> 3.3.4.0/24 192.168.11.102 0 1002 59744 12947 i
 *> 3.3.5.0/24 192.168.11.102 0 1002 50346 i
 *> 3.3.6.0/24 192.168.11.102 0 1002 36304 i
 *> 3.3.7.0/24 192.168.11.102 0 1002 41213 i
 *> 3.3.8.0/24 192.168.11.102 0 1002 33646 i
 *> 3.3.9.0/24 192.168.11.102 0 1002 60042 41661 i
 *> 3.3.10.0/24 192.168.11.102 0 1002 9280 39778 i
 *> 3.3.11.0/24 192.168.11.102 0 1002 15918 i
 *> 3.3.12.0/24 192.168.11.102 0 1002 52701 i
 *> 3.3.13.0/24 192.168.11.102 0 1002 26276 i
 *> 3.3.14.0/24 192.168.11.102 0 1002 7131 i
 *> 3.3.15.0/24 192.168.11.102 0 1002 14304 33615 i
 *> 3.3.16.0/24 192.168.11.102 0 1002 40149 19401 i
 *> 3.3.17.0/24 192.168.11.102 0 1002 34359 32347 i
 *> 3.3.18.0/24 192.168.11.102 0 1002 19170 50551 i
 --More--

BTW if you want to have VIRL create the ROUTEM config file for you can append the configuration like so:

 #!/bin/sh
 ifconfig eth1:0 up 192.168.11.100 netmask 255.255.255.0
 ifconfig eth1:1 up 192.168.11.101 netmask 255.255.255.0
 ifconfig eth1:2 up 192.168.11.102 netmask 255.255.255.0
 ifconfig eth1:3 up 192.168.11.103 netmask 255.255.255.0
 exit 0
- path: /home/cisco/config.txt
 owner: cisco:cisco
 permissions: '0777'
 content: |
 
 #routem config
 router bgp 1001
 neighbor 192.168.11.1 remote-as 1
 neighbor 192.168.11.1 update-source 192.168.11.101
 network 1 1.1.1.0/24 5
 metric 1 5
 network 2 2.2.2.0/24 10
 metric 2 8
 locpref 2 120
 sendall
 #
 router bgp 1002
 neighbor 192.168.11.1 remote-as 1
 neighbor 192.168.11.1 update-source 192.168.11.102
 network 1 3.3.3.0/24 1000
 aspath 1 random 5
 network 2 4.4.4.0/24 500
 aspath 1 random 3
 nlricount 1
 redoattr 1
 sendall

This will create a file called config.txt with in your home directory.

Note: You need a white space at the beginning of each line of the routem config.

3 thoughts on “That’s a Heavy Load – Generating Routes with Routem

  1. Do you know if this does OSPFv3 route generation at all? I am looking at testing convergence of OSPF v3 and need to flood the LSDB and get the RIB as populated as possible to test convergence

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.