Thursday, August 4, 2016

FWM - Troubleshoot

Installation failure on MGNT server occurs in verification or complication stage of the installation.  To troubleshoot this failure, follow these steps:
               
1.       Install policy from the CLI
fwm –d load $FWDIR/conf/PolicyName.W <target>

2.       Install the policy from the SmartDashboard
a.       Clean the old log files
cd $FWDIR/log
rm fwm.elg

echo  ‘ ‘> fwm.elg
                               
enable the fwm debug
fw debug fwm on TDERROR_ALL_ALL=5
fw debug fwm on OPSEC_DEBUG_LEVEL=9
                                                                                          .
Replicate the problem by installing the policy from the Dashboard GUI
                                Stop the fwm debug on the FWMGMT  server
fw debug fwm off TDERROR_ALL_ALL=1
fw debug fwm off OPSEC_DEBUG_LEVEL=1

Debug output are stored in fwm.elg, located under $FWDIR/log.

Policy Installation failure could be result of SIC, Misconfigured rules, GUI client connectivity problems or improper entered information, expired license. Evaluate output file fwm.elg to determine with of these may have cause the failure.


Lab   Troubleshoot SIC   - Policy Installation failure

From A-SMS (FW Management Server)
1.       cpca_client lscert    (use this command to validate certificate)
2.       fw debug fwm on Establish
3.       from Client GUI DashBoard, attempt to restablish SIC
4.       from A-SMS     fw debug fwm off
5.       review debug log output        less $FWDIR/log/fwm.elg 
6.       WinSCP to transfer fwm.elg file  and view in Test Editor to identity source of problem from debug file


Lab   Troubleshoot MisConfigured Rules  - Policy Installation Failure

From A-SMS (FW Management Server)
1.       In Expert mode
cd  $FWDIR/log
echo >fwm.elg
fw debug fwm on

2.       fw debug fwm on
TDERROR_ALL_ALL
fwm –d load $FWDIR/conf/standard.W A-GW

Note: you will see the output on the screen and fwm.elg. you can see additional info if you do a TDERROR_ALL_ALL=5

Stop the debugs
fw debug fwm off
unset TDERROR_ALL_ALL
                view fwm.elg     less $FWDIR/conf/fwm.elg


Lab   Troubleshoot GUI Client Connectivity Problem 

Look at less $FWDIR/con/gui-client file for allowed IP address

From A-SMS (FW Management Server)
cpconfig command
At the prompt type 3 and enter
Type Y and Enter , Type D and Enter  (delete your IP to test failure)
Enter 10.20.59.250   (your IP address)
Exit cpconfig option 9 enter

From the command prompt type
fw debug fwm on TDERROR_ALL_ALL=5

from your Client 10.20.59.250  Dashboard, launch the GUI

from the FWM stop the debug and view logs of the GUI client IP
fw debug fwm off
grep 10.20.59.250 $FWDIR/log/fwm.elg | less





How to uninstall and install another policy on firewall

ISSUE

There may be a time where you install the wrong policy onto a Check Point Firewall. This can block your connections, and screw which traffic is allowed through the firewall.

RESOLUTION

These steps will show you how to remove and reinstall the correct policy via the CLI on the manager (SCS),

  1. First of all we look at the policy history, so we can find out the name of the policy we need to reinstall.

fw stat -l [firewall ip]

  2. Next we remove the security policy from the firewall.

fwm unload [fwname]

  3. Finally we install the correct policy back onto the Firewall.

Note : Note how we add the .W to the policy name as it has yet to be be compiled into a .cf file (which is what is installed onto the Firewall/Gateway)
[PolicyName].W is  uncompelled policy
[PolicyName].CF is compiled Policy

fwm load [PolicyName].W [fwname]
fwm load RuleBaseName.W TargetGatewayName


[Expert@MYFWM01]# fwm load Standard samplegw
Installing policy on R77 compatible targets:
Standard.W: Security Policy Script generated into CustomerPolicy.pf
Standard:
Compiled OK.
Installing Security Gateway policy on: examplegw . ..

