Forum Discussion

Aaron_Lewis_215's avatar
Aaron_Lewis_215
Icon for Nimbostratus rankNimbostratus
Feb 12, 2016

Modify multiple virtual servers

Hi,

 

I have an LTM environment with about 30 virtual servers that I'm moving to a new datacenter with a different external IP network. Can I copy the virtual servers in bulk while changing the virtual IP addresses?

 

Thanks!

 

4 Replies

  • Hi Aaron,

     

    you could either write a TMSH-TCL script to manipulate those IPs or export/edit/import the configuration using TMSH. But i doubt that writing a TMSH-TCL script would make any sense for a one-time task. So I would recommend to go the export/edit/import route...

     

    Note: The code below outlines a TMSH sequence to clone a single virtual server. But the same method can be used to export/edit/import multiple configuration objects.

     

    itacs@(f5-02)(cfg-sync Standalone)(Active)(/Common)(tmos) list ltm virtual VS_HTTPS_211
    ltm virtual VS_HTTPS_211 {
        destination 172.21.17.211%1:https
        ip-protocol tcp
        mask 255.255.255.255
        pool pool_a
        profiles {
            clientssl-insecure-compatible {
                context clientside
            }
            http { }
            oneconnect { }
            serverssl-insecure-compatible {
                context serverside
            }
            tcp-lan-optimized { }
        }
        related-rules {
            Test
        }
        rules {
            iRule_2_Delete
        }
        source 0.0.0.0%1/0
        source-address-translation {
            type automap
        }
        vs-index 12
    }
    itacs@(f5-02)(cfg-sync Standalone)(Active)(/Common)(tmos) load sys config from-terminal merge
    Enter configuration. Press CTRL-D to submit or CTRL-C to cancel.
    ltm virtual VS_HTTPS_212 {
        destination 172.21.17.212%1:https
        ip-protocol tcp
        mask 255.255.255.255
        pool pool_a
        profiles {
            clientssl-insecure-compatible {
                context clientside
            }
            http { }
            oneconnect { }
            serverssl-insecure-compatible {
                context serverside
            }
            tcp-lan-optimized { }
        }
        related-rules {
            Test
        }
        rules {
            iRule_2_Delete
        }
        source 0.0.0.0%1/0
        source-address-translation {
            type automap
        }
        vs-index 12
    }Loading configuration...
    itacs@(f5-02)(cfg-sync Standalone)(Active)(/Common)(tmos) list ltm virtual VS_HTTPS_212
    ltm virtual VS_HTTPS_212 {
        destination 172.21.17.212%1:https
        ip-protocol tcp
        mask 255.255.255.255
        pool pool_a
        profiles {
            clientssl-insecure-compatible {
                context clientside
            }
            http { }
            oneconnect { }
            serverssl-insecure-compatible {
                context serverside
            }
            tcp-lan-optimized { }
        }
        related-rules {
            Test
        }
        rules {
            iRule_2_Delete
        }
        source 0.0.0.0%1/0
        source-address-translation {
            type automap
        }
        vs-index 31
    }

    Cheers, Kai

     

  • Thanks, Kai. That is very helpful, except I found one caveat. I exported the virtual servers in my lab environment and changed the destination IP addresses in a text editor. When I tried to load the new virtual server configs with a new destination address, the system said that "the requested virtual address was not found." So, I had to manually enter the virtual address before I could load in the new virtual server.

     

    • Kai_Wilke's avatar
      Kai_Wilke
      Icon for MVP rankMVP
      You're welcome^^ Regarding the missing virtual address warning: Hmm.. I didn't run into the issue. The provided logfile was taken from my v12.0 developement system and the changed IP didn't exists before... Some version specific problems then? Cheers, Kai