系统管理指南:IP 服务

与 DHCP 服务器通信时出现的问题

本节介绍了将 DHCP 客户机添加到网络时可能会遇到的问题。

启用客户机软件并重新引导系统之后,客户机会尝试访问 DHCP 服务器以获取其网络配置。如果客户机无法访问服务器,则可能会看到如下错误消息:


DHCP or BOOTP server not responding 

    在确定问题之前,必须同时从客户机和服务器收集诊断信息。要收集信息,可以执行以下任务:

  1. 如何在调试模式下运行 DHCP 客户机

  2. 如何在调试模式下运行 DHCP 服务器

  3. 如何使用 snoop 监视 DHCP 网络通信流量

您可以单独执行这些操作,也可以同时执行这些操作。

所收集的信息可以帮助确定是客户机、服务器还是中继代理出现了问题。然后,即可寻找解决方案。

Procedure如何在调试模式下运行 DHCP 客户机

如果客户机不是 Oracle Solaris : DHCP 客户机,请参阅客户机文档,以获取有关如何在调试模式下运行客户机的信息。

如果您拥有 Oracle Solaris : DHCP 客户机,请使用以下步骤。

  1. 以超级用户身份登录 DHCP 客户机系统。

  2. 中止 DHCP 客户机守护进程。


    # pkill -x dhcpagent
    
  3. 在调试模式下重新启动守护进程。


    # /sbin/dhcpagent -d1 -f &
    

    -d 开关可将 DHCP 客户机置于详细级别为 1 的调试模式。-f 开关会导致输出发送到控制台而不是 syslog

  4. 配置接口以启动 DHCP 协商。


    # ifconfig interface dhcp start
    

    使用客户机的网络接口名称(如 ge0)替换 interface

    在调试模式下运行时,客户机守护进程会在执行 DHCP 请求时将消息显示到屏幕上。有关客户机调试模式输出的信息,请参见DHCP 客户机在调试模式下的输出

Procedure如何在调试模式下运行 DHCP 服务器

  1. 以超级用户的身份登录服务器系统。

  2. 临时停止 DHCP 服务器。


    # svcadm disable -t svc:/network/dhcp-server
    

    也可以使用 DHCP 管理程序或 dhcpconfig 停止服务器。

  3. 在调试模式下重新启动守护进程。


    # /usr/lib/inet/in.dhcpd -d -v
    

    您还应该使用在运行守护进程时通常使用的所有 in.dhcpd 命令行选项。例如,如果将守护进程作为 BOOTP 中继代理运行,请在 in.dhcpd -d -v 命令中包括 -r 选项。

    在调试模式下运行时,守护进程会在处理 DHCP 或 BOOTP 请求时将消息显示到屏幕上。有关服务器调试模式输出的信息,请参见DHCP 服务器在调试模式下的输出

Procedure如何使用 snoop 监视 DHCP 网络通信流量

  1. 以超级用户的身份登录 DHCP 服务器系统。

  2. 启动 snoop 以开始跟踪服务器的网络接口间的网络通信流量。


    # /usr/sbin/snoop -d interface -o snoop-output-filename udp port 67 or udp port 68
    

    例如,可以键入以下命令:


    #  /usr/sbin/snoop -d hme0 -o /tmp/snoop.output udp port 67 or udp port 68
    

    snoop 会继续监视接口,直到您获取所需信息之后按 Ctrl-C 组合键停止 snoop

  3. 引导客户机系统,或者在客户机系统上重新启动 dhcpagent

    如何在调试模式下运行 DHCP 客户机介绍了如何重新启动 dhcpagent

  4. 在服务器系统上,使用 snoop 显示包含网络包内容的输出文件:


    # /usr/sbin/snoop -i snoop-output-filename -x0 -v
    

    例如,可以键入以下命令:

    # /usr/sbin/snoop -i /tmp/snoop.output -x0 -v
    
另请参见

有关解释输出的信息,请参见DHCP snoop 输出

DHCP 客户机在调试模式下的输出

以下示例显示了 DHCP 客户机在调试模式下发送 DHCP 请求并从 DHCP 服务器接收配置信息时的标准输出。


示例 17–1 DHCP 客户机在调试模式下的标准输出