Security Gateway policy installed successfully on examplegw. ..
Security Gateway policy installation complete
Security Gateway policy installation succeeded for: examplegw



Installation failed; reason – load on module failed, failed to load security policy
Recently I tried a policy installation on a Security Gateway appliance which failed with the message: Installation failed; reason - load on module failed, failed to load security policy

From my experience I know that a cpstop ; cpstart normaly solves this problem.

But since I was dealing with a remote site gateway which also was stand-alone installation, issuing cpstop was no option since it would interrupt the service.

So I utilized the cpwd_admin command for stopping and restarting FWM and CPD.

cpwd_admin stop -name FWM -path "$FWDIR/bin/fw" -command "fw kill fwm"
cpwd_admin start -name FWM -path "$FWDIR/bin/fwm" -command "fwm"

cpwd_admin stop -name CPD -path "$CPDIR/bin/cpd_admin" -command "cpd_admin stop"
cpwd_admin start -name CPD -path "$CPDIR/bin/cpd" -command "cpd"

Then I checked the status of all my services with cpwd_admin list.

All services were up and I tried policy installation again, which worked as expected.




I was able to solve the issue using the following steps i stumbled on while surfing the net:

1.            tellpm process:monitord
2.            ps aux | grep cpd
3.            kill -15
4.            tellpm process:monitord t
5.            cpwd_admin start -name CPD -path “$CPDIR/bin/cpd” -command “cpd”

Here is the expected output:
[Expert@CP-DMZ:0]# tellpm process:monitord
[Expert@CP-DMZ:0]#
Message from syslogd@ at Tue Sep 16 10:27:42 2014 …
CP-M-DMZ monitord[4129]: monitord got killed
[Expert@CP-DMZ:0]#
[Expert@CP-DMZ:0]# ps aux | grep cpd
admin 4461 0.0 0.3 212412 3196 ? Dsl Aug06 42:47 cpd
admin 6905 0.0 0.0 1816 492 pts/2 S+ 10:27 0:00 grep cpd

[Expert@CP-DMZ:0]# kill -15 4461

[Expert@CP-DMZ:0]#
[Expert@CP-DMZ:0]# tellpm process:monitord t

[Expert@CP-DMZ:0]#
[Expert@CP-DMZ:0]# cpwd_admin start -name CPD -path “$CPDIR/bin/cpd” -command “cpd”
cpwd_admin:
Process CPD started successfully (pid=7030)
[Expert@CP-DMZ:0]#

So the problem was solved without service interruption.

Wednesday, August 3, 2016

SSL Inspection - UserCheck


UserCheck  (Enable Block Pages)

SK100571  SK97951  SK100281    Check URL Categorization

Exceptions - via regular expression
----------------------------------
(.*\.|)logmein\.com
(.*\.|)dropbox\.com
(.*\.|)gotomeet\.me
(.*\.|)citrixonline\.com
*.gotomeet.me

Packet Flow


  1. Firewall Rules  - Firewall Rule base work on Layer 3 (IP/Networks) and Layer 4  (TCP Services)
  2. Application Blade  works on  Layer 5-6-7 
    1. IPS Blade - Streaming - Passive Streaming Session 


1. Checkpoint firewall object - Usercheck - Accessability - Edit- Through all Interfaces
2. Engine settings -  URL Filtering  uncheck (categorize HTTPS sites)  - must put back to allow other to w  Global Property
3. reset userset daemon
 # mpclient stop UserCheck
 # mpclient start UserCheck 

[Expert@mytestint-fwa:0]# mpclient stop UserCkeck
Exception: An exception has occurred during an RPC request: Portal not found
[Expert@mytestint-fwa:0]# mpclient stop UserCheck
Portal stopped
[Expert@mytestint-fwa:0]# mpclient start UserCheck
Portal started

[Expert@mytestint-fwa:0]# 


[Expert@mytestint-fwa:0]# ps -aux | grep UserCheck
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
admin    26902  0.0  0.0   1740   528 pts/2    S+   13:07   0:00 grep UserCheck
[Expert@mytestint-fwa:0]# 




sk100571 
Webpage does not redirect to UserCheck page

Symptom
  • When browsing to a block site, the site gets blocked however the page does not redirect to the UserCheck web page
Cause:
On SmartDashboard, the UserCheck Web Portal "Main URL" is configured with the incorrect IP. On a cluster, it is not configured as the virtual IP (VIP) of the cluster.


Solution
Change the UserCheck Web Portal "Main URL" to the correct IP address:
Open SmartDashboard > Edit Cluster/Gateway Object > UserCheck > Main URL
Once you have changed the Main URL, you will need to restart the UserCheck portal. From CLI run the following commands:
# mpclient stop UserCheck
# mpclient start UserCheck 


sk97951
UserCheck block page not displayed when accessing blocked site as per URL Filtering policy

Symptoms
  • UserCheck Block page is not displayed when users connect from the internal interfaces, even with the UserCheck portal or the Main URL field being configured as the primary URL for the web portal that shows the UserCheck notifications.
  • HTTPS Inspection and HTTP/HTTPS Proxy is not enabled on the Security Gateway.
Cause
In the Security Gateway object properties - "UserCheck" pane - "Accessibility" section - the option "Through internal interfaces" is selected. However, the option "Including DMZ internal interfaces" or the option "Including undefined internal interfaces" was not selected.
Solution
Follow these steps:
  1. Open Security Gateway object properties.
  2. Go to 'UserCheck' pane.
  3. In the 'Accessibility' section, click on 'Edit...' button.
  4. Configure the interfaces on the Security Gateway, through which the UserCheck portal can be accessed.

    Select the options below, according to where the users are connecting from, so they are redirected to the UserCheck portal:

    • Through all interfaces
    • Through internal interfaces

      • Including undefined internal interfaces - select this option, if users are connecting through the internal interfaces
      • Including DMZ internal interfaces - select this option, if users are connecting through the DMZ internal interface
      • Including VPN encrypted interfaces
    • According to the Firewall Policy (select this option if there is a rule that states who can access the portal)
  5. Click on 'OK' to apply the settings.
  6. Save the changes: go to 'File' menu - click on 'Save'.
  7. Install policy onto involved Security Gateways.


sk100281
Cannot access UserCheck page


Symptoms
  • When using Application Control and URL Filtering with UserCheck enabled, blocked websites are successfully blocked, however the browser does not redirect to the UserCheck page. It will also not be possible to directly browse to the UserCheck page based on the alias set up in SmartDashboard.
  • UserCheck connectivity debug (fw ctl zdebug + crypt) shows
    ;vm_mux_first_packet: Connection is for http(s)? = 1 (allow redirect = 1); ;vm_mux_first_packet: is mp port allowed? allow_80_443_ports = 0 or connection from internal interfaces = 0;
Cause
UserCheck is not enabled on the correct interfaces.
Solution
 To resolve this issue, perform one of the following two solutions:
  1. Navigate to 'Firewall object -> UserCheck -> Accessibility' and enable:
    Through Internal Interfaces:
    * Including VPN encrypted interfaces* including undefined internal interfaces* Including DMZ internal interface

     
  2. Navigate to 'Firewall object -> Topology -> Edit Topology'

    Confirm that the interfaces have been correctly configured as 'Internal' or 'External'. If an internal interface is misconfigured as an 'External' interface, UserCheck page will not be displayed. Only traffic from an 'Internal' interface will allow the UserCheck webpage to be displayed.
    The only exception would be if 
    UserCheck is configured to be displayed through 'All Interfaces' in 'Firewall object -> UserCheck -> Accessibility'.




Tuesday, August 2, 2016

CPView CPKstats

1) CPView.

sk101878 | CPView Utility

https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solutionid=sk101878&partition=General&product=Security


1a] To view a timestamp in history. We can also use this to verify against the times that the issue was reported.

# cpview -t <timestamp>

