ltm rule command listenΒΆ

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

listen
       Sets up a related ephemeral listener to allow an incoming related connection to be established.

SYNOPSIS
       listen (<'proto' UNSIGNED_SHORT>       |
		   <'bind' VLAN_OBJ IP_ADDR PORT> |
		   <'server' IP_ADDR PORT>	  |
		   <'allow' IP_ADDR (PORT)?>	  |
		   <'timeout' UNSIGNED_INT>)

DESCRIPTION
       Sets up a related ephemeral listener to allow an incoming related connection to be established. The source address and/or
       port of the related connection is unknown but the destination address and port are known.

       Syntax

       listen {
	   proto 
	   timeout 
	   bind   
	   server  
	   allow  [] }

	   * Sets up a related ephemeral listener to allow an incoming related
	      connection to be established:
	      + proto: The IP protocol number used in the connection. See /etc/protocols. Usually 6 (TCP) or 17 (UDP). See also IP::protocol
	      + timeout: The number of seconds to hold the listener open waiting
		on a connection.
	      + bind: vlan, addr, port to listen on. See also LINK::vlan_id
	      + server: The address and port to connect the listening connection to. See also LB::server
	      + allow: The address and optional port to restrict the incoming connection to. See also IP::client_addr

RETURN VALUE
VALID DURING
       AUTH_ERROR, AUTH_FAILURE, AUTH_RESULT, AUTH_SUCCESS, AUTH_WANTCREDENTIAL, CACHE_REQUEST, CACHE_RESPONSE, CACHE_UPDATE,
       CLIENT_ACCEPTED, CLIENT_CLOSED, CLIENT_DATA, CLIENT_LINE, CLIENTSSL_CLIENTCERT, CLIENTSSL_HANDSHAKE, HTTP_CLASS_FAILED,
       HTTP_CLASS_SELECTED, HTTP_REQUEST, HTTP_REQUEST_DATA, HTTP_REQUEST_SEND, HTTP_RESPONSE, HTTP_RESPONSE_CONTINUE,
       HTTP_RESPONSE_DATA, LB_FAILED, LB_SELECTED, NAME_RESOLVED, PERSIST_DOWN, RTSP_REQUEST, RTSP_REQUEST_DATA, RTSP_RESPONSE,
       RTSP_RESPONSE_DATA, SERVER_CLOSED, SERVER_CONNECTED, SERVER_DATA, SERVER_LINE, SERVERSSL_HANDSHAKE, SIP_REQUEST,
       SIP_REQUEST_SEND, SIP_RESPONSE, SIP_RESPONSE_SEND, STREAM_MATCHED, USER_REQUEST, USER_RESPONSE, XML_BEGIN_DOCUMENT,
       XML_BEGIN_ELEMENT, XML_CDATA, XML_END_DOCUMENT, XML_END_ELEMENT, XML_EVENT

EXAMPLES
	# Note, this example is not quite working yet...
	# connect to virtual and send something like "L 4444" to listen on port 4444.
	rule rl_listen {

	when RULE_INIT {
	      set my_port ""
	   }
	when CLIENT_ACCEPTED {
	      TCP::collect 6
	   }
	when CLIENT_DATA {
	      set my_port [getfield [TCP::payload 6] " " 2]
	   }
	when LB_SELECTED {
	      listen {
		 proto [IP::protocol]
		 timeout 30
		 bind [LINK::vlan_id] [IP::local_addr] $my_port
		 server [LB::server addr] 7
		 allow [IP::client_addr]
	      }
	   }
	}

HINTS
SEE ALSO
CHANGE LOG
       @BIGIP-9.0.0 --First introduced the command.

BIG-IP							    2022-04-12							  iRule(1)