Forum Discussion

Khaled_HA's avatar
Khaled_HA
Icon for Altocumulus rankAltocumulus
Aug 18, 2023

How to get Virtual servers associated with a specific SNAT pool

Hi Everyone,

I need your help as I am trying to get the VSs that are associated with a specific SNAT pool from the command line.

 

Thanks!

  • JRahm's avatar
    JRahm
    Aug 21, 2023

    Hi Khaled_HA, you can use awk to print only the virtual name, so to expand on what was provided earlier:

    tmsh list ltm virtual one-line | grep "pool SNAT_POOL_NAME" | awk '{print $3}'
    • JRahm's avatar
      JRahm
      Icon for Admin rankAdmin

      Love this script, whisperer ...should be a default install when deploying new BIG-IP boxes...

  • tmsh list ltm virtual one-line | grep "pool SNAT_POOL_NAME" 

    Remark: SNAT_POOL_NAME should not have the same name as an existing LTM pool (and this is a best practice btw)

    • Khaled_HA's avatar
      Khaled_HA
      Icon for Altocumulus rankAltocumulus

      Hi Amine,

      Actually I was using this command, the problem is that it is giving me the whole configuration, while I just need the virtual server name.

      So, is there any way to get only the virtual server name ?

      Thanks!

      • JRahm's avatar
        JRahm
        Icon for Admin rankAdmin

        Hi Khaled_HA, you can use awk to print only the virtual name, so to expand on what was provided earlier:

        tmsh list ltm virtual one-line | grep "pool SNAT_POOL_NAME" | awk '{print $3}'
  • Khaled_HA  - If your post was solved it would be helpful to the community to select *Accept As Solution*.
    Thanks for being part of our community.

  • Hi F5_Design_Engineer, you'd need to build an iteritive script to accomplish that, first by listing all the vips in that partition, then listing out any snat or snat pool details by querying those objects directly. Can be done on-box with a tmsh script or off-box using iControl REST.

  •  how to get a list of all the SNAT pools or snat-translation or automap details assosiated to all the vips in a partiton other than /Common, i am not finding any such comand or grep command.

    I tried following but none of them are working or no output

    list ltm virtual all-properties | grep -i -e source-address-translation

    show ltm virtual all-properties detail | grep -i -e 'LTM\|Destination'

    show ltm virtual all-properties detail | grep -i -e 'LTM\|Destination'

    list ltm virtual all-properties | grep -i -e 'LTM\|source-address-translation'

    list ltm virtual all-properties one-line | grep -E "LTM\|pool|Destination|source-address-translation"

    list ltm virtual one-line | grep -E "LTM\|pool|Destination|SNAT_POOl_NAME"

    list ltm virtual one-line | grep "pool SNAT_POOL_NAME" | awk '{print $3}'

    • whisperer's avatar
      whisperer
      Icon for MVP rankMVP

      Other than common? Use TMSH GUI and cd into partition. By default, you will only get list from /Common. So... tmsh; cd /partition_name; your list commands.

  • I hope my query is not clear

     

    Here it is again

     

     how to get a list of all the SNAT pools or snat-translation or automap details assosiated to all the vips in a partition, any particular grep command we can use , if anyone has done it before using grep command