/sbin/dhcpagent: debug: set_packet_filter: set filter 0x27fc8 (DHCP filter) 
/sbin/dhcpagent: debug: init_ifs: initted interface hme0 
/sbin/dhcpagent: debug: insert_ifs: hme0: sdumax 1500, optmax 1260, hwtype 1, hwlen 6 
/sbin/dhcpagent: debug: insert_ifs: inserted interface hme0 
/sbin/dhcpagent: debug: register_acknak: registered acknak id 5 
/sbin/dhcpagent: debug: unregister_acknak: unregistered acknak id 5 
/sbin/dhcpagent: debug: set_packet_filter: set filter 0x26018 (ARP reply filter)
/sbin/dhcpagent: info: setting IP netmask on hme0 to 255.255.192.0 
/sbin/dhcpagent: info: setting IP address on hme0 to 10.23.3.233 
/sbin/dhcpagent: info: setting broadcast address on hme0 to 10.23.63.255 
/sbin/dhcpagent: info: added default router 10.23.0.1 on hme0 
/sbin/dhcpagent: debug: set_packet_filter: set filter 0x28054 (blackhole filter) 
/sbin/dhcpagent: debug: configure_if: bound ifsp->if_sock_ip_fd 
/sbin/dhcpagent: info: hme0 acquired lease, expires Tue Aug 10 16:18:33 2006 
/sbin/dhcpagent: info: hme0 begins renewal at Tue Aug 10 15:49:44 2006 
/sbin/dhcpagent: info: hme0 begins rebinding at Tue Aug 10 16:11:03 2006

如果客户机无法访问 DHCP 服务器,则看到的调试模式输出可能会类似于以下示例所显示的输出。


示例 17–2 指明 DHCP 客户机在调试模式下出现问题的输出


/sbin/dhcpagent: debug: set_packet_filter: set filter 0x27fc8 (DHCP filter)
/sbin/dhcpagent: debug: init_ifs: initted interface hme0 
/sbin/dhcpagent: debug: select_best: no valid OFFER/BOOTP reply
/sbin/dhcpagent: debug: select_best: no valid OFFER/BOOTP reply
/sbin/dhcpagent: debug: select_best: no valid OFFER/BOOTP reply
 

如果看到此消息,则表明客户机请求永远无法到达服务器,或者服务器无法将响应发送到客户机。请按照如何使用 snoop 监视 DHCP 网络通信流量中所述,在服务器上运行 snoop,以确定来自客户机的包是否已到达服务器。

DHCP 服务器在调试模式下的输出

守护进程启动时,标准的服务器调试模式输出将显示服务器配置信息,后跟有关每个网络接口的信息。守护进程启动后,调试模式输出显示有关请求该守护进程的信息。示例 17–3 显示了刚刚启动的 DHCP 服务器的调试模式输出。对于使用其他未响应的 DHCP 服务器拥有的地址的客户机,服务器将延长其租用期。


示例 17–3 DHCP 服务器在调试模式下的标准输出


Daemon Version: 3.1  
Maximum relay hops: 4  
Transaction logging to console enabled.  
Run mode is: DHCP Server Mode.  
Datastore: nisplus  
Path: org_dir.dhcp.test..:dhcp.test..:$ 
DHCP offer TTL: 10  
Ethers compatibility enabled.  
BOOTP compatibility enabled.  
ICMP validation timeout: 1000 milliseconds, Attempts: 2.  
Monitor (0005/hme0) started...  
Thread Id: 0005 - Monitoring Interface: hme0 *****  
MTU: 1500      Type: DLPI  
Broadcast: 10.21.255.255 
Netmask: 255.255.0.0  
Address: 10.21.0.2  
Monitor (0006/nf0) started...  
Thread Id: 0006 - Monitoring Interface: nf0 *****  
MTU: 4352      Type: DLPI  
Broadcast: 10.22.255.255  
Netmask: 255.255.0.0  
Address: 10.22.0.1  
Monitor (0007/qfe0) started...  
Thread Id: 0007 - Monitoring Interface: qfe0 *****  
MTU: 1500      Type: DLPI   
Broadcast: 10.23.63.255  
Netmask: 255.255.192.0  
Address: 10.23.0.1  
Read 33 entries from DHCP macro database on Tue Aug 10 15:10:27 2006 
Datagram received on network device: qfe0  
Client: 0800201DBA3A is requesting verification of address owned by 10.21.0.4 
Datagram received on network device: qfe0  
Client: 0800201DBA3A is requesting verification of address owned by 10.21.0.4  
Datagram received on network device: qfe0  
Client: 0800201DBA3A is requesting verification of address owned by 10.21.0.4  
Datagram received on network device: qfe0  
Client: 0800201DBA3A maps to IP: 10.23.3.233  
Unicasting datagram to 10.23.3.233 address.  
Adding ARP entry: 10.23.3.233 == 0800201DBA3A  
DHCP EXTEND 0934312543 0934316143 10.23.3.233 10.21.0.2 
          0800201DBA3A SUNW.Ultra-5_10 0800201DBA3A

示例 17–4 显示了作为 BOOTP 中继代理启动的 DHCP 守护进程的调试模式输出。此代理将客户机的请求中继到 DHCP 服务器,并将服务器的响应中继到客户机。


示例 17–4 BOOTP 中继在调试模式下的标准输出


Relay destination: 10.21.0.4 (blue-servr2)     network: 10.21.0.0  
Daemon Version: 3.1  
Maximum relay hops: 4  
Transaction logging to console enabled.  
Run mode is: Relay Agent Mode.  
Monitor (0005/hme0) started...  
Thread Id: 0005 - Monitoring Interface: hme0 *****  
MTU: 1500      Type: DLPI  
Broadcast: 10.21.255.255  
Netmask: 255.255.0.0  
Address: 10.21.0.2  
Monitor (0006/nf0) started...  
Thread Id: 0006 - Monitoring Interface: nf0 *****  
MTU: 4352      Type: DLPI  
Broadcast: 10.22.255.255  
Netmask: 255.255.0.0  
Address: 10.22.0.1  
Monitor (0007/qfe0) started...  
Thread Id: 0007 - Monitoring Interface: qfe0 *****  
MTU: 1500      Type: DLPI  
Broadcast: 10.23.63.255  
Netmask: 255.255.192.0  
Address: 10.23.0.1  
Relaying request 0800201DBA3A to 10.21.0.4, server port.  
BOOTP RELAY-SRVR 0934297685 0000000000 0.0.0.0 10.21.0.4 0800201DBA3A 
N/A 0800201DBA3A  
Packet received from relay agent: 10.23.0.1  
Relaying reply to client 0800201DBA3A  
Unicasting datagram to 10.23.3.233 address.  
Adding ARP entry: 10.23.3.233 == 0800201DBA3A  
BOOTP RELAY-CLNT 0934297688 0000000000 10.23.0.1 10.23.3.233 0800201DBA3A 
N/A 0800201DBA3A  
Relaying request 0800201DBA3A to 10.21.0.4, server port.  
BOOTP RELAY-SRVR 0934297689 0000000000 0.0.0.0 10.21.0.4 0800201DBA3A 
N/A 0800201DBA3A  
Packet received from relay agent: 10.23.0.1  
Relaying reply to client 0800201DBA3A  
Unicasting datagram to 10.23.3.233 address.  
Adding ARP entry: 10.23.3.233 == 0800201DBA3A 
 

如果 DHCP 存在问题,则调试模式输出可能会显示警告或错误消息。请使用以下 DHCP 服务器错误消息列表来寻找解决方案。


ICMP ECHO reply to OFFER candidate: ip_address disabling

原因:

在 DHCP 服务器向客户机提供 IP 地址之前,它会对此地址执行 ping 操作以检验地址是否正在使用。如果客户机回复,则表明此地址正在使用。

解决方法:

确保配置的地址尚未使用。您可以使用 ping 命令。有关更多信息,请参见 ping(1M) 手册页。


No more IP addresses on network-address network.

原因:

在 DHCP 网络表中没有与客户机网络关联的 IP 地址。

解决方法:

使用 DHCP 管理程序或 pntadm 命令创建更多的 IP 地址。如果 DHCP 守护进程正在监视多个子网,请确保其他地址是客户机所在子网的地址。有关更多信息,请参见将 IP 地址添加到 DHCP 服务


No more IP addresses for network-address network when you are running the DHCP daemon in BOOTP compatibility mode.

原因:

BOOTP 没有使用租用时间,因此 DHCP 服务器查找设置了 BOOTP 标志的空闲地址以将其分配给 BOOTP 客户机。

解决方法:

使用 DHCP 管理程序分配 BOOTP 地址。请参见通过 DHCP 服务支持 BOOTP 客户机(任务列表)


Request to access nonexistent per network database: database-name in datastore: datastore.

原因:

在配置 DHCP 服务器的过程中,未创建子网的 DHCP 网络表。

解决方法:

使用 DHCP 管理程序或 pntadm 命令来创建 DHCP 网络表和新的 IP 地址。请参见添加 DHCP 网络


There is no table-name dhcp-network table for DHCP client's network.

原因:

在配置 DHCP 服务器的过程中,未创建子网的 DHCP 网络表。

解决方法:

使用 DHCP 管理程序或 pntadm 命令来创建 DHCP 网络表和新的 IP 地址。请参见添加 DHCP 网络


Client using non_RFC1048 BOOTP cookie.

原因:

网络中的某个设备正在尝试访问不受支持的 BOOTP 实现。

解决方法:

如果无需配置此设备,则忽略此消息。如果您希望支持此设备,请参见通过 DHCP 服务支持 BOOTP 客户机(任务列表)获取更多信息。

DHCP snoop 输出

snoop 输出中,您应会看到在 DHCP 客户机系统和 DHCP 服务器系统之间交换了包。每个包中指明了各系统的 IP 地址,另外,还包括包路径中的所有路由器或中继代理的 IP 地址。如果两个系统未交换包,则客户机系统可能根本无法访问服务器系统。因此,不会出现太严重的问题。

要评估 snoop 输出,您必须知道预期的行为。例如,必须知道请求是否应通过 BOOTP 中继代理,还必须知道所涉及的系统的 MAC 地址和 IP 地址,以便可以确定这些值是否为期望的值。如果存在多个网络接口,则还必须知道这些网络接口的地址。

以下示例显示了从 blue-servr2 上的 DHCP 服务器发送到 MAC 地址为 8:0:20:8e:f3:7e 的客户机的 DHCP 确认消息的标准 snoop 输出。在此消息中,服务器为客户机指定了 IP 地址 192.168.252.6 和主机名 white-6。此消息还包括多个标准网络选项以及几个用于客户机的供应商特定选项。


示例 17–5 单个包的 snoop 样例输出


ETHER:  ----- Ether Header ----- 
ETHER:   
ETHER:  Packet 26 arrived at 14:43:19.14 
ETHER:  Packet size = 540 bytes 
ETHER:  Destination = 8:0:20:8e:f3:7e, Sun 
ETHER:  Source      = 8:0:20:1e:31:c1, Sun 
ETHER:  Ethertype = 0800 (IP) 
ETHER:  
IP:   ----- IP Header ----- 
IP:    
IP:   Version = 4 
IP:   Header length = 20 bytes 
IP:   Type of service = 0x00 
IP:         xxx. .... = 0 (precedence) 
IP:         ...0 .... = normal delay 
IP:         .... 0... = normal throughput 
IP:         .... .0.. = normal reliability 
IP:   Total length = 526 bytes 
IP:   Identification = 64667 
IP:   Flags = 0x4 IP:         .1.. .... = do not fragment 
IP:         ..0. .... = last fragment 
IP:   Fragment offset = 0 bytes 
IP:   Time to live = 254 seconds/hops 
IP:   Protocol = 17 (UDP) 
IP:   Header checksum = 157a 
IP:   Source address = 10.21.0.4, blue-servr2 
IP:   Destination address = 192.168.252.6, white-6 
IP:   No options 
IP:   UDP:  ----- UDP Header ----- 
UDP:   
UDP:  Source port = 67 
UDP:  Destination port = 68 (BOOTPC) 
UDP:  Length = 506  
UDP:  Checksum = 5D4C  
UDP:  
DHCP: ----- Dynamic Host Configuration Protocol ----- 
DHCP:  
DHCP: Hardware address type (htype) =  1 (Ethernet (10Mb)) 
DHCP: Hardware address length (hlen) = 6 octets 
DHCP: Relay agent hops = 0 
DHCP: Transaction ID = 0x2e210f17 
DHCP: Time since boot = 0 seconds 
DHCP: Flags = 0x0000 
DHCP: Client address (ciaddr) = 0.0.0.0 
DHCP: Your client address (yiaddr) = 192.168.252.6 
DHCP: Next server address (siaddr) = 10.21.0.2 
DHCP: Relay agent address (giaddr) = 0.0.0.0 
DHCP: Client hardware address (chaddr) = 08:00:20:11:E0:1B 
DHCP:  
DHCP: ----- (Options) field options ----- 
DHCP:  
DHCP: Message type = DHCPACK 
DHCP: DHCP Server Identifier = 10.21.0.4 
DHCP: Subnet Mask = 255.255.255.0 
DHCP: Router at = 192.168.252.1 
DHCP: Broadcast Address = 192.168.252.255 
DHCP: NISPLUS Domainname = dhcp.test 
DHCP: IP Address Lease Time = 3600 seconds 
DHCP: UTC Time Offset = -14400 seconds 
DHCP: RFC868 Time Servers at = 10.21.0.4 
DHCP: DNS Domain Name = sem.example.com 
DHCP: DNS Servers at = 10.21.0.1 
DHCP: Client Hostname = white-6 
DHCP: Vendor-specific Options (166 total octets): 
DHCP:   (02) 04 octets  0x8194AE1B (unprintable) 
DHCP:   (03) 08 octets  "pacific" 
DHCP:   (10) 04 octets  0x8194AE1B (unprintable) 
DHCP:   (11) 08 octets  "pacific" 
DHCP:   (15) 05 octets  "xterm" 
DHCP:   (04) 53 octets  "/export/s2/base.s2s/latest/Solaris_8/Tools/Boot" 
DHCP:   (12) 32 octets  "/export/s2/base.s2s/latest" 
DHCP:   (07) 27 octets  "/platform/sun4u/kernel/unix" 
DHCP:   (08) 07 octets  "EST5EDT" 
  0: 0800 208e f37e 0800 201e 31c1 0800 4500    .. .ó~.. .1...E.
 16: 020e fc9b 4000 fe11 157a ac15 0004 c0a8    ....@....z......           
 32: fc06 0043 0044 01fa 5d4c 0201 0600 2e21    ...C.D..]L.....!           
 48: 0f17 0000 0000 0000 0000 c0a8 fc06 ac15    ................           
 64: 0002 0000 0000 0800 2011 e01b 0000 0000    ........ .......           
 80: 0000 0000 0000 0000 0000 0000 0000 0000    ................           
 96: 0000 0000 0000 0000 0000 0000 0000 0000    ................          
112: 0000 0000 0000 0000 0000 0000 0000 0000    ................          
128: 0000 0000 0000 0000 0000 0000 0000 0000    ................          
144: 0000 0000 0000 0000 0000 0000 0000 0000    ................          
160: 0000 0000 0000 0000 0000 0000 0000 0000    ................          
176: 0000 0000 0000 0000 0000 0000 0000 0000    ................          
192: 0000 0000 0000 0000 0000 0000 0000 0000    ................          
208: 0000 0000 0000 0000 0000 0000 0000 0000    ................          
224: 0000 0000 0000 0000 0000 0000 0000 0000    ................          
240: 0000 0000 0000 0000 0000 0000 0000 0000    ................          
256: 0000 0000 0000 0000 0000 0000 0000 0000    ................          
272: 0000 0000 0000 6382 5363 3501 0536 04ac    ......c.Sc5..6..          
288: 1500 0401 04ff ffff 0003 04c0 a8fc 011c    ................          
304: 04c0 a8fc ff40 0964 6863 702e 7465 7374    .....@.dhcp.test          
320: 3304 0000 0e10 0204 ffff c7c0 0404 ac15    3...............          
336: 0004 0f10 736e 742e 6561 7374 2e73 756e    ....sem.example.          
352: 2e63 6f6d 0604 ac15 0001 0c07 7768 6974    com.........whit          
368: 652d 362b a602 0481 94ae 1b03 0861 746c    e-6+.........pac          
384: 616e 7469 630a 0481 94ae 1b0b 0861 746c    ific.........pac          
400: 616e 7469 630f 0578 7465 726d 0435 2f65    ific...xterm.5/e          
416: 7870 6f72 742f 7332 382f 6261 7365 2e73    xport/sx2/bcvf.s          
432: 3238 735f 776f 732f 6c61 7465 7374 2f53    2xs_btf/latest/S          
448: 6f6c 6172 6973 5f38 2f54 6f6f 6c73 2f42    olaris_x/Tools/B          
464: 6f6f 740c 202f 6578 706f 7274 2f73 3238    oot. /export/s2x          
480: 2f62 6173 652e 7332 3873 5f77 6f73 2f6c    /bcvf.s2xs_btf/l         
496: 6174 6573 7407 1b2f 706c 6174 666f 726d    atest../platform          
512: 2f73 756e 346d 2f6b 6572 6e65 6c2f 756e    /sun4u/kernel/un          
528: 6978 0807 4553 5435 4544 54ff              ix..EST5EDT.