简体   繁体   English

从VM外部访问Azure VM端口

[英]Accessing Azure VM port from Outside of VM

As we know there are simple steps to give access to any VM-port from outside. 我们知道,有简单的步骤可以使从外部访问任何VM端口。

Here is the steps I have already covered : 这是我已经介绍的步骤:

  1. Open VM instance and run the server on port 80 and checked the localhost is running in the local browse, 打开VM实例,并在端口80上运行服务器,并检查本地浏览器是否在运行localhost,
  2. added port 80 in the inbound of Network security group, 在网络安全组的入站中添加了端口80,
  3. turned off all three types of firewall from the VM windows. 从虚拟机窗口中关闭所有三种类型的防火墙。

在此处输入图片说明

Still the public ip is not accisible from the outside. 仍然无法从外部访问公共IP。 Ping ... is resulting "Request timeout" or the port "80" is not accessible from the browser using public IP. Ping ...导致“请求超时”或使用公共IP无法从浏览器访问端口“ 80”。

Edit : Surprisingly i have found a Deny tag in the report ! 编辑:令人惊讶的是,我在报告中找到了一个拒绝标签! Does it matter ? 有关系吗 ?

Normally, add port 80 to NSG inbound rules and turn off VM's windows firewall, we will access website from outside. 通常,将端口80添加到NSG入站规则中,然后关闭VM的Windows防火墙,我们将从外部访问网站。

In your scenario, maybe we should check web site work on IPv4 or IPv6 or both? 在您的情况下,也许我们应该检查网站在IPv4或IPv6或两者上的工作情况? We can use this command to check it: 我们可以使用以下命令进行检查:

C:\Users\jason>netstat -ant
Active Connections

  Proto  Local Address          Foreign Address        State           Offload State

  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       InHost
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       InHost
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       InHost
  TCP    0.0.0.0:3389           0.0.0.0:0              LISTENING       InHost
  TCP    [::]:80                [::]:0                 LISTENING       InHost
  TCP    [::]:135               [::]:0                 LISTENING       InHost
  TCP    [::]:445               [::]:0                 LISTENING       InHost
  TCP    [::]:3389              [::]:0                 LISTENING       InHost

We can find web service listen on port 80 and work on IPv4 and IPv6, so we can use IPv4(public IP address) and port 80 to access this web site. 我们可以在端口80上找到Web服务侦听并在IPv4和IPv6上工作,因此我们可以使用IPv4(公共IP地址)和端口80来访问此网站。

We should make sure web service work on IPv4. 我们应该确保Web服务可以在IPv4上运行。

========================== =========================

Update : 更新

Please check your Vnet-->subnet, does this subnet associated with a NSG, if yes, we should modify this NSG's inbound rules, add port 80 to this NSG. 请检查您的Vnet->子网,该子网是否与NSG相关联,如果是,我们应该修改此NSG的入站规则,将端口80添加到该NSG。

It seems a issue with node server for angular cli, more information please refer to this link below: https://github.com/angular/angular-cli/issues/1793 节点服务器似乎存在角度cli的问题,更多信息请参考以下链接: https : //github.com/angular/angular-cli/issues/1793

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM