I needed to determine whether User Datagram Protocol (UDP) datagrams were being transmitted through a firewall on specific ports. I had a Windows system behind the firewall and a Linux system on the outside of the firewall. I intended to use Ncat on both systems. I installed Nmap on the Windows system, since it provides the Ncat utility. But when I tried to install Ncat on the Linux system, I encountered problems, so I installed socat, instead, since it provides similar capabilities.
Since I needed to test whether UDP datagrams would reach the Windows
system on port 27900, I issued the command ncat -u 27900 -l
to have ncat listen (the "-l" argument) on UDP port 27900 (the -u 27900
argument). I then issued the command socat - udp-sendto:192.168.0.3:27900
on the Linux system. The - udp-sendto:192.168.0.3
allowed me to send data from the system socat was running on to
the the destination address 192.168.0.3. I was then able to type text,
e.g. the words "a test" on the Linux system. I saw them appear on the Windows
system indicating the firewall rule was functioning as needed.
Linux Sending System
$ socat - udp-sendto:192.168.2.3:27900 a test
Windows Listening System
C:\Program Files\Network\Nmap>ncat -u 27900 -l a test
I then terminated the socat program on the Linux system with Ctrl-D and the ncat program on the Windows system with Ctrl-C.
References: