Forum Discussion

james_lee_31100's avatar
james_lee_31100
Icon for Nimbostratus rankNimbostratus
Aug 25, 2017

What is the best way to verify new IP address is not used on F5 ltm

Hi, Everyone:

 

I am trying to use Ansible to build a lot of VIPs, Is there a way to verify new IP addresses is not used on LTM, currently I am doing following (grep /config/bigip.conf, and grep /config/bigip_base.conf)

 

I tried to use bigip_facts(for selfip, virtualaddress, pool), it takes long time, is there any other ways?

 

Thanks

 

8 Replies

  • A simple ping should tell you. By default, the icmp is enabled for all vips. If you dont get a response, then that VIP is free.

     

  • Hi,

     

    You can use the Network Map in LTM. There is a search option in Network Map. Type in the IP-address and click on Update Map. The item found is highlighted.

     

    Regards, Martijn.

     

    • jaikumar_f5's avatar
      jaikumar_f5
      Icon for MVP rankMVP

      Hi Martijn,

       

      Yes this is GUI way of finding and Yes its a great way to search a particular IP in VS,pools, irules etc. And results are handy too.

       

      But I've had experience where the GUI takes lot of time in loading :) Sometimes the configuration utility time outs too. Nothing is better than a console, from my point of view.

       

  • Hi,

     

    You can use the Network Map in LTM. There is a search option in Network Map. Type in the IP-address and click on Update Map. The item found is highlighted.

     

    Regards, Martijn.

     

    • jaikumar_f5's avatar
      jaikumar_f5
      Icon for MVP rankMVP

      Hi Martijn,

       

      Yes this is GUI way of finding and Yes its a great way to search a particular IP in VS,pools, irules etc. And results are handy too.

       

      But I've had experience where the GUI takes lot of time in loading :) Sometimes the configuration utility time outs too. Nothing is better than a console, from my point of view.

       

  • Hi,

    Instead of using grep in config file, you can search in tmsh

    tmsh    
    cd /    
    list recursive | grep 1.2.3.4    
    

    The goal of the recursive is to search in partitions

  • This will show you all self-IPs, float IPs, and all VS IPs:

    ( tmsh list /ltm virtual one-line ; tmsh list /net self one-line ) | egrep '^(ltm virtual|net self) ' | sed -e 's/^.* destination //g' -e 's/^net self //g' | cut -d' ' -f1 | cut -d: -f1 | sort -t. -n -k1,1 -k2,2 -k3,3 -k4,4 | uniq
    

    You need to run it on F5

    Or, remotely via SSH:

    ssh YOUR-BIG-IP "( tmsh list /ltm virtual one-line ; tmsh list /net self one-line )" | egrep '^(ltm virtual|net self) ' | sed -e 's/^.* destination //g' -e 's/^net self //g' | cut -d' ' -f1 | cut -d: -f1 | sort -t. -n -k1,1 -k2,2 -k3,3 -k4,4 | uniq
    

    Or, if you don't have a full shell, but tmsh cli only:

    ssh YOUR-BIG-IP "list /ltm virtual one-line ; list /net self one-line" | egrep '^(ltm virtual|net self) ' | sed -e 's/^.* destination //g' -e 's/^net self //g' | cut -d' ' -f1 | cut -d: -f1 | sort -t. -n -k1,1 -k2,2 -k3,3 -k4,4 | uniq
    

    I have written a wrapper script for it, which shows me all used and free F5 IPs in a specific subnet. I might just share it somewhere.

  • iControl REST way.

    GET /mgmt/tm/ltm/virtual-address
    for getting virtual addresses: e.g.,

    curl -sku : https:///mgmt/tm/ltm/virtual-address
    

    If you only want the addresses, pipe the output to

    |  python -c 'import sys,json; o=json.load(sys.stdin); oo = [vip["address"] for vip in o["items"]]; print("\n".join(oo))'
    

    GET /mgmt/tm/net/self
    for getting the self IP addresses: e.g.,

    curl -sku : https:///mgmt/tm/net/self
    

    Pipe the output to the same python filter for getting the addresses.

    I guess you don't need to get the management address since you have already used it in the above calls (

    ), however, to satisfy your curiousity, it is
    GET /mgmt/tm/sys/management-ip
    .