Forum Discussion

RicFer's avatar
RicFer
Icon for Nimbostratus rankNimbostratus
Dec 03, 2013

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

 

3 Replies

  • Kevin_K_51432's avatar
    Kevin_K_51432
    Historic F5 Account

    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.

  • uni's avatar
    uni
    Icon for Altostratus rankAltostratus

    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