RTP,防火墙后面和 Nat 后面的媒体数据包让生活很难修复它,现在我正在尝试进行 UDP 打洞,以摆脱它
我正在尝试创建一个对等 2 对等音频/视频应用程序,但在 NAT 和防火墙后面导致我的应用程序失败,我发现 Skype 做到了这一点,其他应用程序也采用了其他方法,然后我决定使用这种方法,这将允许我申请在 NAT 办公室/家庭后面工作。
UDP打洞:
到目前为止,尝试了hping2和netcat。服务器,pc1位于nat/firewall后面,pc2位于nat/firewall后面
local/1$ nc -u 14141 -l # ME, step 1
remoteServer$ echo "hello" | nc -p 53 -u xx.23.xx.xx 14141 # My server, to say hello
nc: Write error: No route to host
local/2$ hping2 -c 1 -2 -s 14141 -p 53 xx.21.xx.xx # Me from second terminal making a hole
remoteServer$ echo "hello" | nc -p 53 -u xx.23.xx.xx 14141 # My server again say hell
local/1 $ nc -u 14141 -l # ME, step 1 was running and it received "hello" now
hello
但是local/1如何在没有hping2的情况下获得hello,或者hping2到底是什么? 有人可以建议吗?或者我如何使用这种方法让 A(本地)B(服务器)C(我的朋友)与对等 2 对等进行通信?
有用的链接: http://www.masquerade。 cz/en/nat-tunel-metodou-udp-hole-punching-v-jazyce-java/
后续: UPnP 是最好的解决方案吗?但它会寻找下一个跃点,因此在这种情况下,此路线图将会失败(如果我没记错的话):
Me(在 NAT 后面)-> MyOffice(带有路由器) ,50 台笔记本电脑) -> ISP1 -> ISP2 -> FriendOffice(路由器,90 台笔记本电脑) -> 朋友(NAT 后面)
I am trying to make a peer 2 peer audio/video application, but behind NAT and behind firewall causing my application failture, i figure out that Skype does it and other application does also other approach, then i decided to use this approach which will allow my application to work behind NAT office/home.
UDP Hole punching:
So far, tried hping2 and netcat. Server, pc1 behind nat/firewall and pc2 behind nat/firewall
local/1$ nc -u 14141 -l # ME, step 1
remoteServer$ echo "hello" | nc -p 53 -u xx.23.xx.xx 14141 # My server, to say hello
nc: Write error: No route to host
local/2$ hping2 -c 1 -2 -s 14141 -p 53 xx.21.xx.xx # Me from second terminal making a hole
remoteServer$ echo "hello" | nc -p 53 -u xx.23.xx.xx 14141 # My server again say hell
local/1 $ nc -u 14141 -l # ME, step 1 was running and it received "hello" now
hello
But local/1 how to get the hello, without hping2 or what is exactly hping2?
Can anyone suggest? Or how i can just do the A (local) B(server) C(my friend) communicate with peer 2 peer using this method?
Useful links:
http://www.masquerade.cz/en/nat-tunel-metodou-udp-hole-punching-v-jazyce-java/
Follow up:
UPnP is best solution? But it looks for the very next hop, so in that case it will fail for this road map (if i am not wrong):
Me (behind NAT) -> MyOffice (with router, 50 laptops) -> ISP1 -> ISP2 -> FriendOffice (router, 90 laptops) -> Friend (behind NAT)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
许多 p2p 应用程序所做的就是连接到最近的路由器并要求它们为自己打开一个端口。了解 UPnP 和 NAT-PMP 协议。
What many p2p applications do is to connect to the nearest router and ask them to open a port to themselves. Read about UPnP and NAT-PMP protocols.