ltm rule command TCP remote portΒΆ

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



TCP::remote_port
       Returns the remote TCP port number of a connection.

SYNOPSIS
       TCP::remote_port (clientside | serverside)?

DESCRIPTION
       Returns the remote TCP port/service number of a TCP connection. This
       command is equivalent to the BIG-IP 4.X variable remote_port. When used
       in a clientside context, this command returns the client-side TCP
       source port, and is equivalent to the TCP::client_port command.	When
       used in a serverside context, this command returns the server-side TCP
       destination port, and is equivalent to the TCP::server_port command.

       Syntax

       TCP::remote_port [ clientside | serverside ]

       TCP::remote_port

	    * Returns the remote TCP port/service number of the current context's
	      TCP connection.

       TCP::remote_port clientside

	    * Returns the remote TCP port/service number of the client-side TCP
	      connection.

       TCP::remote_port serverside

	    * Returns the remote TCP port/service number of the server-side TCP
	      connection.

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

EXAMPLES
	when HTTP_REQUEST {
	  if { [HTTP::uri] contains "/secure/" } {
	    pool ssl_pool
	  } else {
	    pool http_pool
	  }
	}
	when SERVER_CONNECTED {
	  if {[TCP::remote_port] != 443} {
	    SSL::disable
	  }
	}


	when SERVER_CONNECTED {
	  # This logs information about the TCP connections on *both* sides of the fullproxy
	  set client_remote "[IP::client_addr]:[TCP::client_port]"
	  set client_local  "[IP::local_addr clientside]:[TCP::local_port clientside]"
	  set server_local  "[IP::local_addr]:[TCP::local_port]"
	  set server_remote "[IP::server_addr]:[TCP::server_port]"
	  log local0. "Got connection: Client($client_remote)<->($client_local)LTM($server_local)<->($server_remote)Server"
	}

	Example output:

	: Got connection: Client(10.3.3.20:33798)<->(10.3.3.111:80)LTM(10.1.1.110:33798)<->(10.1.1.200:80)Server

HINTS
SEE ALSO
       TCP::client_port TCP::server_port TCP::local_port

CHANGE LOG
       @BIGIP-9.0.0 --First introduced the command.



BIG-IP				  2017-01-31			      iRule(1)