Example:
# cpview -t 01Mar2015 10:54:15


1b] When we are experiencing an issue with high CPU on a firewall worker.

Identify the worker.
# top

Go to CPView
# cpview

Advanced > CoreXL > Instances > Find the particular instance that we are seeing high CPU

'Statistics are NOT active (may affect performance). Press 'a' to activate.

You will then be prompted to type 'y' to proceed.

You should be able to scroll down in the instance pane and find the devices that are being handled by this firewall worker instance.

You can deactivate it by following the same steps to activate it.


1c] We can also look at the following areas to see what services may be causing this issue.

CPU > Top-Protocols > Instances > Find the particular instance that we are seeing high CPU

Network > Top-Connections (OR) Top-Protocols



2) CPKstats

Should we not be able to access CPView again, we can follow the below SK to get the same results.

sk103293 | How to get per CPU statistics and TOP FW-lock consumers with cpkstats

https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solutionid=sk103293&partition=Expert&product=CoreXL%22



3) The CPView database failed to upload for some reason and I was hoping that we could upload that one more time from each firewall.

# tar czvf /var/log/cpview_`hostname`.tgz /var/log/CPView_history/CPViewDB.dat

# cpinfo -n -f /var/log/cpview* -s 1-8319371181 -u <UserCenter Username>



4) The core dump that was generated was a User Check core dump and I'm not sure that it would cause the issue that we saw as the failover time where we lost all connections to the gateways did not add up to when the core dump was generated.

-----------------------
User Mode Core Dumps
-----------------------
total 45868
-rw-r--r-- 1 admin root 46912760 Jul 29 15:32 usrchkd.28001.core.gz

Wednesday, July 6, 2016

Index





  1. Class-A B C Address Guide
  2. Checkpoint Special Config Files
  3. Engineering Notebook
  4. Checklist to build a Checkpoint Firewall
  5. Advance Toubleshooting Techniques
  6. RMA or Rebuild a Checkpoint Firewall
  7. GAIA CLISH Command Lines
  8. NAT
  9. tcpdump
  10. How to Keep 10 varlogmessages files
  11. How to Customize -Upgrade
  12. Checkpoint Appliance Hardware
  13. Checkpoint Best Practice -How to Install
  14. Gaia In dept
  15. Checkpoint Bloggers
  16. Checkpoint Troubleshooting and Debugging

fw mon

The following lists the order in which the rules/policies/ACLs (whatever you may call it) are enforced in Check Point R75:-
I was just about to put some FW Monitor templates on my blog for quick reference when I need to troubleshoot some issues in Check Point but I thought it would be a nice thing to explain this first (for myself too, as I keep forgetting this stuff :D).
When traffic flows through a Check Point Security Gateway (look here if you want to know about the architecture) it has to cross a series of inspection points. This post tries to explain what those inspection points are and how to troubleshoot traffic flows based on the inspection points. The next post will show how to use the FW Monitor.

Inspection Points (in the order they are passed):

1sti – Pre-inboundrule/inspection is applied at this point
2ndI – Post-inboundafter being permitted by the rule/inspections
3rdo – Pre-outboundroute look up has been performed to determine the egress interface
4thO – Post-outboundafter egressing the correct firewall interface based on route lookup

Inspection Points
The above image shows how a firewall kernel protects the Check Point OS. The start and end depict the start and end of the originating traffic flow. The return traffic too goes through the same inspection points. The below diagram shows how a complete two-way traffic is treated by the inspection points.
Inspection Points for two-way traffic

For a complete two-way communicating traffic you should see 8 logs (also depends if you do want to see 8 or less)

So looking at the above diagram you see that a complete traffic flow of a two-way communication goes through 8 inspection points;
Originating traffic from A to B = 4 logs of iIoO
and the return traffic from B to A = 4 logs of iIoO
I you don’t want to see what is going on at the inspection points ‘I’ and ‘o’ then you only grep ‘i’ and ‘O’ and get 4 logs in total for a complete two-way traffic;
Originating traffic from A to B = 2 logs of iO
and the return traffic from B to A = 2 logs of iO

