Follow the packet inside an OCI Hub and Spoke VCN Routing architecture

From Iwan
Jump to: navigation, search

Instances, Databases, and OCI Network Services are the typical building blocks for your applications inside OCI. When you build an application on the network it is good practice to know if the traffic you are sending from a source is reaching the destination. OCI offers the Network Path Analyser to verify the path, but sometimes you want to have a bit more information on what is happening on the endpoints itself on a hop-by-hop basis.

This tutorial will provide a few techniques that you can use to follow your packets in a Hub and Spoke Network Architecture inside OCI.

E7c48c668d9cb80ee9554c696df464bb.png

  • The different routing flow scenarios

Multiple routing flow scenarios are applicable in a Hub and Spoke routing architecture that are all listed below.

  • SCENARIO 01: SPOKE INSTANCE > SPOKE INSTANCE
  • SCENARIO 02: SPOKE INSTANCE > HUB INSTANCE
  • SCENARIO 03: HUB INSTANCE > SPOKE INSTANCE
  • SCENARIO 04: SPOKE INSTANCE > INTERNET
  • SCENARIO 05: SPOKE INSTANCE > OCI SERVICE NETWORK
  • SCENARIO 06: HUB > INTERNET
  • SCENARIO 07: INTERNET > HUB
  • SCENARIO 08: ON-PREM > SPOKE INSTANCE
  • SCENARIO 09: SPOKE INSTANCE > ON-PREM
  • SCENARIO 10: EXTERNAL > LB > SPOKE INSTANCE

In this tutorial, we are only going to fully explain how you can follow the packet with SCENARIO 0# For the other SCENARIOS, you can use the same method and this will be a lot of repetition explaining the same thing over and over again.

SCENARIO 01: SPOKE INSTANCE > SPOKE INSTANCE

In this scenario we are going to follow the packet from one Spoke VCN Instance to an Instance in another Spoke VCN.

The diagram is shown below, with the hops specified.

The A - F markers indicate the places where you can enable some form of logging or packet capturing. We will explore all these places one by one so we can follow the packet.

The diagram

874e84976025f821853536fc0edb35a4.png

The Steps

Before we start we need to determine our source and destination and the port that we are going to test with. This will ensure we have a targeted way of analyzing the packet without too much distraction.

In this example, we are using the following:

Source Destination Destination Port
172.16.1.93 172.16.2.88 TCP/80

To properly start this journey, the order of operations is important to be as effective as possible with setting up the logging and capturing and collecting the information properly.

Below are the steps that I followed to collect all the data that was required for my defined source and destination.

  • [ ] STEP 01: Note down the time.
  • [ ] STEP 02: Open the first SSH session on Instance A.
  • [ ] STEP 03: Open a second SSH session on Instance A.
  • [ ] STEP 04: Open an SSH session on Instance B.
  • [ ] STEP 05: Open a WEB session on the pfSense Firewall (navigate to the packet capture page).
  • [ ] STEP 06: Enable logging (ALL LOGS) on the Spoke A Private Subnet.
  • [ ] STEP 07: Enable logging (ALL LOGS) on the Spoke B Private Subnet.
  • [ ] STEP 08: Enable logging (ALL LOGS) on the Hub Private Subnet.
  • [ ] STEP 09: On the second SSH session on Instance A start the TCP dump session.
  • [ ] STEP 10: On the SSH session on Instance B start the TCP dump session.
  • [ ] STEP 11: On the pfSense Firewall start the packet capture.
  • [ ] STEP 12: On the first SSH session on Instance A do a CURL to the Instance B web server.
  • [ ] STEP 13: Look at all the logging and packet captures (and follow the path).

We will go over each step one by one and look at the results.

STEP 01: Note down the time

  1. I am using a central Computer to collect all the data.
  2. Note down the time when you start the analytics (In my case this is now 8.44 AM).

400eebe2a6657ecc00bf19b1a0239f74.png

STEP 02: Open the first SSH session on Instance A

  • We will use this session to initiate the HTTP connection to the destination.
  1. Connect with SSH to the terminal of Instance A located in VCN A.
  2. Try to use a tabbed connection. This enables quick switching between the sessions.
  3. Issue the command `timedatectl` to get the current time of the Instance.
  4. Make sure the time set is ok. (In my case this is now 8.44 AM).

424e6a5d8e5865fab0e2f0783eead846.png

