Modify VS profiles using TMSH

Hi,

I am trying to modify a tcp profile on a VS using tmsh. For example replace the tcp default profiles by custom ones. So far the only way I’ve managed to do this is by using the following command :

tmsh modify /ltm virtual profiles replace-all-with {tcp-lan-optimized {context serverside} tcp-wan-optimized {context clientside} http}

But this solution implies to re-input all the profiles.

Is there an easier way to just modify a specific profile and not replace all of them at once ?

Thank you.

There are modify and delete actions.

root@localhost(Active)(/Common)(tmos) mod ltm virtual abc profiles [tab]

Options:

add modify replace-all-with

delete none

root@localhost(Active)(/Common)(tmos) mod ltm virtual abc profiles

root@localhost(Active)(/Common)(tmos) mod ltm virtual abc profiles add { stats }

root@localhost(Active)(/Common)(tmos) mod ltm virtual abc profiles delete { stats }

root@localhost(Active)(/Common)(tmos)

root@localhost(Active)(/Common)(tmos) create ltm profile tcp t1 t2

root@localhost(Active)(/Common)(tmos) mod ltm virtual abc profiles replace-all-with { t1 { context clientside } t2 { context serverside } }

root@localhost(Active)(/Common)(tmos) mod ltm virtual abc profiles modify { t1 { context serverside } t2 { context clientside } }

root@localhost(Active)(/Common)(tmos)

Hi,

I noticed that there is the modify action, however I cannot find the right syntax to use it.

For example, I wish to modify the tcp profile on both the clientside and serverside. I was expecting something like :

root@localhost(Active)(/Common)(tmos) mod ltm virtual abc profiles modify arg1 arg2

But I cant make it work.

Any help?

Thanks.

Do you mean you want to change the setting of the tcp profile? As an example, the tcp profile has a slow-start setting. If you are trying to change the tcp profile slow-start setting via “mod ltm virtual…”, that won’t work, you need to do

“mod ltm profile tcp [profile name] slow-start [value]”. Or did you mean something else?

No.

I want to apply custom tcp profiles to a virtual server using tmsh. For example replace the tcp profile on clientside with the tcp-wan-optimized profile.

I managed to do it with the “replace-all-with” options but I have to reinput all the profiles to the vs for this work. I only wish to use the “modify” option to ONLY replace the tcp clientside profile for instance.

It looks like you can only change the TCP profiles through the ‘replace-all-with’ option and typing out all of the profiles you have on that virtual in addition to the new profiles.

You could edit the configuration file directly using ‘edit ltm virtual [virtual-name]’ and add the profiles that way.

You can also do this, tcp was on the clientside prior to this command. Somewhat verbose…

root@d12(Active)(/Common)(tmos) mod ltm virtual abc profiles add { tcp-wan-optimized { context clientside } } profiles delete { tcp }

root@d12(Active)(/Common)(tmos) list ltm virtual abc profiles

ltm virtual abc {

profiles {

tcp-cell-optimized {

context serverside

}

tcp-wan-optimized {

context clientside

}

}

}

I just had to figure this out and if you want to replace only a single profile (ie. the http profile) it can be done like this.

modify ltm virtual test-443 profiles delete { http } profiles add { http_XFF }

Here are a whole bunch that you may use (with extreme caution of coarse because lazy_sysadmin & be especially cautious on systems that use non-http virtual servers like ldap):

Lists the names of the virtual servers with the basic tcp profile assigned:

tmsh list ltm virtual one-line | grep "profiles.*\ tcp\ " | awk ‘{ print $3 }’

Changes the individual virtual server’s profile manually (edit VIRTUAL_SERVER_NAME to whichever one you want to edit):

tmsh mod ltm virtual $VIRTUAL_SERVER_NAME profiles add { tcp-wan-optimized { context all } } profiles delete { tcp }

This is ugly but performs the previous two steps on all virtual servers that need the change made:

tmsh list ltm virtual one-line | grep "profiles.*\ tcp\ " | awk ‘{ print $3 }’ | xargs -I vs_name tmsh mod ltm virtual vs_name profiles add { tcp-wan-optimized { context all } } profiles delete { tcp }

Lists the virtual servers with only simple http compression applied:

tmsh list ltm virtual one-line | grep "profiles.*\ httpcompression\ " | awk ‘{ print $3 }’

manually change individual virtual server (edit variable):

tmsh mod ltm virtual $VIRTUAL_SERVER_NAME profiles add { wan-optimized-compression { context all } } profiles delete { httpcompression }

Again, super ugly but does the job. Move all to wan-optimized-compression:

tmsh list ltm virtual one-line | grep "profiles.*\ httpcompression\ " | awk ‘{ print $3 }’ | xargs -I vs_name tmsh mod ltm virtual vs_name profiles add { wan-optimized-compression { context all } } profiles delete { httpcompression }

Wait a sec, which ones do not have the wan-optimized-compression profile enabled?

tmsh list ltm virtual one-line | grep -v " wan-optimized-compression\ "

Apply this to all of them:

tmsh list ltm virtual one-line | grep -v " wan-optimized-compression\ " | grep virtual | awk ‘{ print $3 }’ | xargs -I vs_name tmsh mod ltm virtual vs_name profiles add { wan-optimized-compression { context all } }

It looks good. Can you tell me the command if I want to add tcp-lan-optimized and tcp-wan-optimized to my_virtual? So far I figured out it will be like this but not sure about its sequence and what to add in it. (I even tried tmsh ref guide but didn’t get anything there) (In the VS configuration default profile is tcp) modify ltm virtual my_virtual profiles add { tcp-lan-optimized tcp-wan-optimized } ..

Did you figure it out?