Sometimes you won’t see 8 logs for a complete two-way communicating traffic and will only see 4 logs

If you are grepping iIoO in your captures and you still don’t see a ‘I’ or ‘o’, but you do see a ‘i’ and an ‘O’, then most likely SecureXL is fast switching/accelerating the traffic because the initial packets of that flow were already allowed.
You can disable SecureXL while setting captures if you want to inspect them at that granularity (i.e ‘I’ and ‘o’). In my experience, disabling SecureXL hasn’t been a problem* and I haven’t seen any performance impact as such.
Right before the capture, turn off SecureXL on the gateway:
fwaccel off
Immediately after the capture, turn on SecureXL on the gateway:
fwaccel on
To turn on fw accel on multiple VSXs at once:
fwaccel on -a
*Do it at your own risk, I do not take any responsibility for anything going wrong with this as it does affect the live traffic immediately. Read the site disclaimer. :)

Troubleshooting the inspection points

Troubleshooting ‘i’ – When you don’t see any traffic on the ‘i’ inspection point:-
Traffic isn’t hitting your firewall. You won’t get back any captures and the console will just be a black blank screen (or any other background color you use on your terminal :D).
Troubleshooting ‘I’ – When you see traffic hitting the ‘i’ inspection point but don’t see it hitting ‘I’:-
The firewall is blocking that ingress traffic either by a rule, improper NAT, IP spoofing, Application Inspection or anything else that you can think of.
Troubleshooting ‘o’ – When you see an ‘i’ and ‘I’ but don’t see an ‘o’:-
I’m not very sure on this but in one case that I observed, there was a route missing for the destination in the routing table, so the route look up failed to determine an egress interface and I didn’t see the traffic hitting ‘o’ and it was stuck at ‘I’.
Troubleshooting ‘O’ – When you see an ‘i’, ‘I’ and ‘o’ but not an ‘O’:-
I too don’t know, please tell me what that would be and I’ll update it here. :) I think it might be some kind of inspection or something. But I’m quite sure it will be a very rare case.

FW Monitor

FW Monitor is the tool that can be used to see your traffic flowing through different inspection points. FW Monitor cannot give you the information what SmartviewTracker/Monitor can, because it is a wire capture. It just tells you what is on the wires and does not look into the rule base to see which policy allowed the traffic and was it NAT’d or not. So the Smartview Tracker and Monitor serves a slightly different purpose than the FW Monitor.
I’m writing a separate post on how to use the FW Monitor at it’s best and in different ways so you can be better at troubleshooting traffic flow issues in Check Point.
___________________________________________________________________________________________________________________________________________________________________________
If you see any mistakes in the post or have any suggestions to add to this post, please feel free to comment. Thank you!

fw_monitor


So to start off with, lets see what the different fields are in the above picture of a sample log from the console;
Virtual Firewall SystemThis shows the VSX from which the log was captured from. Depending on your hardware/software platform you may or may not see this field.
Firewall interfaceThis is the interface where the traffic was seen and captured.
Inspection PointThis can be either (i), (I), (o) or (O) based on what you are grepping when you setup the fw monitor. Read more about inspection points here.
Packet LengthThis is the size of the frame as seen “on the wire”
Source IPThe source
Destination IPThe destination
Header/PayloadThe type of header on that packet. Can either be TCP/UDP or something else in similar lines.
Packet IDThis is a unique number assigned to a packet until it is changed/altered in its course. Quite important when it comes to reading the fw monitor logs on your the console. (I also want to say this is locally significant on the firewall, but not very sure about it.)
Source PortThe source port
Destination PortThe destination port
TCP FlagsOne of the most important fields in my opinion. These are the TCP flags you have always know about. 6 bits are reserved for the TCP flags denoted by 6 dots (……) in the logs. Each dot is a TCP flag in this order FSRPA* = FIN-SYN-RST-PUSH-ACK-*** and I don’t know what the last one is, yet. So, you will usually see something like this for a SYN-ACK = .S..A. | RST = ..R.. | PUSH ACK = …PA. | Hope I made this simple enough for you to be able to interpret the TCP flags.
Sequence NumberThis is the sequence number that is the usual thing for TCP because of which it gets its name for being a reliable protocol.
Acknowledge Sequence NumberThis is again a part of its reliable behavior where the other end host responds to denote that it has received its previous packet.
Now that we know which field means what, let’s see how all of this fit together; Below is a complete set of logs for a two-way communication between two hosts (from the time it originates and gets back a reply from the destination). I omitted the (I) and (o) to minimize the amount of logs here so we’re only inspecting (i) pre-inbound and (O) post-outbound. We’ll take our time to analyze the logs and see what each set of packet ID means.
Logs on the console:

