我最近尝试进入 Ubuntu(最新版本),但 DHCP 服务器出现问题。我根据我的学生用书配置了文件/etc/network/interfaces
,/etc/dhcp/dhcpd.conf
但似乎不起作用。 Nmap 根本不显示我的 DHCP,所以我认为它根本没有打开,但仍然 - 当我使用以下设置启动/重新启动守护进程和服务时绝对没有错误:
interfaces
文件:
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet static
address 192.168.0.110
gateway 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
dhcpd.conf
文件:
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-search "example.com";
option domain-name-servers 192.168.0.100;
option time-offset -18000; # Eastern Standard Time
range 192.168.0.150 192.168.0.160;
}
如果配置:
eth1 Link encap:Ethernet HWaddr e0:3f:49:7f:f6:20
inet addr:192.168.0.110 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::e23f:49ff:fe7f:f620/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1046758 errors:0 dropped:0 overruns:0 frame:0
TX packets:647564 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1381761035 (1.3 GB) TX bytes:88156037 (88.1 MB)
Interrupt:16
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:45940 errors:0 dropped:0 overruns:0 frame:0
TX packets:45940 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3127593 (3.1 MB) TX bytes:3127593 (3.1 MB)
isc-dhcp-服务器:
# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
DHCPD_CONF=/etc/dhcp/dhcpd.conf
# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
DHCPD_PID=/var/run/dhcpd.pid
# Additional options to start dhcpd with.
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth1"
有什么问题吗?
答案1
nmap
是一种 IP 工具,DHCP
是一种分配 IP 地址的方法,它不在 IP 层运行,因为这将使其仅对不再需要它的实体有用。结果,nmap
就看不到了。
如果您仍然觉得有问题,可以使用一些工具来测试 DHCP 服务器(例如https://github.com/CyberShadow/dhcptest-虽然我从未尝试过)