如何在 Azure 的 ubuntu 中启用互联网连接

How to enable internet connection in ubuntu in Azure

如何在 Azureubuntu 中启用互联网连接

我有 Ubuntu 从 Azure 配置的 VM cloud.It 默认情况下,Azure 似乎有防火墙,它会阻止 Internet 连接。 ping google.com 不是 working.The 命令 apt-get update 给出以下输出。

root@linuxserver#apt-get update Err:1 http://security.ubuntu.com/ubuntu xenial-security InRelease Temporary failure resolving 'security.ubuntu.com' Err:2 http://archive.ubuntu.com/ubuntu xenial InRelease Temporary failure resolving 'archive.ubuntu.com' Err:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease Temporary failure resolving 'archive.ubuntu.com' Err:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease Temporary failure resolving 'archive.ubuntu.com' Reading package lists... Done W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease Temporary failure resolving 'security.ubuntu.com' W: Some index files failed to download. They have been ignored, or old ones used instead.

在 /etc/resolve.conf 中我有像 10.x.x.x 这样的 IP。 (出于安全原因无法提供完整的 IP)如何检查 Internet 是否在 Azure 的防火墙级别或网络级别被阻止。如何对 Ubuntu 虚拟机进行故障排除和启用互联网。

我进行了 google 搜索并读到我的配置中应该有 Microsoft public DNS 服务器。这是对还是错。

[编辑] 将 Google DNS 服务器 8.8.8.8 添加到 /etc/resolve.conf 后。 apt-get 更新有效。所以关闭这个线程。

[关闭]

没有任何东西阻止您的 VM 访问互联网。 Azure 中的虚拟机部署在云服务中,该层负责分配 public ip 等功能。所有路由也是自动创建的,只要您不弄乱 VM 中的适配器配置,您就应该能够连接到互联网。

确保将 Azure VM 中的网络配置保持为自动 (DHCP)。不要手动设置任何东西。您还应该在配置 VM 之前配置虚拟网络,以组织您的基础架构并确保其他 VM 可以相互通信。

创建虚拟网络

https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-create-a-vnet/

如果需要固定私有IP或者预留publicIP:

https://azure.microsoft.com/documentation/articles/virtual-networks-reserved-public-ip/

也许您会问这个问题是因为您熟悉 Amazon AWS。在 Amazon 中,您必须部署 NAT 服务器并为其分配弹性 IP,但在 Azure 中,您无需执行任何操作即可获得互联网连接和 public ip。

更新:

Microsoft 生命周期服务 - Azure 演示部署

这个特定的演示部署依赖于域控制器。可能这台机器上的 DNS 服务器 运行 没有配置为转发外部 DNS 请求。 RDP 到此 VM 并打开 DNS 管理器控制台。右键单击您的服务器名称 >> Select 属性 >> Select 转发器选项卡 >> 添加 Google DNS 8.8.8.8、8.8.4.4 看看您现在是否可以浏览互联网。