[vs_4][fw_0] wrp256:i[48]: 10.1.1.1 -> 20.2.2.2 (TCP) len=48 id=27361
TCP: 59255 -> 443 .S.... seq=6cc07657 ack=00000000
[vs_4][fw_0] bond31.69:O[48]: 10.1.1.1 -> 20.2.2.2 (TCP) len=48 id=27361
TCP: 59255 -> 443 .S.... seq=6cc07657 ack=00000000
[vs_4][fw_0] bond31.69:i[48]: 20.2.2.2 -> 10.1.1.1 (TCP) len=48 id=44853
TCP: 443 -> 59255 .S..A. seq=37a73c7d ack=6cc07658
[vs_4][fw_0] wrp256:O[48]: 20.2.2.2 -> 10.1.1.1 (TCP) len=48 id=44853
TCP: 443 -> 59255 .S..A. seq=37a73c7d ack=6cc07658
[vs_4][fw_0] wrp256:i[40]: 10.1.1.1 -> 20.2.2.2 (TCP) len=40 id=27386
TCP: 59255 -> 443 ....A. seq=6cc07658 ack=37a73c7e
[vs_4][fw_0] bond31.69:O[40]: 10.1.1.1 -> 20.2.2.2 (TCP) len=40 id=27386
TCP: 59255 -> 443 ....A. seq=6cc07658 ack=37a73c7e
[vs_4][fw_0] wrp256:i[158]: 10.1.1.1 -> 20.2.2.2 (TCP) len=158 id=27396
TCP: 59255 -> 443 ...PA. seq=6cc07658 ack=37a73c7e
[vs_4][fw_0] bond31.69:O[158]: 10.1.1.1 -> 20.2.2.2 (TCP) len=158 id=27396
TCP: 59255 -> 443 ...PA. seq=6cc07658 ack=37a73c7e
[vs_4][fw_0] bond31.69:i[87]: 20.2.2.2 -> 10.1.1.1 (TCP) len=87 id=45365
TCP: 443 -> 59255 ...PA. seq=37a73c7e ack=6cc076ce
[vs_4][fw_0] bond31.69:i[633]: 20.2.2.2 -> 10.1.1.1 (TCP) len=633 id=45621
TCP: 443 -> 59255 ...PA. seq=37a73cad ack=6cc076ce
[vs_4][fw_0] wrp256:O[87]: 20.2.2.2 -> 10.1.1.1 (TCP) len=87 id=45365
TCP: 443 -> 59255 ...PA. seq=37a73c7e ack=6cc076ce
[vs_4][fw_0] wrp256:O[633]: 20.2.2.2 -> 10.1.1.1 (TCP) len=633 id=45621
TCP: 443 -> 59255 ...PA. seq=37a73cad ack=6cc076ce
[vs_4][fw_0] wrp256:i[40]: 10.1.1.1 -> 20.2.2.2 (TCP) len=40 id=27478
TCP: 59255 -> 443 ....A. seq=6cc07a18 ack=37a7436b
[vs_4][fw_0] bond31.69:O[40]: 10.1.1.1 -> 20.2.2.2 (TCP) len=40 id=27478
TCP: 59255 -> 443 ....A. seq=6cc07a18 ack=37a7436b
[vs_4][fw_0] wrp256:i[40]: 10.1.1.1 -> 20.2.2.2 (TCP) len=40 id=27479
TCP: 59255 -> 443 F...A. seq=6cc07a18 ack=37a7436b
[vs_4][fw_0] bond31.69:O[40]: 10.1.1.1 -> 20.2.2.2 (TCP) len=40 id=27479
TCP: 59255 -> 443 F...A. seq=6cc07a18 ack=37a7436b
[vs_4][fw_0] bond31.69:i[40]: 20.2.2.2 -> 10.1.1.1 (TCP) len=40 id=11794
TCP: 443 -> 59255 ....A. seq=37a7436b ack=6cc07a19
[vs_4][fw_0] wrp256:O[40]: 20.2.2.2 -> 10.1.1.1 (TCP) len=40 id=11794
TCP: 443 -> 59255 ....A. seq=37a7436b ack=6cc07a19

