ltm rule command TCP local port
iRule(1) BIG-IP TMSH Manual iRule(1)
TCP::local_port
Returns the local port of a TCP connection.
SYNOPSIS
TCP::local_port (clientside | serverside)?
DESCRIPTION
Returns the local port/service number of the specified side, or the
current context (client or server) if there is no argument. This
command is equivalent to the BIG-IP 4.X variable local_port. When used
in a clientside context, this command returns the client-side TCP
destination port. When used in a serverside context, this command
returns the server-side TCP source port.
Syntax
TCP::local_port [ clientside | serverside ]
TCP::local_port
* Returns the local TCP port/service number of the current context's
TCP connection.
TCP::local_port clientside
* Returns the local TCP port/service number of the client-side TCP
connection.
TCP::local_port serverside
* Returns the local TCP port/service number of the server-side TCP
connection.
RETURN VALUE
The local port.
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 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
UDP::local_port
CHANGE LOG
@BIGIP-9.0.0 --First introduced the command. @BIGIP-9.3.0 --Fixed for
FastL4
BIG-IP 2017-01-31 iRule(1)