UDP packets get changed to ICMP packets
Posted on 2007-12-01
While debugging an app, I discovered that packets I sent as UDP had been changed to ICMP packets when sent over the internet. As a test, I did the following from a Mac running OS-X 10.5:
1. Open a terminal window with "nc -u -l 1028" to listen for UDP packets.
2. Open another terminal window with "nc -u x.x.x.x 1028" to send UDP packets.
3. With x.x.x.x set to 192.168.0.8, the IP address of the Mac I'm using, text sends just fine from one window to the other.
4. With x.x.x.x set to my internet IP address, packets never show up on the listening window.
5. Using the Wireshark packet sniffer, the transmitted packet appears as UDP, as expected.
6. The received packet, however, is shown as an ICMP packet, 28 bytes longer. The data portion of the content is correct.
The fact that the packet sniffer shows an incoming ICMP packet indicates that the packet is not being blocked by any firewall (set to forward port 1028 to 192.168.0.8). My internet connection is Verizon FIOS, using their Actiontec wireless router.
In short, UDP between two terminal windows on the same machine works fine when using the local machine address, but does not work when routing through the internet to the machine's internet IP address because the packets somehow get changed to ICMP packets. Any ideas would be appreciated. Thanks.