ltm rule command TCP unused portΒΆ

iRule(1)					  BIG-IP TMSH Manual					     iRule(1)

TCP::unused_port
       Returns an unused TCP port for the specified IP tuple.

SYNOPSIS
       TCP::unused_port REMOTE_ADDR REMOTE_PORT LOCAL_ADDR
				(HINT_PORT	     |
				(HINT_PORT MIN_PORT) |
				(HINT_PORT MIN_PORT MAX_PORT))?

DESCRIPTION
       Returns an unused TCP port for the specified IP tuple, using the value of  as a starting point if
       it is supplied. If no appropriate unused local port could be found, 0 is returned.

       Syntax

       TCP::unused_port    [] TCP::unused_port 
         [ ] TCP::unused_port   
       [  ]

	  * Returns an unused TCP port for the specified IP tuple, using the value
	  of  as a starting point if it is supplied. If no appropriate
	  unused local port could be found, 0 is returned.

RETURN VALUE
VALID DURING
       CLIENT_ACCEPTED, CLIENT_CLOSED, CLIENT_DATA, SERVER_INIT, SERVER_CLOSED, SERVER_CONNECTED, SERVER_DATA,
       SIP_REQUEST, SIP_REQUEST_SEND, SIP_RESPONSE, STREAM_MATCHED

EXAMPLES
	rule rule_unused_port1 {
	    when HTTP_REQUEST {
	    log local0. [TCP::unused_port 192.168.1.124 80 192.168.1.146]
	    }
	}

	# 192.168.1.124:80 is a pool member
	# 192.168.1.146 is a self ip
	# The result on /var/log/ltm is like this
	# Aug 22 09:47:44 local/tmm info tmm: Rule rule_unused_port1 : 26479

HINTS
SEE ALSO
CHANGE LOG
       @BIGIP-9.0.0 --First introduced the command.  @BIGIP-11.1.0 --Added optional arguments:  

BIG-IP						      2020-06-23					     iRule(1)