fw monitor
Description
Firewall Monitor is the Check Point traffic capture tool.
In a Security Gateway, traffic passes through different inspection points - Chain Modules in the Inbound direction and then in the Outbound direction (see fw ctl chain).
The FW Monitor tool captures the traffic at each Chain Module in both directions.
You can later analyze the captured traffic with the same FW Monitor tool, or with special tools like Wireshark.
|
Notes:
|
Syntax for IPv4
|
|
Syntax for IPv6
|
|
Parameters
Parameter |
Description |
|||||||
---|---|---|---|---|---|---|---|---|
|
Shows the built-in usage. |
|||||||
|
Runs the command in debug mode and shows some information about how the FW Monitor starts and compiles the specified INSPECT filter:
|
|||||||
|
Specifies how many packets to capture. The FW Monitor stops the traffic capture if it counted the specified number of packets.
|
|||||||
or
|
Captures only specific packets of non-accelerated traffic:
|
|||||||
|
Specifies the capture filter (for both accelerated and non-accelerated traffic):
|
|||||||
|
|
|||||||
|
Creates an IP address filter. For more information, see the R81 Quantum Security Gateway Guide - Chapter Kernel Debug on Security Gateway - Section Kernel Debug Filters. This parameter supports up to 3 capture filters (up to 3 instances of the " Example - Capture only HTTP traffic to and from the Host 1.1.1.1:
|
|||||||
|
Flushes the standard output.
|
|||||||
|
Specifies the maximal length of the captured packets. FW Monitor reads only the specified number of bytes from each packet.
|
|||||||
|
Specifies the capture mask (inspection point) in relation to Chain Modules, in which the FW Monitor captures the traffic. These are the inspection points, through which each packet passes on a Security Gateway.
|
|||||||
|
Notes:
|
|||||||
|
Example packet flows:
|
|||||||
|
Specifies the output file, to which FW Monitor writes the captured raw data.
The format of this output file is the same format used by tools like You can later analyze the captured traffic with the same FW Monitor tool, or with special tools like Wireshark. |
|||||||
or
|
Inserts the FW Monitor Chain Module at the specified position between the kernel Chain Modules (see the fw ctl chain). If the FW Monitor writes the captured data to the specified output file (with the parameter " You can insert the FW Monitor Chain Module in these positions only:
|
|||||||
|
Notes:
|
|||||||
|
Shows the timestamp for each packet:
|
|||||||
or
|
Shows UUID for each packet (it is only possible to print either the UUID, or the SUUID - not both):
|
|||||||
|
Removes the simple capture filters specified with this parameter:
|
|||||||
|
On a VSX Gateway or VSX Cluster Member, captures the packets on the specified Virtual System or Virtual Router. By default, FW Monitor captures the packets on all Virtual Systems and Virtual Routers. Example:
|
|||||||
|
Captures the entire packet, instead of only the header. Must be used together with one of these parameters:
|
|||||||
|
Specifies the position in each packet, where the FW Monitor starts to capture the data from each packet. Optionally, it is also possible to limit the amount of data the FW Monitor captures.
For example, to skip over the IP header and TCP header, enter " |
Inspection points in Security Gateway and in the FW Monitor output
Note - The Inbound and Outbound traffic direction relates to each specific packet, and not to the connection.
-
Inbound
Name of inspection point
Relation to the FireWall
Virtual MachineNotion of inspection point
in the FW Monitor outputPre-Inbound
Before the inbound FireWall VM
i (for example,
eth4:i
)Post-Inbound
After the inbound FireWall VM
I (for example,
eth4:I
)Pre-Inbound VPN
Inbound before decrypt
id (for example,
eth4:id
)Post-Inbound VPN
Inbound after decrypt
ID (for example,
eth4:ID
)Pre-Inbound QoS
Inbound before QoS
iq (for example,
eth4:iq
)Post-Inbound QoS
Inbound after QoS
IQ (for example,
eth4:IQ
) -
Outbound
Name of inspection point
Relation to the FireWall
Virtual MachineNotion of inspection point
in the FW Monitor outputPre-Outbound
Before the outbound FireWall VM
o (for example,
eth4:o
)Post-Outbound
After the outbound FireWall VM
O (for example,
eth4:O
)Pre-Outbound VPN
Outbound before encrypt
e (for example,
eth4:e
)Post-Outbound VPN
Outbound after encrypt
E (for example,
eth4:E
)Pre-Outbound QoS
Outbound before QoS
oq (for example,
eth4:oq
)Post-Outbound QoS
Outbound after QoS
OQ (for example,
eth4:OQ
)
Generic Examples
Examples for the "-e" parameter
|
To specify a host, you can use one of these expressions:
-
Use
"host(<IP_Address_in_Doted_Decimal_format>)"
, which applies to both Source IP address and Destination IP address -
Use a specific Source IP address
"src=<IP_Address_in_Doted_Decimal_format>"
and a specific Destination IP address"dst=<IP_Address_in_Doted_Decimal_format>"
Example filters:
-
Capture everything between host X and host Y:
[Expert@HostName]# fw monitor -e "host(x.x.x.x) and host(y.y.y.y), accept;" -o /var/log/fw_mon.cap
[Expert@HostName]# fw monitor -e "((src=x.x.x.x , dst=y.y.y.y) or (src=y.y.y.y , dst=x.x.x.x)), accept;" -o /var/log/fw_mon.cap
-
Capture everything between hosts X,Z and hosts Y,Z in all Firewall kernel chains:
[Expert@HostName]# fw monitor -p all -e "((src=x.x.x.x or dst=z.z.z.z) and (src=y.y.y.y or dst=z.z.z.z)), accept ;" -o /var/log/fw_mon.cap
-
Capture everything to/from host X or to/from host Y or to/from host Z:
[Expert@HostName]# fw monitor -e "host(x.x.x.x) or host(y.y.y.y) or host(z.z.z.z), accept;" -o /var/log/fw_mon.cap
[Expert@HostName]# fw monitor -e "((src=x.x.x.x or dst=x.x.x.x) or (src=y.y.y.y or dst=y.y.y.y) or (src=z.z.z.z or dst=z.z.z.z)), accept;" -o /var/log/fw_mon.cap
|
Note - You must specify port numbers in Decimal format. Refer to the |
To specify a port, you can use one of these expressions:
-
Use
"port(<IANA_Port_Number>)"
, which applies to both Source Port and Destination Port -
Use a specific Source Port
"sport=<IANA_Port_Number>"
and a specific Destination Port"dport=<IANA_Port_Number>"
-
In addition:
-
For specific TCP port, you can use
"tcpport(<IANA_Port_Number>)"
, which applies to both Source TCP Port and Destination TCP Port -
For specific UDP port, you can use
"udpport(<IANA_Port_Number>)"
, which applies to both Source UDP Port and Destination UDP Port
-
Example filters:
-
Capture everything to/from port X:
[Expert@HostName]# fw monitor -e "port(x), accept;" -o /var/log/fw_mon.cap
[Expert@HostName]# fw monitor -e "(sport=x or dport=x), accept;" -o /var/log/fw_mon.cap
-
Capture everything except port X:
[Expert@HostName]# fw monitor -e "((sport=!x) or (dport=!x)), accept;" -o /var/log/fw_mon.cap
[Expert@HostName]# fw monitor -e "not (sport=x or dport=x), accept;" -o /var/log/fw_mon.cap
-
Capture everything except SSH:
[Expert@HostName]# fw monitor -e "((sport!=22) or (dport!=22)), accept;" -o /var/log/fw_mon.cap
[Expert@HostName]# fw monitor -e "not (sport=22 or dport=22), accept;" -o /var/log/fw_mon.cap
[Expert@HostName]# fw monitor -e "not tcpport(22), accept;" -o /var/log/fw_mon.cap
-
Capture everything to/from host X except SSH:
[Expert@HostName]# fw monitor -e "(host(x.x.x.x) and (sport!=22 or dport!=22)), accept;" -o /var/log/fw_mon.cap
[Expert@HostName]# fw monitor -e "((src=x.x.x.x or dst=x.x.x.x) and (not (sport=22 or dport=22))), accept;" -o /var/log/fw_mon.cap
[Expert@HostName]# fw monitor -e "(host(x.x.x.x) and not tcpport(22)), accept;" -o /var/log/fw_mon.cap
-
Capture everything except NTP:
[Expert@HostName]# fw monitor -e "not udpport(123), accept;" -o /var/log/fw_mon.cap
|
Note - You must specify protocol numbers in Decimal format. Refer to the |
To specify a protocol, you can use one of these expressions:
-
Use
"ip_p=<IANA_Protocol_Number>"
Examples:
-
To specify TCP protocol with byte offset, use
"ip_p=6"
-
To specify UDP protocol with byte offset, use
"ip_p=11"
-
To specify ICMP protocol with byte offset, use
"ip_p=1"
-
-
Use
"accept [9:1]=<IANA_Protocol_Number>"
Examples:
-
To specify TCP protocol with byte offset, use
"accept [9:1]=6"
-
To specify UDP protocol with byte offset, use
"accept [9:1]=11"
-
To specify ICMP protocol with byte offset, use
"accept [9:1]=1"
-
-
In addition, you can explicitly use these expressions to specify protocols:
Example filters:
-
Filter to capture everything on protocol X:
[Expert@HostName]# fw monitor -e "ip_p=X, accept;" -o /var/log/fw_mon.cap
-
Filter to capture rverything on protocol X and port Z on protocol Y:
[Expert@HostName]# fw monitor -e "(ip_p=X) or (ip_p=Y, port(Z)), accept;" -o /var/log/fw_mon.cap
-
Filter to capture capture everything TCP between host X and host Y:
[Expert@HostName]# fw monitor -e "ip_p=6, host(x.x.x.x) or host(y.y.y.y), accept;" -o /var/log/fw_mon.cap
[Expert@HostName]# fw monitor -e "tcp, host(x.x.x.x) or host(y.y.y.y), accept;" -o /var/log/fw_mon.cap
[Expert@HostName]# fw monitor -e "accept [9:1]=6 , ((src=x.x.x.x , dst=y.y.y.y) or (src=y.y.y.y , dst=x.x.x.x));"
[Expert@HostName]# fw monitor -e "ip_p=6, ((src=x.x.x.x , dst=y.y.y.y) or (src=y.y.y.y , dst=x.x.x.x)), accept;" -o /var/log/fw_mon.cap
|
Note - Refer to the |
Syntax:
|
Parameters:
Explanations:
-
The IP-based protocols are stored in the IP packet as a byte at offset 9.
-
To filter based on a Protocol encapsulated into IP, use this syntax:
[Expert@HostName]# fw monitor -e "accept [9:1]=<IANA_Protocol_Number>;"
-
-
The Layer 3 IP Addresses are stored in the IP packet as double words at offset 12 (Source address) and at offset 16 (Destination address).
-
To filter based on a Source IP address, use this syntax:
[Expert@HostName]# fw monitor -e "accept [12:4,b]=<IP_Address_in_Doted_Decimal_format>;"
-
To filter based on a Destination IP address, use this syntax:
[Expert@HostName]# fw monitor -e "accept [16:4,b]=<IP_Address_in_Doted_Decimal_format>;"
-
-
The Layer 4 Ports are stored in the IP packet as a word at offset 20 (Source port) and at offset 22 (Destination port).
-
To filter based on a Source port, use this syntax:
[Expert@HostName]# fw monitor -e "accept [20:2,b]=<Port_Number_in_Decimal_format>;"
-
To filter based on a Destination port, use this syntax:
[Expert@HostName]# fw monitor -e "accept [22:2,b]=<Port_Number_in_Decimal_format>;"
-
Example filters:
-
Capture everything between host X and host Y:
[Expert@HostName]# fw monitor -e "accept (([12:4,b]=x.x.x.x , [16:4,b]=y.y.y.y) or ([12:4,b]=y.y.y.y , [16:4,b]=x.x.x.x));"
-
Capture everything on port X:
[Expert@HostName]# fw monitor -e "accept [20:2,b]=x or [22:2,b]=x;" -o /var/log/fw_mon.cap
You must specify the network address and length of network mask (number of bits).
There are 3 options:
Traffic direction |
Expression |
---|---|
To or From a network |
|
To a network |
|
From a network |
|
Example filters:
-
Capture everything to/from network 192.168.33.0 / 24:
[Expert@HostName]# fw monitor -e "net(192.168.33.0, 24), accept;"
-
Capture everything sent to network 192.168.33.0 / 24:
[Expert@HostName]# fw monitor -e "to_net(192.168.33.0, 24), accept;"
-
Capture everything sent from network 192.168.33.0 / 24:
[Expert@HostName]# fw monitor -e "from_net(192.168.33.0, 24), accept;"
Filter in only TCP protocol, and HTTP and HTTPS ports
Filter out the SSH and FW Logs
|
Examples for the "-F" parameter
You can specify up to 5 capture filters with this parameter (up to 5 instances of the "-F
" parameter in the syntax).
The FW Monitor performs the logical "OR" between all specified simple capture filters.
Value 0 is used as "any
".
|
-
Capture all traffic from Source IP x.x.x.x (any port) to Destination IP y.y.y.y (any port), over all protocols:
[Expert@HostName]# fw monitor -F "x.x.x.x,0,y.y.y.y,0,0" -o /var/log/fw_mon.cap
-
Capture all traffic between Host x.x.x.x (any port) and Host y.y.y.y (any port), over all protocols:
[Expert@HostName]# fw monitor -F "x.x.x.x,0,y.y.y.y,0,0" -F "y.y.y.y,0, x.x.x.x ,0,0" -o /var/log/fw_mon.cap
-
Capture traffic from any Source IP from Source Port X to any Destination IP to Destination Port Y, over all protocols:
[Expert@HostName]# fw monitor -F "0,x,0,y,0" -o /var/log/fw_mon.cap
-
Capture traffic between all hosts, between Port X and Port Y, over all protocols:
[Expert@HostName]# fw monitor -F "0,x,0,y,0" -F "0,y,0,x,0" -o /var/log/fw_mon.cap
-
Capture traffic between all hosts, between all ports, over a Protocol with assigned number X:
[Expert@HostName]# fw monitor -F "0,0,0,0,x" -o /var/log/fw_mon.cap
|
To capture only HTTP traffic between the Client 1.1.1.1 and the Server 2.2.2.2:
|