[j-nsp] How to load a lot of prefixes

Erdem Sener erdems at gmail.com
Wed Feb 20 16:59:03 EST 2008


Hey wang,

 Assuming you're asking for a way to import set routing-options static
route ... commands
from a juniper router that has full table, here's something you can do
(although it's probably
not the most 'elegant' way)

router> show route protocol bgp terse | match \* |save bgp-routes
router> start shell
% cat bgp-routes | awk '{print $2}' > routeslist        ====>

that would give you a text file with one prefix on each line, something like:
1.1.1/24
2.2.2/24

once you have this list, it's a matter of reformatting with the
appropriate commands. a simple
shell script would do:

#!/bin/sh
for i in `cat routes`
do
echo "set routing-options static route $i" >> cmd-set
done

then you just go back to cli and do a load set and commit, such as:

user at router# load set cmd-set

This would be one of the best options while loading a huge amount of
configuration since you're not
relying on any remote connection.

HTH
Erdem


On Feb 20, 2008 6:03 PM, wang dong bei <wang.dong.bei at gmail.com> wrote:
> Hi talented minds,
>
> I want to do some testing with BGP and I need to inject a lots of routes,
> preferably the entire Internet routing table, into some of the routers of an
> isolated lab. My initial approach is to capture the "show route bgp" output
> from one of my routers and massage the data into the "set routing-options
> static prefix....." and load everything into my testing routers. However,
> the script is more difficult to write, the result is full of errors, and
> when I load the config, it somehow hang my terminal sessions.
>
> So are there anyways to quickly populate the routing table of my testing
> routers by administrative configuration means?
>
> thanks for your help.
>
> regards,
>
> dong bei
> _______________________________________________
> juniper-nsp mailing list juniper-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/juniper-nsp
>


More information about the juniper-nsp mailing list