我遇到了一些我设置的DHCP服务器的问题。 我在智慧的结尾,没有find我的这个问题的任何地方的答案。
设置如下:我有一台运行ISC DHCP服务器的CentOS服务器。 这台机器有两个接口连接到同一个networking,我们称之为eth0和eth1。
这两个网卡连接到的networking是172.31.255.0/24 。 在这个networking上, eth0有172.31.255.21 ; eth1有172.31.255.22 。 网关的IP地址是172.31.255.254 。 DHCP服务器只能在接口eth1( 172.31.255.22 )上运行。
来自WLAN的DHCP请求正在被中继,并将通过网关到达。 网关具有一个DHCP中继,用于获取来自WLAN客户端的请求并将其转换为单播DHCP请求。
来自WLAN的DHCP请求到达服务器的networking(tcpdump正在捕获它们),但服务器发出绝对没有响应。 日志也没有显示我。 更具体地说,DHCPDISCOVER请求由中继器发送给eth1,但DHCP服务器不响应。
服务器应该向WLAN客户端( 172.31.1.254/23 )发出不属于其本地networking( 172.31.255.0/24 )的IP地址。
这里有一个DHCP DISCOVERY例子:
16:13:37.629817 In 00:90:7f:d0:61:39 ethertype IPv4 (0x0800), length 347: (tos 0x0, ttl 64, id 25877, offset 0, flags [DF], proto UDP (17), length 331) 172.31.255.254.bootps > 172.31.255.22.bootps: [udp sum ok] BOOTP/DHCP, Request from 18:3d:a2:78:82:78, length 303, hops 1, xid 0xa5cdb9df, secs 7680, Flags [Broadcast] (0x8000) Gateway-IP 172.31.1.254 Client-Ethernet-Address 18:3d:a2:78:82:78 Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Discover Client-ID Option 61, length 7: ether 18:3d:a2:78:82:78 Hostname Option 12, length 12: "WIN-SURVEYPC" Vendor-Class Option 60, length 8: "MSFT 5.0" Parameter-Request Option 55, length 12: Subnet-Mask, Domain-Name, Default-Gateway, Domain-Name-Server Netbios-Name-Server, Netbios-Node, Netbios-Scope, Router-Discovery Static-Route, Classless-Static-Route, Classless-Static-Route-Microsoft, Vendor-Option Agent-Information Option 82, length 10: Circuit-ID SubOption 1, length 8: vlan2000 END Option 255, length 0
DHCP的服务器configuration如下(接口eth1作为启动参数给出):
log-facility local6; authoritative; # Management Subnet subnet 172.31.255.0 netmask 255.255.255.0 { option ntp-servers 172.31.255.20 , 172.31.255.21; option domain-name-servers 172.31.255.20 , 172.31.255.21; option broadcast-address 172.31.255.255; option routers 172.31.255.254; range 172.31.255.100 172.31.255.200; } # Guest_0 subnet 172.31.0.0 netmask 255.255.254.0 { option broadcast-address 172.31.1.255; option domain-name-servers 172.31.255.20 , 172.31.255.21; option routers 172.31.1.254; range 172.31.0.1 172.31.1.250; } # Guest_2 subnet 172.31.2.0 netmask 255.255.254.0 { option domain-name-servers 172.31.255.20, 172.31.255.21; option broadcast-address 172.31.3.255; option subnet-mask 255.255.254.0; option routers 172.31.3.254; range 172.31.2.1 172.31.3.250; }
这是服务器启动后的初始信息:
Nov 11 16:01:05 centos2 dhcpd: Internet Systems Consortium DHCP Server 4.2.5 Nov 11 16:01:05 centos2 dhcpd: Copyright 2004-2013 Internet Systems Consortium. Nov 11 16:01:05 centos2 dhcpd: All rights reserved. Nov 11 16:01:05 centos2 dhcpd: For info, please visit https://www.isc.org/software/dhcp/ Nov 11 16:01:05 centos2 dhcpd: Wrote 3 leases to leases file. Nov 11 16:01:05 centos2 dhcpd: Multiple interfaces match the same subnet: eth0 eth1 Nov 11 16:01:05 centos2 dhcpd: Multiple interfaces match the same shared network: eth0 eth1 Nov 11 16:01:05 centos2 dhcpd: Listening on LPF/eth1/00:50:56:a8:7d:ed/172.31.255.0/24 Nov 11 16:01:05 centos2 dhcpd: Sending on LPF/eth1/00:50:56:a8:7d:ed/172.31.255.0/24 Nov 11 16:01:05 centos2 dhcpd: Sending on Socket/fallback/fallback-net
路由表如下:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 172.31.255.254 0.0.0.0 UG 0 0 0 eth0 link-local 0.0.0.0 255.255.0.0 U 1002 0 0 eth0 172.31.255.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 172.31.255.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
任何帮助将不胜感激。 感谢您的时间!