Virtual-Machines

Ubuntu 16.04 LTS - DHCP 提供 IPv6 但不提供 IPV4

  • July 1, 2019

我有一個 Ubuntu Server 16.04 LT,它是 ESX (VMware) 上的虛擬機。該伺服器在 dhcp 配置中,直到今天它都執行良好。(我知道伺服器應該是靜態地址,但就我而言,我真的不需要是靜態的)。今天,我重新啟動了伺服器(VM),伺服器沒有更多的 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。沒看懂,昨天還好好的

如果你有想法,我接受!

謝謝

找到問題,我有一個 IPv6 地址(我什至成功地使用 IPv6 在 ssh 中連接到我的 VM),問題只是沒有足夠的 IPv4 可用。網路管理員刪除了一些舊的保留,它起作用了!如果像我這樣愚蠢的人沒有發現問題,我會發這篇文章:)

引用自:https://serverfault.com/questions/973255