Search code examples
tcpnetwork-programmingvpnipsec

Verifying that a communication is happening over IPSec?


Is there a way one could test whether the communication between two hosts is happening over the IPSec protocol?

I have two different hosts running the OpenSource Peer2PeerVPN solution. And I have one host listening for messages via the net-cat tool.

nc -v -l -p 9999

And the other host connected to this via the VPN tunnel

nc -v 192.168.188.2 9999

I want to verify or check whether the communication is actually happening over the IPSec protocol. Also, I would like to see the values of the IPSec Protocol's Authentication and Encapsulation Headers.

I tried tcpdump but I'm guessing it only provides a capture on the layer above the Network level - Transport.

EDIT:
Based on a comment below I downloaded a sample pcap file to view how headers look in a IPSec communication. I see that these traces have ESP headers of the IPSec protocol.

However, when I try the same with the VPN Tool I'm using I don't see any packets with ESP header on the tcpdump. I was listening on the VPN interface (peervpn0) that the tool creates.

To check if this was a problem with the tool, I connected to a remote server to which I usually connect using VPN and sent some data via netcat to my machine from inside the remote-machine (I ssh'ed in). I listened for all packets on the VPN interface created by the Cisco VPN Tool (utun0) with filter esp

tcpdump -vvv -i utun0 esp

Still, I did not see any traces.

What am I missing here?

Should I listen on the default interface (my wifi interface) via which the VPN tunnel is created to see the ESP Headers?

Or have understood something wrong here?

Thank You
Shabir


Solution

  • With some further reading I was able to find out that PeerVPN does not communicate over IPSec but using encryption and sends the data as UDP payload over the underlying interface.

    I also saw that many of the VPN tools indeed do this and does encrypt the tunnel interface packets and forwards them over UDP in the underlying interface. Besides some VPN solutions have a separate option to enable IPSec protocol specifically.

    Thank You.