如何使用外部IP地址连接到本地主机? [英] How to connect to localhost using external IP address?

查看:184
本文介绍了如何使用外部IP地址连接到本地主机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总体上进行了搜索,并在此处查看了建议的答案,因此,我希望不要立即将其标记为重复项.因此,这里去.

I've searched in general, and looked at suggested responses here, so I hope this isn't immediately marked as a duplicate. So here goes.

我正在使用台式机上的端口3000使用Angular服务器构建一个简单的Web应用程序.我已经使用标准的"localhost:3000" URL对其进行了测试.然后,我想让我家外的其他人可以访问它进行测试和审查.因此,我在端口3000的路由器中进行了预期的端口转发,将其转发到本地计算机10.0.0.90.然后,我使用"[wan ip]:3000"之类的外部IP(路由器的"WAN IP")构建了一个链接.并且这已经按预期工作,可以进行内部访问也可以进行外部访问.当时唯一有趣的事情是必须在服务器调用中添加"--host 0.0.0.0".

I'm building a simple web app with an Angular server using port 3000 on my desktop. I've been testing it with the standard "localhost:3000" URL. I then wanted to make it accessible to others outside my home for testing and review. So I did the expected port forwarding in my router of port 3000 to my local machine at 10.0.0.90. I then constructed a link using my external IP (router's "WAN IP") like "[wan ip]:3000". And this has worked as expected, enabling external access as well as internal access. The only thing funny at the time was having to add "--host 0.0.0.0" to the server invocation.

但这是问题所在.我最初的设置可以正常工作,它是一个Comcast调制解调器,而我的路由器(TP-Link)挂在它上面.最近,我切换到他们的Xfinity网关组合调制解调器/路由器(Arris TG1682G).现在,我无法使用[wan ip]:3000 URL进入服务器.我什至无法ping通该URL,它们都超时了.因此,在使用支持Comcast技术的电话时,无法确定我为什么会遇到此问题(即使在升级路由器固件并重新启动后),我要求他尝试[wan ip]:3000,它确实起作用了!我的本地网络上的任何其他计算机也都无法使用它.但是,当我将笔记本电脑的无线连接从我的房屋Xfinity路由器更改为外部连接时(除了许多邻居之外,在网络列表中看到的许多"xfinitywifi"之一),它再次起作用了!在Xfinity路由器管理页面中四处浏览,我没有发现任何听起来与它有关的东西.

But here's the problem. My original setup, where everything worked, was a Comcast modem with my router (TP-Link) hanging off of it. Recently, I switched to their Xfinity Gateway combo modem/router (Arris TG1682G). Now, I can't get to the server using the [wan ip]:3000 URL. I can't even ping that URL, they all time out. So, while on the phone with Comcast tech support, and not being able to determine why I had this problem (even after upgrading router firmware and rebooting it), I asked him to try [wan ip]:3000, and it worked! It also doesn't work from any other machines on my local network. But, when I changed my laptop wireless connection from my house Xfinity router to an external one (one of the many "xfinitywifi"s seen in a list of networks, besides numerous neighbors), it again worked! Poking around in Xfinity router admin pages, I didn't see anything that sounded like it was involved with this.

那么,您知道发生了什么,如何解决?感谢您的任何想法或指导.

So, any idea what's going on, and how to fix? Thanks for any ideas or guidance.

推荐答案

好的,我想我知道发生了什么事.一位同事提到,要使其正常工作,路由器需要支持"NAT反射/环回".查看此路由器上的每个设置页面,我看不到任何听起来像那样的东西.进一步的搜索显示一个页面,他们指出该路由器不支持该路由器.好吧.

OK, I think I see what's going on. A colleague mentioned that for this to work, the router needs to support "NAT reflection/loopback". Looking at every setup page on this router, I don't see anything that sounds like that. Further searching shows a page where they state that this router does not support it. Oh well.

这篇关于如何使用外部IP地址连接到本地主机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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