Linux

儘管應該有可用的 IP,但 dhcp 伺服器給出“沒有免費租約”錯誤

  • October 31, 2017

我們有一個大約 40 台機器的小型 HPC 集群,執行 Rocks Linux Distro 6.2(基於 Centos 6.6)。在過去的幾天裡,我一直在嘗試向系統添加 6 台機器。前 3 台成功,但我無法 pxe 引導其他 3 台機器。/var/log/messages顯示“沒有免費租約”錯誤,如下所示:

[root@topaz ~]# tail -n3 /var/log/messages 
Jun 29 17:56:00 topaz dhcpd: DHCPDISCOVER from d0:bf:9c:03:3b:40 via eth0: network 10.1.0.0/16: no free leases
Jun 29 17:56:03 topaz dhcpd: DHCPDISCOVER from d0:bf:9c:03:3b:40 via eth0: network 10.1.0.0/16: no free leases
Jun 29 17:56:07 topaz dhcpd: DHCPDISCOVER from d0:bf:9c:03:3b:40 via eth0: network 10.1.0.0/16: no free leases

除前端外,所有機器都只有一個本地 IP。應該有足夠的 IP 可分配給這些新機器。似乎沒有任何意外的機器連接到網路:

[root@topaz ~]# arp -a | awk '{ print $2 }' | sort   
(10.1.255.215)
(10.1.255.216)
(10.1.255.217)
(10.1.255.218)
(10.1.255.219)
(10.1.255.220)
(10.1.255.221)
(10.1.255.222)
(10.1.255.223)
(10.1.255.224)
(10.1.255.225)
(10.1.255.226)
(10.1.255.227)
(10.1.255.228)
(10.1.255.229)
(10.1.255.230)
(10.1.255.231)
(10.1.255.232)
(10.1.255.233)
(10.1.255.234)
(10.1.255.235)
(10.1.255.236)
(10.1.255.237)
(10.1.255.238)
(10.1.255.239)
(10.1.255.240)
(10.1.255.241)
(10.1.255.242)
(10.1.255.243)
(10.1.255.244)
(10.1.255.245)
(10.1.255.246)
(10.1.255.247)
(10.1.255.248)
(10.1.255.249)
(10.1.255.250)
(10.1.255.251)
(10.1.255.252)
(10.1.255.253)
(10.1.255.254)
(193.140.197.1)
(193.140.197.110)
(193.140.197.160)
(193.140.197.30)
(193.140.197.36)

我們的租約文件沒有顯示任何條目:

[root@topaz ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.1.1-P1

server-duid "\000\001\000\001\037\006r\351x\347\321\350\031\006";

我們的配置文件如下所示:

[root@topaz ~]# cat /etc/dhcp/dhcpd.conf
ddns-update-style none;
subnet 10.1.0.0 netmask 255.255.0.0 {
       default-lease-time 1200;
       max-lease-time 1200;
       option routers 10.1.1.1;
       option subnet-mask 255.255.0.0;
       option domain-name "local";
       option domain-name-servers 10.1.1.1;
       option broadcast-address 10.1.255.255;
       option interface-mtu 1500;
       group "local" {
               host topaz-eth0 {
                       hardware ethernet 78:E7:D1:E8:19:06;
                       option host-name "topaz";
                       fixed-address 10.1.1.1;
                       filename "pxelinux.0";
                       next-server 10.1.1.1;
               }
               host topaz-eth2 {
                       hardware ethernet 78:E7:D1:E8:19:0A;
                       option host-name "topaz";
                       fixed-address 10.1.1.1;
                       filename "pxelinux.0";
                       next-server 10.1.1.1;
               }
               host topaz-eth3 {
                       hardware ethernet 78:E7:D1:E8:19:0C;
                       option host-name "topaz";
                       fixed-address 10.1.1.1;
                       filename "pxelinux.0";
                       next-server 10.1.1.1;
               }
               host compute-2-0-eth0 {
                       hardware ethernet 00:23:7d:9f:6f:ca;
                       option host-name "compute-2-0";
                       fixed-address 10.1.255.254;
                       filename "pxelinux.0";
                       next-server 10.1.1.1;
               }
               host compute-2-0-eth1 {
                       hardware ethernet 00:23:7d:a0:20:e4;
                       option host-name "compute-2-0";
                       fixed-address 10.1.255.254;
                       filename "pxelinux.0";
                       next-server 10.1.1.1;
               }
               host compute-0-0-eth0 {
                       hardware ethernet 1c:c1:de:76:6f:40;
                       option host-name "compute-0-0";
                       fixed-address 10.1.255.253;
                       filename "pxelinux.0";
                       next-server 10.1.1.1;
               }
               host compute-0-0-eth1 {
                       hardware ethernet 1c:c1:de:76:6f:44;
                       option host-name "compute-0-0";
                       fixed-address 10.1.255.253;
                       filename "pxelinux.0";
                       next-server 10.1.1.1;
               }

               (goes on like this)
}

我不明白為什麼我會收到這個錯誤。任何幫助表示讚賞。

看起來您錯過了這些框range的定義或特定host條目,與它們的 MAC 匹配。除非您的失敗框在“繼續這樣”的列表中,否則它們不會分配任何地址。

您的 ISC dhcpd 配置文件(2016 年 6 月發布)沒有範圍聲明。沒有免費的租約,因為伺服器無法在定義的範圍內找到要分發的 IP 地址。你需要一條線

range 10.1.42.0 10.1.49.255;

在您的子網{} 塊內。該子網內的任何範圍,沒有其他任何東西已經在使用,都可以工作。如果您有多個子網塊,則每個塊都需要一個範圍定義。

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