NAT 遍历库 Open.NAT

MIT
C#
跨平台
2014-08-18
叶秀兰

Open.NAT 是为 .NET 和 Mono 设计的 NAT 遍历库。Open.NAT 是 NAT 设备端口转发的类库,支持即插即用(UPNP)和端口映射协议(PMP)。

如果你正在开发类似媒体服务器,文件存储服务器,即时信息服务器等,你必须知道 NAT 遍历和计算机与外部设备连接的技术。

要做好这些,你必须熟悉 SSDP,UPNP 或者 PMP 协议,而且不同设备有很多的不同,需要不断测试。而 Open.NAT 正是提供了这些便利,它非常轻量级,而且提供 NAT 设备端口的转发,支持 UPNP 和 PMP 协议,使用 C# 编写,可以为 .NET 和 Mono 服务。

示例:

Your IP: 181.110.171.21Added mapping: 181.110.171.21:1700 -> 127.0.0.1:1600Mapping List

+------+-------------------------------+--------------------------------+----------------------------------+
| PROT | PUBLIC (Reacheable)           | PRIVATE (Your computer)        | Descriptopn                      |
+------+----------------------+--------+-----------------------+--------+----------------------------------+
|      | IP Address           | Port   | IP Address            | Port   |                                  |
+------+----------------------+--------+-----------------------+--------+----------------------------------+
|  TCP | 181.110.171.21       |  21807 | 10.0.0.5              |  32400 | Plex Media Server                |
|  UDP | 181.110.171.21       |  25911 | 10.0.0.6              |  25911 | Skype UDP at 10.0.0.6:25911 (2693)|
|  TCP | 181.110.171.21       |  25911 | 10.0.0.6              |  25911 | Skype TCP at 10.0.0.6:25911 (2693)|
|  TCP | 181.110.171.21       |   1700 | 10.0.0.6              |   1600 | Open.Nat Testing                 |
+------+----------------------+--------+-----------------------+--------+----------------------------------+

[Removing TCP mapping] 181.110.171.21:1700 -> 127.0.0.1:1600[Done]
[SUCCESS]: Test mapping effectively removed ;)

Press any kay to exit...
OpenNat - Information > Initializing

OpenNat - Information > StartDiscovery
OpenNat - Information > Searching
OpenNat - Information > Searching for: UpnpSearcher
OpenNat - Information > UPnP Response: Router advertised a 'WANPPPConnection:1' service!!!
OpenNat - Information > Found device at: http://10.0.0.2:5431/dyndev/uuid:0000e068-20a0-00e0-20a0-48a8000808e0OpenNat - Information > 10.0.0.2:5431: Fetching service list
OpenNat - Information > 10.0.0.2:5431: Parsed services list
OpenNat - Information > 10.0.0.2:5431: Found service: urn:schemas-upnp-org:service:Layer3Forwarding:1OpenNat - Information > 10.0.0.2:5431: Found service: urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1OpenNat - Information > 10.0.0.2:5431: Found service: urn:schemas-upnp-org:service:WANPPPConnection:1OpenNat - Information > 10.0.0.2:5431: Found upnp service at: /uuid:0000e068-20a0-00e0-20a0-48a802086048/WANPPPConnection:1OpenNat - Information > 10.0.0.2:5431: Handshake Complete
OpenNat - Information > UpnpNatDevice device found.
OpenNat - Information > ---------------------VVV
EndPoint: 10.0.0.2:5431Control Url: http://10.0.0.2:5431/uuid:0000e068-20a0-00e0-20a0-48a802086048/WANPPPConnection:1Service Description Url: http://10.0.0.2:5431/dyndev/uuid:0000e068-20a0-00e0-20a0-48a8000808e0Service Type: urn:schemas-upnp-org:service:WANPPPConnection:1Last Seen: 15/05/2014 10:43:23 p.m.
It got it!!
The external IP Address is: 186.108.237.5OpenNat - Information > UPnP Response: Router advertised a 'WANPPPConnection:1' service!!!
OpenNat - Information > Found device at: http://10.0.0.2:5431/dyndev/uuid:0000e068-20a0-00e0-20a0-48a8000808e0OpenNat - Information > Already found - Ignored


加载中

评论(0)

暂无评论

暂无资讯

暂无问答

FreePastry 网络如何穿透防火墙

This tutorial shows you how to get FreePastry running in the presence of Network Address Translators and Firewalls. The approach has many tiers, and supports a large variety of ...

2014/01/04 10:13
75
0
Peer-to-Peer Communication Across Network Address Translators

http://www.brynosaurus.com/pub/net/p2pnat/

2016/11/25 15:03
14
0
Creating VPNs with IPsec and SSL/TLS

VPN (Virtual Private Network) is a technology that provides secure communication through an insecure and untrusted network (like the Internet). Usually, it achieves this by auth...

2016/12/21 17:54
26
0
CentOS in VirtualBox (NAT模式) 实现 SSH

Host OS : Windows 7 Guest OS : CentOS 5.7 Virtual Machine : VirtualBox 4.1.2 Connection Type: Nat -------------------------------------------------------------------- 只是简单实...

2012/08/05 16:13
187
0
Ubuntu LAMP notes

How to disable firewall: You can type the following command to see if firewall is active or not (open a terminal or ssh session and type the following command): $ sudo iptables ...

2013/01/04 02:09
16
0
iptables 入门

iptables 中的指令,均需区分大小写。 ipchains 和 iptables 在语法上的主要的差异,注意如下∶ 1. 在 ipchains 中,诸如 input 链,是使用小写的 chains 名,在 iptables 中,要改用大写 IN...

2012/06/13 13:28
474
0
Android蓝牙系统

蓝牙技术的特点 全球范围适用: 蓝牙技术使用无需经过许可的工业、科研和医疗(ISM)波段(2.4至2.485 GHz),使用展频、调频、全双工信号,标称速率为1600跳/秒。在大多数国家,无需经过许可便...

2013/03/11 15:55
340
0
an openstack tech blog

The Quantum L3 router and floating IPs This post shows how the Quantum L3 Agent uses the Linux IP stack to implement the Quantum L3 Routing and NAT API extensions. It explains i...

2013/09/16 23:17
110
0
Freebsd下PF的安装使用

FreeBSD下的包过滤工具有IPFW,IPF以及PF,它们各有特点。PF原本是OpenBSD下的包过滤工具,FreeBSD开发人员已经把PF移植到了FreeBSD上了。如果要在FreeBSD上使用PF,需如下操作: 1. 编译内核...

2011/07/04 22:45
240
0

没有更多内容

加载失败,请刷新页面

返回顶部
顶部