STEP 03: Open a second SSH session on Instance A

  • Open a SECOND connection to the Instance A located in VCN A.
  • We will use this session to enable the TCPdump commands so we can start the packet following using TCPdump.

A6c32b9846d5ec02c155c9d20d3fbfcb.png

STEP 04: Open an SSH session on Instance B

  • We will use this session to receive the HTTP connection from the source.
  1. Connect with SSH to the terminal of Instance B located in VCN B.
  2. Try to use a tabbed connection. This enables quick switching between the sessions.
  3. Issue the command `timedatectl` to get the current time of the Instance.
  4. Make sure the time set is ok. (In my case this is now 8.45 AM).

390ec577be9d562ceaad7ea08a493288.png

STEP 05: Open a WEB session on the pfSense Firewall (navigate to the packet capture page)

  • Because we are using a Hub and Spoke routing architecture the traffic will transit the pfSense firewall if traffic is flowing from one Spoke to another Spoke. The pfSense firewall will either permit or deny the traffic. We want to see this in the pfSense firewall using the packet captures.
  1. Open the management console of the pfSense Firewall.
  2. Click on Diagnostics > Packet Capture.

1630c25661813672d55a53654a262fcd.png

  • Make sure you have the pfSense Firewall diagnostics/packet capture screen open.
  • DO NOT START the packet capture yet, we just want to have it open.

Cacd8958f8ceb9044917cf818d0f4932.png

STEP 06: Enable logging (ALL LOGS) on the Spoke A Private Subnet

  • Because our source is attached to the Private Subnet in the Spoke A VCN we will enable logging on the Subnet level in the VCN.
  1. Click on the hamburger menu in the OCI console.
  2. Click on Networking.
  3. Click on Virtual cloud networks.

C30666eb6e5e2da1e2daeb663e5d63ef.png

  • Click on the Spoke A VCN.

D44f1264b0584680a0cab86fdd585167.png

  • Click on the Private Subnet inside VCN A.

5cbf0c50182e01cc577fafb5cde351f1.png

  1. Click on Logs.
  2. Toggle the Enable Log switch for all logs and set it to enabled.

D6b921ea0e1694b90286224c462640fb.png

  • Leave all log settings default and click on the Enable log button.

E20e080abb2e7d3ce6343f639381e1f5.png

  • Notice that the Status will change to Creating.

E24ca73cc2bde7edea140197eeadd236.png

  1. Notice that the Status will change from Creating to Active.
  2. Notice that the Enable log switch for all is now Enabled.

5215f3bcb88326b328598a3db1d243da.png

STEP 07: Enable logging (ALL LOGS) on the Spoke B Private Subnet

  • Follow the same steps as you did (in STEP 06) to enable the logs for the Private Subnet in the Spoke VCN A, but now do it for the Spoke VCN B Private Subnet.
  1. Follow the path: Networking > Virtual Cloud Networking > Spoke B VCN > Subnet Details > Logs.
  2. Make sure that the Status is set to Active.
  3. Make sure the Enable log switch for all is Enabled.

5fc74fb54e25661d3f1b861571b679e9.png

STEP 08: Enable logging (ALL LOGS) on the Hub Private Subnet

  • Follow the same steps as you did (in STEP 06) to enable the logs for the Private Subnet in the Spoke VCN A, but now do it for the Spoke VCN B Private Subnet.
  1. Follow the path: Networking > Virtual Cloud Networking > Hub VCN > Subnet Details > Logs.
  2. Make sure that the Status is set to Active.
  3. Make sure the Enable log switch for all is Enabled.

38107a474510a79308415d4db71bd2df.png

STEP 09: On the second SSH session on Instance A start the TCP dump session

  • Switch back to the second SSH Session of Instance A.
  • Issue the following command to enable TCPdump: `sudo tcpdump -i ens3 dst 172.16.2.88 and src 172.16.1.93 and dst port 80`
  • Notice that TCPdump will be enabled.
  • When using the TCPdump command make sure you use proper filters, so you ONLY see information on the traffic you are looking for. Here I specified the source, destination, and port.

Ee5fe719ffeb1c864f69a17965aaa5ea.png

STEP 10: On the SSH session on Instance B start the TCP dump session

  • Switch back to the SSH Session of Instance B.
  • Issue the following command to enable TCPdump: `sudo tcpdump -i ens3 src 172.16.0.20 and port 80`
  • Notice that TCPdump will be enabled.

