如何通过NAT通过公网IP发送一个UDP数据包? [英] How to Send A UDP packet via public IP through NAT?

查看:912
本文介绍了如何通过NAT通过公网IP发送一个UDP数据包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UDP服务器对我的私人network.I运行有一个装置,这超出NAT它通过公网IP发送UDP数据包到我的服务器。我能够接收UDP数据包,解析他们,我可以查看有效载荷,src和目的端口。现在我需要发送一个ACK消息,该设备,所以我已抓获的IP地址和端口号和发送一个UDP数据包到它。但我不能够在设备查看任何UDP数据包。

我的问题是我的设备超出NAT我得到的IP地址和端口号为NAT的或实际的设备?

如何通过NAT的UDP数据包发送到该设备?


解决方案

  

我的问题是我的设备超出NAT我得到的IP地址和端口号为NAT的或实际的设备?


您从包识别的IP地址和端口是那些在NAT创建的映射为客户端。简单地说,它是设备所连接NAT的IP和端口。


  

如何通过NAT的UDP数据包发送到该设备?


您需要通过它从客户端接收数据包的服务器检测到的IP和端口答复。
更清楚你需要实现的 UDP Holepunching

我猜你应该先了解有关连接到NAT下工作的设备的网络问题。各种 RFC 是可用于 NAT穿越 UDP打孔

下面是一些来源:

http://en.wikipedia.org/wiki/Network_address_translation

http://en.wikipedia.org/wiki/UDP_hole_punching

http://tool​​s.ietf.org/html/rfc4787

https://tool​​s.ietf.org/html/rfc5128

I have a UDP server running on my private network.I have a device which is beyond NAT which sends UDP packets to my server through public IP. I am able to receive the UDP packets, parse them and I can view the pay load, src and dest port. Now I need to send an ACK message to that device so I have captured the ip and port numbers and sending a UDP packet to it. But I could not able to view any UDP packets in that device.

My question is as my Device is beyond NAT the IP address and port number I am getting is NAT's or the actual device's ?

How to send the UDP packet to that device through NAT ?

解决方案

My question is as my Device is beyond NAT the IP address and port number I am getting is NAT's or the actual device's ?

The IP and Port you identify from the packet are those which the NAT created a mapping for the client. In simple words, it is the IP and Port of the NAT to which the device is connected.

How to send the UDP packet to that device through NAT ?

You need to reply on the IP and port detected by the server from the packet it received from client. More clearly you need to implement UDP Holepunching.

I guess you should first understand the networking issues regarding connection to devices working under a NAT. Various RFCs are available for NAT Traversal and UDP Punching.

Here are some sources:

http://en.wikipedia.org/wiki/Network_address_translation

http://en.wikipedia.org/wiki/UDP_hole_punching

http://tools.ietf.org/html/rfc4787

https://tools.ietf.org/html/rfc5128

这篇关于如何通过NAT通过公网IP发送一个UDP数据包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