use command line to add pool and virtual server to f5 BigIP load balancer

Using the bigpipe cli command (or it’s alias “b“) to add pools and virtual servers, can save you hundreds of clicks. This is a very old version of a bigip.

# uname -r
BIG-IP 4.5.14

This creates a pool named myserverpool and adds a single member to it:

# b pool myserverpool {member 172.16.11.201:80}

To add many servers just use a while loop:

# i=202; while [ "$i" -lt "237" ]; do b pool myserverpool add \{ member 172.16.11.$i:80 \}; i=$(($i+1)); done;

Repeat for https:

# b pool myserverpool_ssl {member 172.16.11.201:443}
# i=202; while [ "$i" -lt "237" ]; do b pool myserverpool_ssl add \{ member 172.16.11.$i:443 \}; i=$(($i+1)); done;

Now add health checks:

# i=201; while [ "$i" -lt "237" ]; do b node 172.16.11.$i:80 monitor use http; i=$(($i+1)); done;
# i=201; while [ "$i" -lt "237" ]; do b node 172.16.11.$i:443 monitor use https; i=$(($i+1)); done;

And finally create the virtual servers, pointing traffic to the corresponding pools:

# b virtual 5.6.7.8:80 use pool myserverpool
# b virtual 5.6.7.8:443 use pool myserverpool_ssl