Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

Howto - Add a bunch of Static Routes

Hi Community, We are having a big network change and have to add some static routes on our BIG-IP LTM (Vers 11.2.1) e.g. about 32 Routes. Question: is there a smart way we can achieve this in a fast way (kinda lazy to add each route separately via Config Util or Shell). Any ideas, tips, suggestion would be great.

Regards Richard

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hi, what about a copy / paste method? You could create a flat file and then just use the "merge" option to load it. You'll have to change the name for each "net route" declaration:

vi /config/this

net route /Common/route_one {
    interface /Common/internal
    network 10.10.10.0/32
}
net route /Common/route_two {
    interface /Common/internal
    network 11.10.10.0/32
}
net route /Common/route_three {
    interface /Common/internal
    network 12.10.10.0/32
}

tmsh load sys config merge file /config/this

tmsh save sys config

One benefit, is you could create a UCS file prior to the work and if anything doesn't go quite a planned, just load the UCS and get the BIG-IP back to where it was prior to adding the new routes.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Shell is the fastest way. Create the commands in a text editor and paste them in when you are ready. e.g.

tmsh create net route 10.1.1.0 { gw 10.1.1.1 network 10.1.1.0/24 }
tmsh create net route 10.1.2.0 { gw 10.1.2.1 network 10.1.2.0/24 }

Alternatively, and my preferred technique, is to have the config all ready and merge it in. For example, create a file routes.txt:

net route 10.1.1.0 { gw 10.1.1.1 network 10.1.1.0/24 }
net route 10.1.2.0 { gw 10.1.2.1 network 10.1.2.0/24 }

then use "tmsh load sys config merge file routes.txt" when you are ready. The nice thing about that is you can check your change in advance without applying it using the verify option:

tmsh load sys config merge file routes.txt verify
0
Comments on this Answer
Comment made 03-Dec-2013 by uni 1155
What Kevin said :P
0
Comment made 03-Dec-2013 by Kevin.K
The one line syntax is definitely an improvement.
0
Comment made 03-Dec-2013 by uni 1155
Yes, it allows you to do it in a speadsheet easily.
0
Comment made 05-Jan-2017 by Luis Araujo 180

That´s it !! =)

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

I wrote a pycontrol script a while back to do this as well from a text file.

Updated to current bigsuds library:

0