我有一个 Ubuntu Server 16.04 LTs,它是 ESX(VMware)上的虚拟机。该服务器采用 dhcp 配置,直到今天都运行良好。(我知道服务器应该使用静态地址,但就我而言,我实际上不需要静态地址)。今天,我重新启动了服务器(虚拟机),服务器不再有 IPv4,只有 IPv6。
我没有在配置中改变任何东西,我将向您展示我认为有用的不同文件/配置,如果您需要更多,只需询问。
/etc/hosts
127.0.0.1 localhost
127.0.1.1 my_hostname
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
/etc/主机名
my_hostname
/etc/网络/接口
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
ifconfig
命令输出
eth0 Link encap:Ethernet HWaddr 00:50:56:94:d1:ae
adr inet6: fe80::250:56ff:fe94:d1ae/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Packets reçus:68852 erreurs:0 :0 overruns:0 frame:0
TX packets:1120 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
Octets reçus:5658008 (5.6 MB) Octets transmis:329017 (329.0 KB)
lo Link encap:Boucle locale
inet adr:127.0.0.1 Masque:255.0.0.0
adr inet6: ::1/128 Scope:Hôte
UP LOOPBACK RUNNING MTU:65536 Metric:1
Packets reçus:26990 erreurs:0 :0 overruns:0 frame:0
TX packets:26990 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1
Octets reçus:1997350 (1.9 MB) Octets transmis:1997350 (1.9 MB)
我尝试释放 IPv4dhclient -4 -r -v
Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0/00:50:56:94:d1:ae
Sending on LPF/eth0/00:50:56:94:d1:ae
Sending on Socket/fallback
IPv6 也一样dhclient -6 -r -v
Removed stale PID file
Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on Socket/eth0
Sending on Socket/eth0
**And it block here**
我也尝试询问下一个 IPdhclient -4 -v
DHCPDISCOVER on eth0 to 255.255.255.255 port 67
...
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
我知道 DHCP 服务器的 IP 地址,所以我指定了它,dhclient -4 -v -s IP_ADDRESS_DHCP_SERVER
DHCPDISCOVER on eth0 to IP_ADDRESS_DHCP_SERVER port 67
...
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
我不知道该怎么办了,我尝试禁用 IPv6,但之后我却无法获取任何 IP。我不明白,昨天它运行正常……
如果你有想法,我会采纳!
谢谢
答案1
找到问题了,我有一个 IPv6 地址(我甚至成功使用 IPv6 在 ssh 中连接到我的 VM),问题只是没有足够的 IPv4 可用。网络管理员删除了一些旧的保留,它就起作用了!我让这个帖子告诉那些像我一样愚蠢的人,他们没有发现问题:)