TCP::local_port

Description

Returns the local TCP port/service number of a TCP connection. 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.

Examples

when SERVER_CONNECTED {
  # This logs information about the TCP connections on *both* sides of the full proxy
  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:

<SERVER_CONNECTED>: 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