One of the things I have wanted to test over the years was having realistic Internet BGP data inside of a lab network. Traditionally this would entail peering with a real router in production. I have never been in an environment that would be OK with this, so I always just simulated the Internet with a couple of prefixes. This fixes that problem and allows you to run a router and get hundreds of thousands of BGP prefixes into your lab environment.

Finished Product First

This is the BGP table in my lab right now. I now have real BGP data to practice messing with all the BGP nerd knobs, without creating a resumé-generating event.

    Router#sh ip bgp sum
    BGP router identifier 192.168.4.97, local AS number 65000
    BGP table version is 6345703, main routing table version 6345703
    807176 network entries using 200179648 bytes of memory
    807176 path entries using 109775936 bytes of memory
    120947/120947 BGP path/bestpath attribute entries using 33865160 bytes of memory
    106349 BGP AS-PATH entries using 5628320 bytes of memory
    1 BGP ATTR_SET entries using 40 bytes of memory
    292 BGP community entries using 17064 bytes of memory
    13 BGP extended community entries using 432 bytes of memory
    0 BGP route-map cache entries using 0 bytes of memory
    0 BGP filter-list cache entries using 0 bytes of memory
    BGP using 349466560 total bytes of memory
    BGP activity 807176/0 prefixes, 807176/0 paths, scan interval 60 secs

    Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
    192.168.4.72    4        64999 6345738      41  6345703    0    0 00:17:08   807176
Full Internet Table - 807176 Prefixes

Architecture

This works by running a guestshell instance on a CSR1000v router and then using GoBGP to peer from the guestshell to the host router itself. The guestshell GoBGP process is injecting routing data from the RIPE RIS data project into the environment which gets advertised to the CSR1000v BGP process. Once the BGP data is available to the CSR1000v, then you have a more traditional router to then peer elsewhere in your lab network.

GoBGP peers with CSR1000v BGP process

Instructions for Use

In order to install this in your lab, follow these instructions.

Two Different Paths (not BGP paths)

In experimenting with this idea, I initially implemented this same solution, but instead of using GoBGP, I used a perl script called bgp_simple. BGP Simple does something similar by injecting synthetic prefixes into a BGP process. I found it to be a little unstable with this 800k prefixes (the entire internet), so I switched over to using GoBGP. But instead of deleting that information, I just stashed it in a different git branch in the git repo. If you want to try this instead, it is here.