279f044d8d9e42235308d7ad223d3f4e.png`

STEP 11: On the pfSense Firewall start the packet capture.

  • Switch back to the pfSense Firewall console.
  • Scroll down to the Custom Filter Options section.
  • In the Untagged Filter section:
    • Select: include any of.
    • For the destination: Select all of and specify 172.16.2.88.
    • For the port: Select any of and specify 80.
  • Click on the Start button.

Dfb051e22dbb435e72d72504c332d6f8.png

  • Scroll down.

2896d1ef09efe5274ae962bc9f201978.png

  • Notice that there are already packets captured.
  • This will be ALL traffic that is on port 80 and that is for our destination IP address (172.16.2.88).
  • There is already traffic visible because I have a load balancer active that is doing health checks on port 80 as well.
  • We will leave the capture on for a few minutes while we do our HTTP test from our source so that we can use the Wireshark application later to filter out the correct information that we are looking for.

Cd290b818ea3f6817e8c5d2f6952561e.png

STEP 12: On the first SSH session on Instance A do a CURL to the Instance B web server

  • After preparing ALL the TCPdumps, packet captures, and logging it is finally time to initiate traffic from our source to our destination.
  • Switch back to the first SSH Session of Instance A.
  • Issue the command `timedatectl` again to get the current time of the Instance.
  • Make a note of the time. (In my case this is now 8.56 AM).

906aab140d8415f3ffb5e5399c558450.png

  • Issue the following command to send HTTP traffic: `curl http://172.16.2.88`
  • Notice that the web server on Instance B is replying with the HTML content.

89d26e1d7538377c14396eac9518901f.png

  • Repeat the process by issuing the following command three or four times to send HTTP traffic multiple times: `curl http://172.16.2.88`

380a06ef7dc89dc5127cced1062238bb.png

STEP 13: Look at all the logging and packet captures (and follow the path)

Now that we have all the information we need we can start collecting the information so we can follow the packet.

Stop all logging, packet captures, and TCP dumps

  • Before we start the collection let's first STOP all the logging, packet captures and TCP dumps just to make sure we do not get too much information.
  • Switch back to the second SSH Session of Instance A and press CNTRL + C to stop TCP DUMP.
  • Switch back to the SSH Session of Instance B and press CNTRL + C to stop TCP DUMP.
  • Switch back to the pfSense Firewall management console and stop the packet capture.

6ecfd1b4ffb5b56f2845951b540e5b2d.png

  • On the Subnets Disable Logging.
  1. Follow the path: Networking > Virtual Cloud Networking > Hub VCN > Subnet Details > Logs.
  2. Disable the logging for all by toggling the switch.

Bb6d277333295a4b16ce7fe2e8cc916e.png

  • The status will change to updating.

45006a5aafb799556e85c9d43e28b9d3.png

  • The status will change from updating to inactive.

7eb90f25c4c9c2d740a7416498b75a0b.png

  • Follow the path: Networking > Virtual Cloud Networking > Spoke VCN A > Subnet Details > Logs.
  • Make sure that the Status is set to Inactive.
  • Make sure the Enable log switch for all is Disabled.

F6a27fd4a073e62607c1743490d4a005.png

  • Follow the path: Networking > Virtual Cloud Networking > Spoke VCN B > Subnet Details > Logs.
  • Make sure that the Status is set to Inactive.
  • Make sure the Enable log switch for all is Disabled.

E98df25a376bda6c8256470107e02cbe.png

  • Now that we have disabled all the logging, packet captures and TCP dumps it is time to finally look at the data.

The diagram (with logging points)

On the diagram, you will find the points of logging and these are all marked with A, B, C, D, E, and F. This makes it easier to follow along.

874e84976025f821853536fc0edb35a4.png

Logging Point A (on diagram) - (TCP Dump on Instance A)

  1. Switch back to the second SSH Session of Instance A.
  2. Notice the TCP dump output that was generated.

Dd4ec634d5c648c238daef57a77e2b40.png

I have copied/pasted the full raw output below so you can have a look.

