Forum Discussion
Modify VS profiles using TMSH
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.
10 Replies
- There are modify and delete actions.
- Hi,
- 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
- No.
- Did you figure it out?
- 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 can also do this, tcp was on the clientside prior to this command. Somewhat verbose...
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 } ..
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com