我使用的是 14.04 并安装isc-dhcp-server
在我的 Ubuntu 中。这是我的 DHCP 配置:
INTERFACES="eth0"
allow booting;
allow bootp;
subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.10 192.168.1.200;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
filename "/var/lib/tftpboot/pxelinux.0";
}
当我检查这个时:
ashokkrishna@ashokkrishna-Lenovo-B560:~$ dhcpd -t /etc/dhcp/dhcpd.conf
/etc/dhcp/dhcpd.conf: interface name too long (is 20)
我尝试在远程系统中通过 PXE 启动,但失败了。如何解决?
PXE-E51: No DHCP or proxyDHCP offers were received.
PXE-M0F: Exiting Broadcom ROM.
/etc/network/interfaces
配置:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.9
gateway 192.168.1.1
netmask 255.255.255.0
auto br0
iface br0 inet static
address 192.168.1.101
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
bridge_ports eth0
bridge_stp off
bridge_maxwait 5
ifconfig
细节:
br0 Link encap:Ethernet HWaddr f0:de:f1:a4:ec:87
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth0 Link encap:Ethernet HWaddr f0:de:f1:a4:ec:87
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:3929 errors:0 dropped:0 overruns:0 frame:0
TX packets:3929 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:380900 (380.9 KB) TX bytes:380900 (380.9 KB)
wlan0 Link encap:Ethernet HWaddr 74:de:2b:e2:94:c6
inet addr:192.168.43.9 Bcast:192.168.43.255 Mask:255.255.255.0
inet6 addr: fe80::76de:2bff:fee2:94c6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10941 errors:0 dropped:0 overruns:0 frame:0
TX packets:13954 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3537434 (3.5 MB) TX bytes:1880208 (1.8 MB)
答案1
尝试这个
# Sample /etc/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "***********";
option ntp-servers 192.168.1.254;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
range 192.168.1.110 192.168.1.200;
}
答案2
如果 DHCP 服务器在启动网络后显示错误并重新启动,请interfaces
使用您喜欢的文本编辑器打开该文件:
sudo nano /etc/network/interfaces
然后根据你的喜好输入以下几行:
iface eth0 inet static
address 192.168.1.*
network 192.168.1.**
netmask 255.255.255
broadcast 192.168.1.255
up service isc-dhcp-server restart
auto eth0
现在使用以下命令重新启动系统:
sudo reboot
您的 DHCP 服务器现在应该可以正常工作了。要测试 DHCP 是否正常工作,请运行该dhclient
命令。