0
点赞
收藏
分享

微信扫一扫

无法通过网络连接到 Azure Linux 虚拟机解决方案

本文将介绍网络错误阻止连接到 Azure Linux 虚拟机的问题。

问题现象

Azure Linux 虚拟机上的主接口 (VM) eth0。 如果未配置 eth0,则不能通过网络连接访问 VM,即使其他工具指示 VM 已启动。

出现问题时,安全命令行管理 (SSH) 具有正确权限的连接可能会开始连接到 VM。 但是,由于网络问题,它最终无法访问 VM。

网络错误通常记录在串行控制台日志中。 具体而言,您可能会看到以下错误。

串行控制台日志中的错误

CentOS Linux 分发错误

错误 1

Bringing up interface eth0:
Device eth0 does not seem to be present, delaying initialization.
[FAILED]

错误 2
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Device eth0 has different MAC address than expected, ignoring.
[FAILED]

错误 3
YYYY/MM/DD HH:MM:SS Discovered Windows Azure endpoint: ###.##.###.##
/usr/sbin/waagent:2275: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
Error('socket IOError ' + e.message + ' args: ' + repr(e.args))
YYYY/MM/DD HH:MM:SS ERROR:socket IOError args: (113, 'No route to host')
YYYY/MM/DD HH:MM:SS ERROR:socket IOError args: (113, 'No route to host')
Failed services in runlevel 3:network
错误 4

login: YYYY/MM/DD HH:MM:SS ERROR:timed out
YYYY/MM/DD HH:MM:SS ERROR:Traceback (most recent call last):
YYYY/MM/DD HH:MM:SS ERROR: File "/usr/sbin/waagent", line 3395, in DoDhcpWork
YYYY/MM/DD HH:MM:SS ERROR: receiveBuffer = sock.recv(1024)
YYYY/MM/DD HH:MM:SS ERROR:timeout: timed out
YYYY/MM/DD HH:MM:SS ERROR:
YYYY/MM/DD HH:MM:SS DoDhcpWork: Setting socket.timeout=10, entering recv
YYYY/MM/DD HH:MM:SS ERROR:timed out
YYYY/MM/DD HH:MM:SS ERROR:Traceback (most recent call last):
YYYY/MM/DD HH:MM:SS ERROR: File "/usr/sbin/waagent", line 3395, in DoDhcpWork
YYYY/MM/DD HH:MM:SS ERROR: receiveBuffer = sock.recv(1024)
YYYY/MM/DD HH:MM:SS ERROR:timeout: timed out
Customer changed the IP from DHCP to FIXED

SUSE Linux 分发错误

Setting up (localfs) network interfaces:
lo
lo IP address: 127.0.0.1/8
IP address: 127.0.0.2/8
done eth4
No configuration found for eth4
unused Waiting for mandatory devices: eth0
29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
eth0 No interface found

Ubuntu

错误 1

cloud-init-nonet waiting 120 seconds for a network device.
cloud-init-nonet gave up waiting for a network device.
ci-info: lo : 1 127.0.0.1 255.0.0.0 .
ci-info: eth1 : 0 . . 00:0d:3a:10:6a:53
route_info failed
Waiting for network configuration...
Waiting up to 60 more seconds for network configuration...
Booting system without full network configuration...
错误 2

ci-info: | eth0 | False | . | . | 00:0d:3a:21:f9:ad |
ci-info: +--------+-------+-----------+-----------+-------------------+
ci-info: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Route info failed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • i=eth0
  • x=0
  • ifdown eth0

ifdown: interface eth0 not configured

  • ifup eth0

Missing required variable: address
Missing required configuration variables for interface eth0/inet.
Failed to bring up eth0.

  • exit 0x\

解决方案

对于 CentOS

从 下的 ifcfg-eth0 文件中删除 HWADDR 指令 /etc/sysconfig/network-script 。

对于 SUSE Linux

在 下删除包含 eth0 或 eth1 条目的文件 /etc/udev/rules.d 。

对于 Ubuntu

错误 1

此错误指示配置了 aneth1 接口而不是 eth0。 如果 VM 上的操作系统未安装 udev 的一些更新,则可能会发生这种情况。 在这种情况下 ,udev 错误地保存了以前的网络接口。 当调整 VM 大小或移动 VM 时,它将收到一个不同的 MAC 地址,该地址将分配给 eth1。

若要解决此问题,请将操作系统磁盘附加到另一个正在运行的 VM,然后删除 下的 udev 规则文件 /etc/udev/rules.d/70-persistent-net.rules 。若要在将来避免此问题,我们建议在 VM 上更新 udev 程序包。 例如,运行以下命令:

sudo apt-get update

sudo apt-get install udev

错误 2

若要解决此问题,请将 /etc/network/interfaces.d/eth0.cfg 文件重置为默认值,并请求 Azure DHCP 获取 IP 地址。 然后,删除文件夹中 /var/lib/dhcp 包含缓存 DHCP 设置的文件。 以下是默认 eth0.cfg 文件的示例:

#The primary network interface

auto eth0
iface eth0 inet dhcp


举报

相关推荐

0 条评论