测试upnpc项目端口端口映射之双路由WAN口直连实现两个局域网通信

目录:

1、 环境搭建

2、 DMZ主机映射测试

3、 Upnp端口映射测试

一、环境搭建

硬件准备:两台电脑A和B,两个路由器(无线路由器A,有线路由器B)。

1、A、B两个路由器WAN直接连接,两台电脑A、B分别接A、B路由器任意LAN口;

2、登录路由器设置页面,选择DHCP服务器选项。

设置A路由器DHCP服务器参数,如图所示:

备注:如果A路由器登录IP不是192.168.1.1,在路由器设置页面的“网络参数”标签栏中的“LAN口设置”中,将IP地址改为192.168.1.1

clip_image002

设置B路由器DHCP服务器参数,如图所示:

备注:如果B路由器登录IP不是192.168.0.1,在路由器设置页面的“网络参数”标签栏中的“LAN口设置”中,将IP地址改为192.168.0.1

clip_image004

3、设置A路由器WAN口参数,如图所示:

clip_image006

设置B路由器WAN口参数,如图所示:

clip_image008

4、设置连接A路由器的A电脑的上网IP网关信息,如图所示:

clip_image010

设置连接B路由器的B电脑的上网IP网关信息,如图所示:

clip_image012

经过上面4步设置,两个局域网通过直连WAN口,进行网间通信环境就搭建好了,最后各个设备信息汇总如下:

无线A路由器外网IP地址:192.168.2.2

对应内网IP地址:192.168.1.1

笔记本A电脑IP地址:192.168.1.100

有线B路由器外网IP地址:192.168.2.3

对应内网IP地址:192.168.0.1

台式机B电脑IP地址:192.168.0.101

然后我们在A电脑上,ping对方B路由器的地址,测试通过,如图所示:

clip_image013

二、DMZ主机映射测试

在进行端口映射前,我们先利用DMZ主机映射测试网络是否正常。DMZ主机映射将局域网中的一台计算机完全暴露给广域网,以实现双向通信。

1、设置B路由器的DMZ主机映射到B电脑。设置如图:

clip_image014

2、在B电脑上运行ChatServer_log工程,开启服务器,如图所示:

clip_image016

3、在A电脑上运行player工程,登录服务器,服务器地址填写B路由器地址,如图所示:

clip_image018

测试结果通过,表明网络正常!如图所示:

clip_image019

三、upnp端口映射测试

1、取消DMZ主机映射设置,登录服务器进行测试,无法登录服务器

2、在B电脑上利用upnpc-static.exe建立好8888的TCP和UDP的两个端口映射,步骤如图所示:

clip_image021

登录B路由器,查看映射结果,如图所示:

clip_image022

3、在B电脑上运行ChatServer_log工程,开启服务器

4、在A电脑上运行player工程,登录服务器,服务器地址填写B路由器地址,如图所示:

clip_image023

测试通过,表明upnp端口映射能够正常工作。

转载于:https://www.cnblogs.com/MrTan/archive/2013/01/16/2863472.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
If you are experiencing problems with the Universal Plug and Play service, your computer might not be able to automatically detect the presence of other networked devices, such as PCs, printers, Internet access points and so on. That is where the UPnP Test application comes in. This simple program is designed to help you identify the issues that prevent the UPnP protocol from functioning correctly. Before you get your hopes up, you should know that this tool does not solve the detected problems, but only performs a series of tests to identify the possible causes. One advantage is that the application does not require installation, so your system registry is not affected in any way. The interface is compact and simple, comprising only two panels: one that displays the test type and its short description and the other for viewing which of the tests passed and which failed. The program can verify whether the operating system provides support for the UPnP service and allows you to check if the Simple Service Discovery Protocol (SSDP) and the UPnPHost services are running. It also verifies the connection between your network adapter and your router and the system's capacity to receive UPnP messages, as well as the router's capability to report an external IP address. One of the tests is designed to check if the Windows firewall service is blocking the traffic between your router and the system, thus preventing UPnP from working. The results can be copied to your clipboard by simply pressing a button and the tests can be redone easily. If you want to fix the detected issues, the link in the main interface can prove useful. In conclusion, UPnP Test is a simple tool for detecting problems related to device-to-device networking. However, it can only suggest possible reasons why the UPnP is not working, fixing the detected issues is totally up to you.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值