This guide demonstrates a simple NAT traversal setup using tcpdump
and nc
(Netcat) for UDP communication.
On the server, use tcpdump
to monitor the incoming UDP packets on port 12345
:
sudo tcpdump -i any udp and port 12345
This command will allow you to view the UDP request from the client, which is important for identifying the NAT port.
On the client, run the following command to send a UDP packet to the server, NATting the packet along the way:
nc -uvp 5555 192.0.2.1 12345
This sends the UDP packet from the client (on port 5555
) to the server at IP 192.0.2.1
on port 12345
.
On the server, listen for incoming UDP packets on port 12345
from the client:
nc -uvp 12345 198.51.100.15 <PORT_FROM_TCPDUMP> || nc -l -uvp 12345