Each packet ID is shown at different inspection points depending on how the fw monitor is set. In our example we are looking for only (i) pre-inbound and (O) post-outbound so we see two logs with the same packet ID. If we were looking for all 4 inspection points (iIoO) we would’ve seen 4 such logs with the same packet ID. Makes sense? Okay, let’s proceed…

Starting with the first packet ID 27361:

[vs_4][fw_0] wrp256:i[48]: 10.1.1.1 -> 20.2.2.2 (TCP) len=48 id=27361
TCP: 59255 -> 443 .S.... seq=6cc07657 ack=00000000
[vs_4][fw_0] bond31.69:O[48]: 10.1.1.1 -> 20.2.2.2 (TCP) len=48 id=27361
TCP: 59255 -> 443 .S.... seq=6cc07657 ack=00000000
The first log with packet ID 27361 was seen on the virtual firewall 4 on ingress interface wrp256 on the (i) pre-inbound inspection point. Requestor 10.1.1.1 has sent a SYN (.S….) to 20.2.2.2 to setup an HTTPS (443) connection. In the second log with the same packet ID we see the exact same information but the inspection point has changed here to (O) and the egress interface to bond31.69. This tells us the SYN packet was successfully passed through the firewall towards the destination IP. Keep an eye on the ‘seq’ and ‘ack’ numbers from now on.

Next packet ID 44853;

[vs_4][fw_0] bond31.69:i[48]: 20.2.2.2 -> 10.1.1.1 (TCP) len=48 id=44853T
CP: 443 -> 59255 .S..A. seq=37a73c7d ack=6cc07658[
vs_4][fw_0] wrp256:O[48]: 20.2.2.2 -> 10.1.1.1 (TCP) len=48 id=44853
TCP: 443 -> 59255 .S..A. seq=37a73c7d ack=6cc07658
This is the SYN-ACK (.S..A.) that responder 20.2.2.2 is sending back to the requestor  10.1.1.1. Notice how the ingress/egress interfaces are swapped now, since this is the exact opposite traffic flow, obviously. Now carefully compare the seq and ack number with that of the first packet ID 27361. Packet 27361 did not have an ack number since it was the first packet that was being sent but it did have a seq number 6cc07657 to which 44853 replied back incrementing it by ‘1’ in its ack – 6cc07658. It has also sent a seq number of 37a73c7d in the SYN-ACK, so in the next packet that will be an ACK from the requestor, we should see the ack number of 37a73c7e.

Next packet ID 27386;

[vs_4][fw_0] wrp256:i[40]: 10.1.1.1 -> 20.2.2.2 (TCP) len=40 id=27386
TCP: 59255 -> 443 ....A. seq=6cc07658 ack=37a73c7e
[vs_4][fw_0] bond31.69:O[40]: 10.1.1.1 -> 20.2.2.2 (TCP) len=40 id=27386
TCP: 59255 -> 443 ....A. seq=6cc07658 ack=37a73c7e
Look at the ack number 37a73c7e, it has incremented by 1 to the seq number of the previous packet. This keeps on going back and forth until this session is torn down. So if you don’t see proper seq and ack numbers in sync, it should tell you that you are missing some packets (that would result in seeing many re-transmissions and out-of-order logs in wireshark). So this is an ACK (….A.) response by the initiator (10.1.1.1) which now completes the TCP three-way handshake.

