Fortinet black logo

IP commands

IP commands

IP commands contain functions to obtain IP layer related information such as obtaining the IP address and port of the server and client:

IP:Client_addr() — Returns the client IP address of a connection; for the frontend, it will return the source address, while for the backend, it will return the destination address.

IP:server_addr() — Returns the IP address of the server in the backend.

IP:local_addr() — For the frontend, it returns the IP address of the virtual server that the client is connected to. For the backend, it returns the incoming interface IP address of the return packet.

IP:remote_addr() — Returns the IP address of the host on the far end of the connection.

IP:client_port() — Returns the client port number.

IP:server_port() — Returns the server port number. It is the real server port.

IP:local_port() — Returns the local port number. In the frontend, the local port is the virtual server port. In the backend, the local port is the port used to connect to the gateway.

IP:remote_port() — Returns the remote port number. In the frontend, the remote port is the client port. In the backend, remote port is the real server port.

IP:client_ip_ver() — Returns the current client IP version number of the connection, either 4 (for IPv4) or 6 (for IPv6).

IP:server_ip_ver() — Returns the current server IP version number of the connection, either 4 (for IPv4) or 6 (for IPv6).

IP:Client_addr()

Returns the client IP address of a connection; for the frontend, it will return the source address, while for the backend, it will return the destination address.

Syntax

cip=IP:client_addr()

Arguments

N/A

Example
when SERVERSSL_HANDSHAKE {
cip=IP:client_addr()
lip=IP:local_addr()
sip=IP:server_addr()
rip=IP:remote_addr()
cp=IP:client_port()
lp=IP:local_port()
sp=IP:server_port()
rp=IP:remote_port()
sipv=IP:server_ip_ver();
cipv=IP:client_ip_ver();
debug("in server ssl with remote addr %s:%s client %s:%s, local %s:%s, server %s:%s, ip version %s:%s\n", rip, rp, cip, cp, lip,lp, sip, sp, sipv, cipv)
}}

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND

IP:server_addr()

Returns the IP address of the server in the backend.

Syntax

sip=IP:server_addr()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: Server-side event (include HTTP_RESPONSE/HTTP_DATA_RESPONSE/…)

IP:local_addr()

For the frontend, it returns the IP address of the virtual server that the client is connected to. For the backend, it returns the incoming interface IP address of the return packet.

Syntax

sip=IP:local_addr()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND / SERVER_BEFORE_CONNECT

IP:remote_addr()

Returns the IP address of the host on the far end of the connection.

Syntax

sip=IP:remote_addr()

Arguments

N/A

Examples

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND / SERVER_BEFORE_CONNECT

IP:client_port()

Returns the client port number.

Syntax

cp=IP:client_port()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND

IP:server_port()

Returns the server port number. It is the real server port.

Syntax

sp=IP:server_port()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: Server-side events (include HTTP_RESPONSE/HTTP_DATA_RESPONSE/…)

IP:local_port()

Returns the local port number. In the frontend, the local port is the virtual server port. In the backend, the local port is the port used to connect to the gateway.

Syntax

sp=IP:local_port()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND / SERVER_BEFORE_CONNECT

IP:remote_port()

Returns the remote port number. In the frontend, the remote port is the client port. In the backend, remote port is the real server port.

Syntax

rp=IP:remote_port()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND / SERVER_BEFORE_CONNECT

IP:client_ip_ver()

Returns the current client IP version number of the connection, either 4 (for IPv4) or 6 (for IPv6).

Syntax

cv=IP:client_ip_ver ()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND

IP:server_ip_ver()

Returns the current server IP version number of the connection, either 4 (for IPv4) or 6 (for IPv6).

Syntax

cv=IP:server_ip_ver ()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: Server-side events

IP commands

IP commands contain functions to obtain IP layer related information such as obtaining the IP address and port of the server and client:

IP:Client_addr() — Returns the client IP address of a connection; for the frontend, it will return the source address, while for the backend, it will return the destination address.

IP:server_addr() — Returns the IP address of the server in the backend.

IP:local_addr() — For the frontend, it returns the IP address of the virtual server that the client is connected to. For the backend, it returns the incoming interface IP address of the return packet.

IP:remote_addr() — Returns the IP address of the host on the far end of the connection.

IP:client_port() — Returns the client port number.

IP:server_port() — Returns the server port number. It is the real server port.

IP:local_port() — Returns the local port number. In the frontend, the local port is the virtual server port. In the backend, the local port is the port used to connect to the gateway.

IP:remote_port() — Returns the remote port number. In the frontend, the remote port is the client port. In the backend, remote port is the real server port.

IP:client_ip_ver() — Returns the current client IP version number of the connection, either 4 (for IPv4) or 6 (for IPv6).

IP:server_ip_ver() — Returns the current server IP version number of the connection, either 4 (for IPv4) or 6 (for IPv6).

IP:Client_addr()

Returns the client IP address of a connection; for the frontend, it will return the source address, while for the backend, it will return the destination address.

Syntax

cip=IP:client_addr()

Arguments

N/A

Example
when SERVERSSL_HANDSHAKE {
cip=IP:client_addr()
lip=IP:local_addr()
sip=IP:server_addr()
rip=IP:remote_addr()
cp=IP:client_port()
lp=IP:local_port()
sp=IP:server_port()
rp=IP:remote_port()
sipv=IP:server_ip_ver();
cipv=IP:client_ip_ver();
debug("in server ssl with remote addr %s:%s client %s:%s, local %s:%s, server %s:%s, ip version %s:%s\n", rip, rp, cip, cp, lip,lp, sip, sp, sipv, cipv)
}}

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND

IP:server_addr()

Returns the IP address of the server in the backend.

Syntax

sip=IP:server_addr()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: Server-side event (include HTTP_RESPONSE/HTTP_DATA_RESPONSE/…)

IP:local_addr()

For the frontend, it returns the IP address of the virtual server that the client is connected to. For the backend, it returns the incoming interface IP address of the return packet.

Syntax

sip=IP:local_addr()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND / SERVER_BEFORE_CONNECT

IP:remote_addr()

Returns the IP address of the host on the far end of the connection.

Syntax

sip=IP:remote_addr()

Arguments

N/A

Examples

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND / SERVER_BEFORE_CONNECT

IP:client_port()

Returns the client port number.

Syntax

cp=IP:client_port()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND

IP:server_port()

Returns the server port number. It is the real server port.

Syntax

sp=IP:server_port()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: Server-side events (include HTTP_RESPONSE/HTTP_DATA_RESPONSE/…)

IP:local_port()

Returns the local port number. In the frontend, the local port is the virtual server port. In the backend, the local port is the port used to connect to the gateway.

Syntax

sp=IP:local_port()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND / SERVER_BEFORE_CONNECT

IP:remote_port()

Returns the remote port number. In the frontend, the remote port is the client port. In the backend, remote port is the real server port.

Syntax

rp=IP:remote_port()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND / SERVER_BEFORE_CONNECT

IP:client_ip_ver()

Returns the current client IP version number of the connection, either 4 (for IPv4) or 6 (for IPv6).

Syntax

cv=IP:client_ip_ver ()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: all except VS_LISTENER_BIND

IP:server_ip_ver()

Returns the current server IP version number of the connection, either 4 (for IPv4) or 6 (for IPv6).

Syntax

cv=IP:server_ip_ver ()

Arguments

N/A

Example

Please refer to IP:client_addr() example.

FortiADC version: V5.0

Used in events: Server-side events