[opc@ih-instance-vcn-a ~]$ sudo tcpdump -i ens3 dst 172.16.2.88 and src 172.16.1.93 and dst port 80
dropped privs to tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens3, link-type EN10MB (Ethernet), capture size 262144 bytes
08:56:50.489159 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.57422 > 172.16.2.88.http: Flags [S], seq 1817516973, win 62720, options [mss 8960,sackOK,TS val 3736091466 ecr 0,nop,wscale 7], length
0
08:56:50.491649 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.57422 > 172.16.2.88.http: Flags [.], ack 372277210, win 490, options [nop,nop,TS val 3736091468 ecr 671349263], length 0
08:56:50.491702 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.57422 > 172.16.2.88.http: Flags [P.], seq 0:75, ack 1, win 490, options [nop,nop,TS val 3736091468 ecr 671349263], length 75: HTTP: GET / HTTP/1.1
08:56:50.492114 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.57422 > 172.16.2.88.http: Flags [.], ack 239, win 489, options [nop,nop,TS val 3736091469 ecr 671349265], length 0
08:56:50.492210 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.57422 > 172.16.2.88.http: Flags [.], ack 873, win 485, options [nop,nop,TS val 3736091469 ecr 671349265], length 0
08:56:50.492982 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.57422 > 172.16.2.88.http: Flags [F.], seq 75, ack 873, win 485, options [nop,nop,TS val 3736091469 ecr 671349265], length 0
08:56:50.493488 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.57422 > 172.16.2.88.http: Flags [.], ack 874, win 485, options [nop,nop,TS val 3736091470 ecr 671349267], length 0
08:57:09.284210 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54210 > 172.16.2.88.http: Flags [S], seq 3049648180, win 62720, options [mss 8960,sackOK,TS val 3736110261 ecr 0,nop,wscale 7], length
0
08:57:09.284913 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54210 > 172.16.2.88.http: Flags [.], ack 728296369, win 490, options [nop,nop,TS val 3736110261 ecr 671368058], length 0
08:57:09.284973 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54210 > 172.16.2.88.http: Flags [P.], seq 0:75, ack 1, win 490, options [nop,nop,TS val 3736110261 ecr 671368058], length 75: HTTP: GET / HTTP/1.1
08:57:09.285422 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54210 > 172.16.2.88.http: Flags [.], ack 239, win 489, options [nop,nop,TS val 3736110262 ecr 671368059], length 0
08:57:09.285522 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54210 > 172.16.2.88.http: Flags [.], ack 873, win 485, options [nop,nop,TS val 3736110262 ecr 671368059], length 0
08:57:09.285590 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54210 > 172.16.2.88.http: Flags [F.], seq 75, ack 873, win 485, options [nop,nop,TS val 3736110262 ecr 671368059], length 0
08:57:09.286060 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54210 > 172.16.2.88.http: Flags [.], ack 874, win 485, options [nop,nop,TS val 3736110263 ecr 671368059], length 0
08:57:10.963760 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54214 > 172.16.2.88.http: Flags [S], seq 1863177286, win 62720, options [mss 8960,sackOK,TS val 3736111940 ecr 0,nop,wscale 7], length
0
08:57:10.964504 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54214 > 172.16.2.88.http: Flags [.], ack 464215720, win 490, options [nop,nop,TS val 3736111941 ecr 671369737], length 0
08:57:10.964551 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54214 > 172.16.2.88.http: Flags [P.], seq 0:75, ack 1, win 490, options [nop,nop,TS val 3736111941 ecr 671369737], length 75: HTTP: GET / HTTP/1.1
08:57:10.965048 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54214 > 172.16.2.88.http: Flags [.], ack 239, win 489, options [nop,nop,TS val 3736111942 ecr 671369738], length 0
08:57:10.965135 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54214 > 172.16.2.88.http: Flags [.], ack 873, win 485, options [nop,nop,TS val 3736111942 ecr 671369738], length 0
08:57:10.965351 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54214 > 172.16.2.88.http: Flags [F.], seq 75, ack 873, win 485, options [nop,nop,TS val 3736111942 ecr 671369738], length 0
08:57:10.965865 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.54214 > 172.16.2.88.http: Flags [.], ack 874, win 485, options [nop,nop,TS val 3736111942 ecr 671369739], length 0
08:58:23.663598 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.53200 > 172.16.2.88.http: Flags [S], seq 407465876, win 62720, options [mss 8960,sackOK,TS val 3736184640 ecr 0,nop,wscale 7], length 0
08:58:23.664381 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.53200 > 172.16.2.88.http: Flags [.], ack 3047424129, win 490, options [nop,nop,TS val 3736184641 ecr 671442437], length 0
08:58:23.664430 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.53200 > 172.16.2.88.http: Flags [P.], seq 0:75, ack 1, win 490, options [nop,nop,TS val 3736184641 ecr 671442437], length 75: HTTP: GET / HTTP/1.1
08:58:23.665005 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.53200 > 172.16.2.88.http: Flags [.], ack 239, win 489, options [nop,nop,TS val 3736184641 ecr 671442438], length 0
08:58:23.665129 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.53200 > 172.16.2.88.http: Flags [.], ack 873, win 485, options [nop,nop,TS val 3736184642 ecr 671442438], length 0
08:58:23.665297 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.53200 > 172.16.2.88.http: Flags [F.], seq 75, ack 873, win 485, options [nop,nop,TS val 3736184642 ecr 6714
08:58:23.666655 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [.], ack 874, win 485, options [nop,nop,TS val 3736184643 ecr 671442440], l
08:58:24.529502 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [S], seq 3610633804, win 62720, options [mss 8960,sackOK,TS val 3736185506
0
08:58:24.530337 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [.], ack 575035162, win 490, options [nop,nop,TS val 3736185507 ecr 6714433
08:58:24.530386 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [P.], seq 0:75, ack 1, win 490, options [nop,nop,TS val 3736185507 ecr 6714
 / HTTP/1.1
08:58:24.530886 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [.], ack 239, win 489, options [nop,nop,TS val 3736185507 ecr 671443304], l
08:58:24.530966 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [.], ack 873, win 485, options [nop,nop,TS val 3736185507 ecr 671443304], l
08:58:24.531347 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [F.], seq 75, ack 873, win 485, options [nop,nop,TS val 3736185508 ecr 6714
08:58:24.531891 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [.], ack 874, win 485, options [nop,nop,TS val 3736185508 ecr 671443305], l
08:58:25.562327 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [S], seq 3415948315, win 62720, options [mss 8960,sackOK,TS val 3736186539
0
08:58:25.563186 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [.], ack 2043572435, win 490, options [nop,nop,TS val 3736186540 ecr 671444
08:58:25.563244 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [P.], seq 0:75, ack 1, win 490, options [nop,nop,TS val 3736186540 ecr 6714
 / HTTP/1.1
08:58:25.563718 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [.], ack 239, win 489, options [nop,nop,TS val 3736186540 ecr 671444337], l
08:58:25.563845 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [.], ack 873, win 485, options [nop,nop,TS val 3736186540 ecr 671444337], l
08:58:25.564627 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [F.], seq 75, ack 873, win 485, options [nop,nop,TS val 3736186541 ecr 6714
08:58:25.565113 IP ih-instance-vcn-a.ihprivatesubnet.spokevcna.oraclevcn.com.5
gs [.], ack 874, win 485, options [nop,nop,TS val 3736186542 ecr 671444338], l

When we filter out the lines (and analyze what is happening) we get something like this:

  1. The first output section of the curl request that was made.
  2. The second output section of the curl request that was made.
  3. The source DNS/IP.
  4. The destination DNS/IP.
  5. The port.
  6. The TCP Flags.

Ed709c213c8250106753ff8b5b0eae69.png

This output indicates that HTTP traffic was sent OUT of Instance A.

Logging Point B (on diagram) - (Logging on the Spoke VCN A Private Subnet)

Now it's time to also look at the subnet level logging to see IF the packets are also visible on the VCN's subnet.

  • Navigate to Networking > Virtual cloud networks > Spoke VCN A > (Private) Subnet Details > Logs.
  • Click on the log name for the all category.

Cb5ecdcd76c9b70c90121547ee96a65c.png

  1. Click on the Actions dropdown menu.
  2. Click on Explore with Log Search.

Be1732e449044b77a026dcfbe93b91ae.png

In the Custom filters specify the following filters:

    • `data.destinationAddress='172.16.2.88'`
    • `data.sourceAddress='172.16.1.93'`

F6165f2dcbc278b9930ec43a11362baf.png

  • The filter for the destination is now added.

859e303c86bb9fa046474f13d883848b.png

  • The filter for the source is now added.

10ed788a7f9ecc46cbdcdbf3d6be791c.png

  1. Change the filter by time to Past hour.
  2. Note that the bar chart indicates that there is log data available for the source and destination we use in the filter.
  3. Scroll down.

55eea5d386a060f890b8d48370d89828.png

  1. Notice the source IP.
  2. Notice the destination IP.
  3. Notice the port.

Fdd1d1c03ff416e2a494d14976297532.png

  1. Scroll up.
  2. Click on Logs.

D75aeb2a92f4b6b066a36cd7656498a8.png

Logging Point C (on diagram) - (Logging on the Hub VCN Private Subnet)

  • Click on the Log name for the Hub VCN.

Ef49a6d5ee7244f3747db1ce0367c7fa.png

  • Because the traffic is not going from the firewall to the Instance B VCN we need to change the source and destination filters here.
  1. In the Custom filters specify the following filters:
    1. `data.destinationAddress='172.16.0.20'
    2. `data.sourceAddress='172.16.1.93'`
    3. `data.destinationPort='80'`
  2. Note that the bar chart indicates that there is log data available for the source and destination we use in the filter.
  3. Scroll down.

Dcceca4e0aed75dfd56c1978bb41f11f.png

  1. Notice the detailed logging section.
  2. Notice the source IP.
  3. Notice the destination IP.
  4. Notice the port.

Daf5558da1f855308c21ffdafae08941.png

Logging Point D (on diagram) - (Packet capture on the pfSense Firewall)

  1. Switch back to the pfSense Firewall management console and click on the download button.
  2. Make sure the capture is downloaded.

7da90b15f1ce93efd934c2a981115fb4.png

  • Open the packet capture in the Wireshark application.
  1. Specify the following Wireshark filter:
    1. `(ip.dst == 172.16.2.88 && ip.src == 172.16.1.93) || (ip.dst == 172.16.2.88 && ip.src == 172.16.1.93) && http`
  2. Notice the source IP.
  3. Notice the destination IP.
  4. Notice the port/Protocol.

8c0cfba7af3dfc9929df250f2e92af75.png

Logging Point E (on diagram) - (Logging on the Spoke VCN B Private Subnet)

  • Navigate to Logging > Logs.
  • Click on the Log name for the Spoke VCN B.

Cef09314afbb8ba53883fdbdf8fc177b.png

  1. Click on the Actions dropdown menu.
  2. Click on Explore with Log Search.

9127b7a535fbf7e08c1a0ec5af2b6327.png

  1. In the Custom filters specify the following filters:
    1. `data.destinationAddress='172.16.2.88'`
    2. `data.sourceAddress='172.16.0.20'`
  2. Note that the bar chart indicates that there is log data available for the source and destination we use in the filter.
  3. Scroll down.

6fb03fc7b7754b13877403420ff67e20.png

  1. Notice the detailed logging section.
  2. Notice the source IP.
  3. Notice the destination IP.
  4. Notice the port.

6546f2dd38adda92a54af7da4435cc07.png

Logging Point F (on diagram) * (TCP Dump on Instance B)

  1. Switch back to the SSH Session of Instance B.
  2. Notice the TCP dump output that was generated.

E5af556474668179170c6a96f2f69b94.png

I have copied/pasted the full raw output below so you can have a look.

[opc@ih-instance-vcn-b ~]$ sudo tcpdump -i ens3 src 172.16.0.20 and port 80
dropped privs to tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens3, link-type EN10MB (Ethernet), capture size 262144 bytes
08:56:50.489551 IP 172.16.0.20.23408 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [S], seq 1817516973, win 62720, options [mss 8960,sackOK,TS val 3736091466 ecr 0,nop,wscale 7], length
0
08:56:50.491813 IP 172.16.0.20.23408 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 372277210, win 490, options [nop,nop,TS val 3736091468 ecr 671349263], length 0
08:56:50.491849 IP 172.16.0.20.23408 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [P.], seq 0:75, ack 1, win 490, options [nop,nop,TS val 3736091468 ecr 671349263], length 75: HTTP: GET / HTTP/1.1
08:56:50.492311 IP 172.16.0.20.23408 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 239, win 489, options [nop,nop,TS val 3736091469 ecr 671349265], length 0
08:56:50.492327 IP 172.16.0.20.23408 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 873, win 485, options [nop,nop,TS val 3736091469 ecr 671349265], length 0
08:56:50.493247 IP 172.16.0.20.23408 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [F.], seq 75, ack 873, win 485, options [nop,nop,TS val 3736091469 ecr 671349265], length 0
08:56:50.493667 IP 172.16.0.20.23408 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 874, win 485, options [nop,nop,TS val 3736091470 ecr 671349267], length 0
08:57:09.284597 IP 172.16.0.20.22060 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [S], seq 3049648180, win 62720, options [mss 8960,sackOK,TS val 3736110261 ecr 0,nop,wscale 7], length
0
08:57:09.285040 IP 172.16.0.20.22060 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 728296369, win 490, options [nop,nop,TS val 3736110261 ecr 671368058], length 0
08:57:09.285102 IP 172.16.0.20.22060 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [P.], seq 0:75, ack 1, win 490, options [nop,nop,TS val 3736110261 ecr 671368058], length 75: HTTP: GET / HTTP/1.1
08:57:09.285534 IP 172.16.0.20.22060 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 239, win 489, options [nop,nop,TS val 3736110262 ecr 671368059], length 0
08:57:09.285641 IP 172.16.0.20.22060 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 873, win 485, options [nop,nop,TS val 3736110262 ecr 671368059], length 0
08:57:09.285855 IP 172.16.0.20.22060 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [F.], seq 75, ack 873, win 485, options [nop,nop,TS val 3736110262 ecr 671368059], length 0
08:57:09.286211 IP 172.16.0.20.22060 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 874, win 485, options [nop,nop,TS val 3736110263 ecr 671368059], length 0
08:57:10.964151 IP 172.16.0.20.47275 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [S], seq 1863177286, win 62720, options [mss 8960,sackOK,TS val 3736111940 ecr 0,nop,wscale 7], length
0
08:57:10.964645 IP 172.16.0.20.47275 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 464215720, win 490, options [nop,nop,TS val 3736111941 ecr 671369737], length 0
08:57:10.964694 IP 172.16.0.20.47275 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [P.], seq 0:75, ack 1, win 490, options [nop,nop,TS val 3736111941 ecr 671369737], length 75: HTTP: GET / HTTP/1.1
08:57:10.965157 IP 172.16.0.20.47275 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 239, win 489, options [nop,nop,TS val 3736111942 ecr 671369738], length 0
08:57:10.965243 IP 172.16.0.20.47275 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 873, win 485, options [nop,nop,TS val 3736111942 ecr 671369738], length 0
08:57:10.965612 IP 172.16.0.20.47275 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [F.], seq 75, ack 873, win 485, options [nop,nop,TS val 3736111942 ecr 671369738], length 0
08:57:10.966035 IP 172.16.0.20.47275 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 874, win 485, options [nop,nop,TS val 3736111942 ecr 671369739], length 0
08:58:23.664041 IP 172.16.0.20.16336 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [S], seq 407465876, win 62720, options [mss 8960,sackOK,TS val 3736184640 ecr 0,nop,wscale 7], length 0
08:58:23.664613 IP 172.16.0.20.16336 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 3047424129, win 490, options [nop,nop,TS val 3736184641 ecr 671442437], length 0
08:58:23.664620 IP 172.16.0.20.16336 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [P.], seq 0:75, ack 1, win 490, options [nop,nop,TS val 3736184641 ecr 671442437], length 75: HTTP: GET / HTTP/1.1
08:58:23.665349 IP 172.16.0.20.16336 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 239, win 489, options [nop,nop,TS val 3736184641 ecr 671442438], length 0
08:58:23.666335 IP 172.16.0.20.16336 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 873, win 485, options [nop,nop,TS val 3736184642 ecr 671442438], length 0
08:58:23.666344 IP 172.16.0.20.16336 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [F.], seq 75, ack 873, win 485, options [nop,nop,TS val 3736184642 ecr 671442438], length 0
08:58:23.666816 IP 172.16.0.20.16336 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 874, win 485, options [nop,nop,TS val 3736184643 ecr 671442440], length 0
08:58:24.529970 IP 172.16.0.20.27720 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [S], seq 3610633804, win 62720, options [mss 8960,sackOK,TS val 3736185506 ecr 0,nop,wscale 7], length
0
08:58:24.530465 IP 172.16.0.20.27720 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 575035162, win 490, options [nop,nop,TS val 3736185507 ecr 671443303], length 0
08:58:24.530545 IP 172.16.0.20.27720 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [P.], seq 0:75, ack 1, win 490, options [nop,nop,TS val 3736185507 ecr 671443303], length 75: HTTP: GET / HTTP/1.1
08:58:24.531020 IP 172.16.0.20.27720 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 239, win 489, options [nop,nop,TS val 3736185507 ecr 671443304], length 0
08:58:24.531079 IP 172.16.0.20.27720 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 873, win 485, options [nop,nop,TS val 3736185507 ecr 671443304], length 0
08:58:24.531619 IP 172.16.0.20.27720 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [F.], seq 75, ack 873, win 485, options [nop,nop,TS val 3736185508 ecr 671443304], length 0
08:58:24.532042 IP 172.16.0.20.27720 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 874, win 485, options [nop,nop,TS val 3736185508 ecr 671443305], length 0
08:58:25.562872 IP 172.16.0.20.33101 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [S], seq 3415948315, win 62720, options [mss 8960,sackOK,TS val 3736186539 ecr 0,nop,wscale 7], length
0
08:58:25.563301 IP 172.16.0.20.33101 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 2043572435, win 490, options [nop,nop,TS val 3736186540 ecr 671444336], length 0
08:58:25.563424 IP 172.16.0.20.33101 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [P.], seq 0:75, ack 1, win 490, options [nop,nop,TS val 3736186540 ecr 671444336], length 75: HTTP: GET / HTTP/1.1
08:58:25.563812 IP 172.16.0.20.33101 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 239, win 489, options [nop,nop,TS val 3736186540 ecr 671444337], length 0
08:58:25.563960 IP 172.16.0.20.33101 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 873, win 485, options [nop,nop,TS val 3736186540 ecr 671444337], length 0
08:58:25.564877 IP 172.16.0.20.33101 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [F.], seq 75, ack 873, win 485, options [nop,nop,TS val 3736186541 ecr 671444337], length 0
08:58:25.565259 IP 172.16.0.20.33101 > ih-instance-vcn-b.ihprivatesubnet.spokevcnb.oraclevcn.com.http: Flags [.], ack 874, win 485, options [nop,nop,TS val 3736186542 ecr 671444338], length 0
  1. The first output section of the curl request that was made.
  2. The second output section of the curl request that was made.
  3. The third output section of the curl request that was made.
  4. The source DNS/IP.
  5. The destination DNS/IP.
  6. The port.
  7. The TCP Flags.

9aa69c0f77b19034287491228e8d23dc.png

This output indicates that HTTP traffic was received from the Hub FW IP.

Other scenario drawings

Below you will find the diagrams for the other scenarios. The way of collecting the logs, packet captures and TCPdumps will be the same.

SCENARIO 02: SPOKE INSTANCE > HUB INSTANCE

The diagram

F100f7ec86307270fb110ac0d854345c.png

SCENARIO 03: HUB INSTANCE > SPOKE INSTANCE

The diagram

4b2ab7e951022defba1b0d7f09700f39.png

SCENARIO 04: SPOKE INSTANCE > INTERNET

The diagram

Be61e48d50f60c487d9e35b06967b99d.png

SCENARIO 05: SPOKE INSTANCE > OCI SERVICE NETWORK

The diagram

29594b896d5cc42ebbf3b4c6743293f1.png

SCENARIO 06: HUB > INTERNET

The diagram

C413f52913667549090a190c65fc7873.png

SCENARIO 07: INTERNET > HUB

The diagram

50be85d395d2c723da091cbbcbb65058.png

SCENARIO 08: ON-PREM > SPOKE INSTANCE

The diagram

12e7eb930939439f28c7583d289b0875.png

SCENARIO 09: SPOKE INSTANCE > ON-PREM

The diagram

F1ccc7adc706a78379f6a955b7691d3b.png

SCENARIO 10: EXTERNAL > LB > SPOKE INSTANCE

The diagram

A39390d71825ad6988cb96538883da9a.png

Overall Conclusion

In this tutorial, we looked at a method of how to follow a network packet inside an OCI Tenant environment with a Hub and Spoke Network Routing Architecture. We used a combination of Packet captures, TCPdumps, and subnet-level logging inside the VCNs. After collecting all the log information we performed some analytics on the data and this way we were able to follow the packet and the full path. This method is useful to verify if there is an issue with your end-to-end connection. This way you can verify on what hop a possible issue occurs.