Next packet ID is 27396;

[vs_4][fw_0] wrp256:i[158]: 10.1.1.1 -> 20.2.2.2 (TCP) len=158 id=27396
TCP: 59255 -> 443 ...PA. seq=6cc07658 ack=37a73c7e
[vs_4][fw_0] bond31.69:O[158]: 10.1.1.1 -> 20.2.2.2 (TCP) len=158 id=27396
TCP: 59255 -> 443 ...PA. seq=6cc07658 ack=37a73c7e
Immediately after the three-way handshake, the requester sends its HTTPS request to the responder that we see in the PUSH-ACK messages (…PA.). You will also notice the packet length has changed since it now contains a good amount of payload (len=158).

Next packet IDs are 45365 and 45621;

[vs_4][fw_0] bond31.69:i[87]: 20.2.2.2 -> 10.1.1.1 (TCP) len=87 id=45365
TCP: 443 -> 59255 ...PA. seq=37a73c7e ack=6cc076ce
[vs_4][fw_0] bond31.69:i[633]: 20.2.2.2 -> 10.1.1.1 (TCP) len=633 id=45621
TCP: 443 -> 59255 ...PA. seq=37a73cad ack=6cc076ce
[vs_4][fw_0] wrp256:O[87]: 20.2.2.2 -> 10.1.1.1 (TCP) len=87 id=45365
TCP: 443 -> 59255 ...PA. seq=37a73c7e ack=6cc076ce
[vs_4][fw_0] wrp256:O[633]: 20.2.2.2 -> 10.1.1.1 (TCP) len=633 id=45621
TCP: 443 -> 59255 ...PA. seq=37a73cad ack=6cc076ce
The responder has replied back as we see the PUSH-ACKs going back to the requester and the packet length has a significant value.

Next packet ID is 27478;

[vs_4][fw_0] wrp256:i[40]: 10.1.1.1 -> 20.2.2.2 (TCP) len=40 id=27478
TCP: 59255 -> 443 ....A. seq=6cc07a18 ack=37a7436b
[vs_4][fw_0] bond31.69:O[40]: 10.1.1.1 -> 20.2.2.2 (TCP) len=40 id=27478
TCP: 59255 -> 443 ....A. seq=6cc07a18 ack=37a7436b
The requester 10.1.1.1 has replied back with an ACK to the HTTPS response it received from the responder in the earlier packets that were seen.

Next packet ID is 27479;

[vs_4][fw_0] wrp256:i[40]: 10.1.1.1 -> 20.2.2.2 (TCP) len=40 id=27479
TCP: 59255 -> 443 F...A. seq=6cc07a18 ack=37a7436b
[vs_4][fw_0] bond31.69:O[40]: 10.1.1.1 -> 20.2.2.2 (TCP) len=40 id=27479
TCP: 59255 -> 443 F...A. seq=6cc07a18 ack=37a7436b
The requester then sends a FIN-ACK telling the responder I’m done with my requests and I’ll close this session from my end.

Next packet ID is 11794;

[vs_4][fw_0] bond31.69:i[40]: 20.2.2.2 -> 10.1.1.1 (TCP) len=40 id=11794
TCP: 443 -> 59255 ....A. seq=37a7436b ack=6cc07a19
[vs_4][fw_0] wrp256:O[40]: 20.2.2.2 -> 10.1.1.1 (TCP) len=40 id=11794
TCP: 443 -> 59255 ....A. seq=37a7436b ack=6cc07a19
The responder acknowledges the closing of the session too and the connection comes to an end. Pheww.
Throughout all this traffic going back and forth, you want to keep an eye on the TCP flags as that is where you will see the most problems. Also when you want to troubleshoot packet loss, seq/ack numbers are your best friend and you want to track them very diligently.