Wiki: iRules API




An iRule event triggered when a client has established a connection.

In effect, when an entry is inserted in the BIG-IP connection table, this event fires. For TCP connections, this happens when the three-way handshake successfully completes. For non-TCP connections, this will fire at a point that may not be wholly intuitive. For example, UDP is connectionless, so one might reasonably expect this event to fire with each segment in a UDP stream. However, BIG-IP does create a connection table entry for UDP, and assigns a timeout. If no segment arrives matching the table entry within the timeout period, the entry is removed (and CLIENT_CLOSED fires). However, segments matching the table entry that arrive within the timeout period will not trigger a new CLIENT_ACCEPTED event (and will reset the timeout timer for the entry). The timeout is generally configured, in the case of UDP, via the UDP profile (or a child profile) applied to the virtual server.

Some profile settings may also have an effect on when events are raised. For example, the "Datagram LB" setting on the UDP profile will force each segment in a UDP stream (that is, packets carrying UDP segments that all have a common source ip/port and destination ip/port) to load-balance. Between the BIG-IP system and the pool members, the forwarded segments will use different source port numbers for each segment (sort of like SNAT, but just for the port). In this case, CLIENT_ACCEPTED will fire for each segment. This is actually a specific case of the more general rule above, as each segment essentially creates an independent connection table entry. Notice, for example, that CLIENT_CLOSED will still fire for each segment after the timeout period.

Behavior for this command also depends on the type of virtual server. For example, a using "Standard" virtual server the event fires after the final client ACK of the three-way-handshake (as described above), on a "Performance L4" virtual server it fires on the initial SYN packet from the client.


  set curtime [clock seconds]
  set formattedtime [clock format $curtime -format {%H:%S} ]
  log "the time is: $formattedtime"

Related Information

Available Commands:
  • clone - Causes the system to clone traffic to the specified pool or pool member regardless of monitor status.
  • forward - Sets the connection to forward IP packets.
  • IP::client_addr - Returns the client IP address of a connection
  • IP::idle_timeout - Returns or sets the idle timeout value.
  • IP::local_addr - Returns the IP address of the virtual server the client is connected to or the self-ip LTM is connected from.
  • IP::remote_addr - Returns the IP address of the host on the far end of the connection.
  • IP::tos - Returns the ToS value encoded within a packet.
  • ip_ttl - Returns the TTL of the latest IP packet received.
  • lasthop - Sets the lasthop of an IP connection.
  • LB::server - Returns information about the currently selected server
  • listen - Sets up a related ephemeral listener to allow an incoming related connection to be established.
  • LSN::address - Set or override translation address.
  • LSN::disable - Disable LSN translation.
  • LSN::inbound - Disable inbound connections to translation address/port.
  • LSN::persistence - Set translation selection mode and persistence timeout.
  • LSN::persistence-entry - Create or lookup translation address.
  • LSN::pool - Specify LSN pool for current connection.
  • LSN::port - Set or override translation port.
  • nexthop - Sets the nexthop of an IP connection.
  • node - Sends the packet directly to the identified server node.
  • peer - Causes the specified iRule commands to be evaluated under the peer’s (opposite) context.
  • persist - Causes the system to use the named persistence type to persist the connection.
  • pool - Causes the system to load balance traffic to the specified pool or pool member regardless of monitor status.
  • serverside - Causes the specified iRule command to be evaluated under the server-side context.
  • session - Utilizes the persistence table to store arbitrary information based on the same keys as persistence.
  • snat - Causes the LTM system to assign the specified translation address to the current connection.
  • TCP::bandwidth - Returns a bandwidth estimate for the peer.
  • TCP::client_port - Returns the remote TCP port/service number of the clientside TCP connection.
  • TCP::close - Closes the TCP connection.
  • TCP::local_port - Returns the local TCP port/service number of a TCP connection.
  • TCP::mss - Returns the on-wire Maximum Segment Size (MSS) for a TCP connection.
  • TCP::nagle - Enables or disables the Nagle algorithm on the current TCP connection.
  • TCP::notify - Causes the the USER_REQUEST or USER_RESPONSE event to be raised.
  • TCP::offset - Returns the number of bytes currently held in memory via TCP::collect.
  • TCP::option - Gets or sets the value of the specified option kind from the TCP header.
  • TCP::payload - Returns or replaces TCP data content.
  • TCP::release - Releases and flushes collected data. and resumes processing.
  • TCP::remote_port - Returns the remote TCP port/service number of a TCP connection.
  • TCP::respond - Sends the specified data directly to the peer.
  • TCP::rtt - Returns the smoothed round-trip time estimate for a TCP connection.
  • TCP::server_port - Returns the remote TCP port/service number of the serverside TCP connection.
  • TCP::unused_port - Returns an unused TCP port for the specified IP tuple.
  • UDP::client_port - Returns the UDP port/service number of a client system.
  • UDP::drop - Drops the current UDP packet without removing the flow from the connection table
  • UDP::local_port - Returns the local UDP port/service number.
  • UDP::mss - Returns the on-wire Maximum Segment Size (MSS) for a UDP connection.
  • UDP::payload - Returns the content or length of the current UDP payload.
  • UDP::remote_port - Returns the remote UDP port/service number.
  • UDP::respond - Sends data directly to a peer.
  • UDP::server_port - Returns the UDP port/service number of a server system.
  • UDP::unused_port - Returns an unused UDP port for the specified IP tuple.

Sample Code:

  • Introduced: BIGIP-9.0.0