標(biāo)題: DHCP服務(wù)器搭建遇到的問(wèn)題,求幫忙 [打印本頁(yè)] 作者: linllian8 時(shí)間: 2013-05-08 17:21 標(biāo)題: DHCP服務(wù)器搭建遇到的問(wèn)題,求幫忙 我的Linux系統(tǒng)是基于虛擬機(jī)創(chuàng)建的,在搭建DHCP服務(wù)器過(guò)程中遇到以下問(wèn)題
1、在修改/etc/dhcpd.conf文件時(shí),subnet XXXXXXXXXXXX 其中XXXXXXXXXXXX應(yīng)該填寫(xiě)什么。虛擬機(jī)網(wǎng)絡(luò)IP地址為192.168.44.128,WIN7本地連接IP地址為192.168.9.100
2、進(jìn)行cp /usr/share/doc/dhcp-4.2.4/dhcpd.conf.sample /etc/dhcpd.conf ,其中dhcpd.conf文件中的內(nèi)容應(yīng)該怎樣修改啊,我的文件內(nèi)容如下,請(qǐng)問(wèn)應(yīng)該怎樣進(jìn)行修改。
1 # dhcpd.conf
2 #
3 # Sample configuration file for ISC dhcpd
4 #
5
6 # option definitions common to all supported networks...
7 option domain-name "example.org";
8 option domain-name-servers ns1.example.org, ns2.example.org;
9
10 default-lease-time 600;
11 max-lease-time 7200;
12
13 # Use this to enble / disable dynamic dns updates globally.
14 #ddns-update-style none;
15
16 # If this DHCP server is the official DHCP server for the local
17 # network, the authoritative directive should be uncommented.
18 #authoritative;
19
20 # Use this to send dhcp log messages to a different log file (you also
21 # have to hack syslog.conf to complete the redirection).
22 log-facility local7;
23
24 # No service will be given on this subnet, but declaring it helps the
25 # DHCP server to understand the network topology.
26
27 subnet 10.152.187.0 netmask 255.255.255.0 {
28 }
29
30 # This is a very basic subnet declaration.
31
32 subnet 10.254.239.0 netmask 255.255.255.224 {
33 range 10.254.239.10 10.254.239.20;
34 option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
35 }
36
37 # This declaration allows BOOTP clients to get dynamic addresses,
38 # which we don't really recommend.
39
40 subnet 10.254.239.32 netmask 255.255.255.224 {
41 range dynamic-bootp 10.254.239.40 10.254.239.60;
42 option broadcast-address 10.254.239.31;
43 option routers rtr-239-32-1.example.org;
44 }
45
46 # A slightly different configuration for an internal subnet.
47 subnet 10.5.5.0 netmask 255.255.255.224 {
48 range 10.5.5.26 10.5.5.30;
49 option domain-name-servers ns1.internal.example.org;
50 option domain-name "internal.example.org";
51 option routers 10.5.5.1;
52 option broadcast-address 10.5.5.31;
53 default-lease-time 600;
54 max-lease-time 7200;
55 }
56
57 # Hosts which require special configuration options can be listed in
58 # host statements. If no address is specified, the address will be
59 # allocated dynamically (if possible), but the host-specific information
60 # will still come from the host declaration.
61
62 host passacaglia {
63 hardware ethernet 0:0:c0:5d:bd:95;
64 filename "vmunix.passacaglia";
65 server-name "toccata.fugue.com";
66 }
67
68 # Fixed IP addresses can also be specified for hosts. These addresses
69 # should not also be listed as being available for dynamic assignment.
70 # Hosts for which fixed IP addresses have been specified can boot using
71 # BOOTP or DHCP. Hosts for which no fixed address is specified can onl y
72 # be booted with DHCP, unless there is an address range on the subnet
73 # to which a BOOTP client is connected which has the dynamic-bootp flag
74 # set.
75 host fantasia {
76 hardware ethernet 08:00:07:26:c0:a5;
77 fixed-address fantasia.fugue.com;
78 }
79
80 # You can declare a class of clients and then do address allocation
81 # based on that. The example below shows a case where all clients
82 # in a certain class get addresses on the 10.17.224/24 subnet, and all
83 # other clients get addresses on the 10.0.29/24 subnet.
84
85 class "foo" {
86 match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
87 }
88
89 shared-network 224-29 {
90 subnet 10.17.224.0 netmask 255.255.255.0 {
91 option routers rtr-224.example.org;
92 }
93 subnet 10.0.29.0 netmask 255.255.255.0 {
94 option routers rtr-29.example.org;
95 }
96 pool {
97 allow members of "foo";
98 range 10.17.224.10 10.17.224.250;
99 }
100 pool {
101 deny members of "foo";
102 range 10.0.29.10 10.0.29.230;
103 }
104 }
3、在終端輸入service dhcpd start時(shí),提示Redirecting to /bin/systemctl start dhcpd.service 請(qǐng)問(wèn)是什么意思啊,怎么解決呢?作者: chenyx 時(shí)間: 2013-05-08 18:00
subnet XXXXXXXXXXXX 其中XXXXXXXXXXXX應(yīng)該填寫(xiě)什么--->寫(xiě)上虛擬機(jī)網(wǎng)絡(luò)192.168.44.0
3、在終端輸入service dhcpd start時(shí),提示Redirecting to /bin/systemctl猀琀愀爀琀 dhcpd.service 請(qǐng)問(wèn)是什么意思啊,怎么解決呢?
作者: chenyx 時(shí)間: 2013-05-10 09:12
range后面是你想分配的ip范圍
routers指定的是dhcp客戶(hù)端獲取到的網(wǎng)關(guān)的ip
domain-name-servers客戶(hù)端獲取的dns的地址作者: linllian8 時(shí)間: 2013-05-10 09:39
謝謝
1、查看端口的啟用情況
#netstat -tlunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1104/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1175/sendmail: acce
tcp6 0 0 :::631 :::* LISTEN 1/systemd
udp 0 0 0.0.0.0:631 0.0.0.0:* 1/systemd
udp 0 0 0.0.0.0:60642 0.0.0.0:* 515/avahi-daemon: r
udp 0 0 0.0.0.0:5353 0.0.0.0:* 515/avahi-daemon: r
udp 0 0 0.0.0.0:9516 0.0.0.0:* 642/dhclient
udp 0 0 0.0.0.0:68 0.0.0.0:* 642/dhclient
udp6 0 0 :::9011 :::* 642/dhclient
端口打開(kāi)了,但是在查看日志文件的時(shí)候,卻顯示
May 10 09:26:39 ZXL dhcpd:
May 10 09:26:39 ZXL dhcpd: exiting.
May 10 09:28:50 ZXL dhcpd: Internet Systems Consortium DHCP Server 4.2.4-P2
May 10 09:28:50 ZXL dhcpd: Copyright 2004-2012 Internet Systems Consortium.
May 10 09:28:50 ZXL dhcpd: All rights reserved.
May 10 09:28:50 ZXL dhcpd: For info, please visit https://www.isc.org/software/dhcp/
May 10 09:28:50 ZXL dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
May 10 09:28:50 ZXL dhcpd: Wrote 0 leases to leases file.
May 10 09:28:50 ZXL dhcpd:
May 10 09:28:50 ZXL dhcpd: No subnet declaration for start (no IPv4 addresses).
May 10 09:28:50 ZXL dhcpd: ** Ignoring requests on start. If this is not what
May 10 09:28:50 ZXL dhcpd: you want, please write a subnet declaration
May 10 09:28:50 ZXL dhcpd: in your dhcpd.conf file for the network segment
May 10 09:28:50 ZXL dhcpd: to which interface start is attached. **
May 10 09:28:50 ZXL dhcpd:
May 10 09:28:50 ZXL dhcpd:
May 10 09:28:50 ZXL dhcpd: Not configured to listen on any interfaces!
May 10 09:28:50 ZXL dhcpd:
May 10 09:28:50 ZXL dhcpd: This version of ISC DHCP is based on the release available
May 10 09:28:50 ZXL dhcpd: on ftp.isc.org. Features have been added and other changes
May 10 09:28:50 ZXL dhcpd: have been made to the base software release in order to make
May 10 09:28:50 ZXL dhcpd: it work better with this distribution.
May 10 09:28:50 ZXL dhcpd:
May 10 09:28:50 ZXL dhcpd: Please report for this software via the Red Hat Bugzilla site:
May 10 09:28:50 ZXL dhcpd: http://bugzilla.redhat.com
May 10 09:28:50 ZXL dhcpd:
May 10 09:28:50 ZXL dhcpd: exiting.
May 10 09:34:13 ZXL dhclient[642]: DHCPREQUEST on eth0 to 192.168.44.254 port 67 (xid=0x5bb23820)
May 10 09:34:13 ZXL dhclient[642]: DHCPACK from 192.168.44.254 (xid=0x5bb23820)
May 10 09:34:13 ZXL dhclient[642]: bound to 192.168.44.128 -- renewal in 888 seconds.
好像是退出了DHCP服務(wù)器是嗎?作者: wenhq 時(shí)間: 2013-05-10 09:54
配置還有問(wèn)題。作者: chenyx 時(shí)間: 2013-05-10 09:56
dhcpd服務(wù)沒(méi)有起來(lái).日志已經(jīng)告訴你了,你的配置文件里面沒(méi)有本地網(wǎng)絡(luò)的subnet的定義.
按照我給你的配置,寫(xiě)一下吧.作者: linllian8 時(shí)間: 2013-05-10 10:10
1 #整體的環(huán)境設(shè)置,當(dāng)下面的subnet與host沒(méi)有設(shè)置時(shí),以這里的設(shè)置值為準(zhǔn)
2 ddns-update-style none;
3 default-lease-time 259200;
4 max-lease-time 518400;
5 option routers 192.168.44.254;
6 option broadcast-address 192.168.44.255;
7 option domain-name-servers 192.168.44.1;
8
9 #動(dòng)態(tài)分配的IP
10 subnet 192.168.44.0 netmask 255.255.255.0
11 {
12 range 192.168.44.21 192.168.44.100;
13 option subnet-mask 255.255.255.0;
14 option nis-domain "linllian8.tsai";
15 option domain-name "linllian8.tsai";
16
17
18 host linllian8
19 {
20 hardware ethernet 00:0c:29:49:40:d6;
21 fixed-address 192.168.44.110;
22 }
23 }
我的配置設(shè)置這樣的,我覺(jué)得是dhcpd的問(wèn)題,我允許rpm -q dhcpd,提示package dhcpd is not installed,但是我yum install dhcpd時(shí),又提示沒(méi)有可用的dhcpd,一直找不到問(wèn)題的根源,糾結(jié)啊。作者: chenyx 時(shí)間: 2013-05-10 10:17
直接就是dhcp包,不是dhcpd.
rpm -q dhcp看下吧作者: linllian8 時(shí)間: 2013-05-10 10:25
dhcp顯示安裝了,就是不知道Redirecting to /bin/systemctl start dhcpd.service這個(gè)問(wèn)題怎么去解決作者: chenyx 時(shí)間: 2013-05-10 10:27
那個(gè)不是問(wèn)題啊,你不要糾結(jié),Fedora用systemd代替了我們以前的init的那種方式,那個(gè)提示是正常的提示.
你可以不用service命令,直接用他給出的命令來(lái)啟動(dòng)服務(wù),效果是一樣的作者: linllian8 時(shí)間: 2013-05-10 10:44
我試過(guò)了,不行啊,
[root@ZXL xiaoling]# service dhcpd start
Redirecting to /bin/systemctl start dhcpd.service
[root@ZXL xiaoling]# /bin/systemctl/dhcpd start
bash: /bin/systemctl/dhcpd: 不是目錄
這個(gè)才是正確的命令.作者: linllian8 時(shí)間: 2013-05-10 11:00
嗯,還是不行,日志文件的輸出信息還是那樣作者: chenyx 時(shí)間: 2013-05-10 11:03
ifconfig -a查看下,確認(rèn)你的ip作者: linllian8 時(shí)間: 2013-05-10 11:05
沒(méi)得改變 作者: wenhq 時(shí)間: 2013-05-10 11:47
感覺(jué)LZ多看看私房菜
DHCP并不難;蛟S你冷靜 一下,吃個(gè)中午飯。午休一會(huì)下午自然就能解決。作者: linllian8 時(shí)間: 2013-05-10 14:29
配置文件問(wèn)題解決了,下面出現(xiàn)一團(tuán)提示,看不懂,請(qǐng)大俠幫幫忙
May 10 14:17:37 ZXL dbus[522]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper)
May 10 14:17:37 ZXL NetworkManager[464]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Commit) complete.
May 10 14:17:37 ZXL dbus-daemon[522]: dbus[522]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper)
May 10 14:17:37 ZXL dbus-daemon[522]: dbus[522]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
May 10 14:17:37 ZXL dbus[522]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
May 10 14:17:38 ZXL avahi-daemon[488]: Received response from host 192.168.44.1 with invalid source port 52103 on interface 'eth0.0'
May 10 14:17:38 ZXL avahi-daemon[488]: Received response from host 192.168.44.1 with invalid source port 52103 on interface 'eth0.0'
May 10 14:17:40 ZXL avahi-daemon[488]: Received response from host 192.168.44.1 with invalid source port 52103 on interface 'eth0.0'
May 10 14:17:40 ZXL avahi-daemon[488]: Received response from host 192.168.44.1 with invalid source port 52103 on interface 'eth0.0'
May 10 14:18:08 ZXL systemd[1]: PID file /run/sendmail.pid not readable (yet?) after start.
May 10 14:18:08 ZXL dbus-daemon[522]: disabled
May 10 14:18:36 ZXL systemd[1]: PID 2536 read from file /run/sm-client.pid does not exist.
May 10 14:24:47 ZXL dhcpd: Internet Systems Consortium DHCP Server 4.2.4-P2
May 10 14:24:47 ZXL dhcpd: Copyright 2004-2012 Internet Systems Consortium.
May 10 14:24:47 ZXL dhcpd: All rights reserved.
May 10 14:24:47 ZXL dhcpd: For info, please visit https://www.isc.org/software/dhcp/
May 10 14:24:47 ZXL dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
May 10 14:24:47 ZXL dhcpd: Wrote 0 leases to leases file.
May 10 14:24:47 ZXL dhcpd: Listening on LPF/eth0/00:0c:29:49:40:d6/192.168.44.0/24
May 10 14:24:47 ZXL dhcpd: Sending on LPF/eth0/00:0c:29:49:40:d6/192.168.44.0/24
May 10 14:24:47 ZXL dhcpd: Sending on Socket/fallback/fallback-net
May 10 14:26:31 ZXL dhcpd: Internet Systems Consortium DHCP Server 4.2.4-P2
May 10 14:26:31 ZXL dhcpd: Copyright 2004-2012 Internet Systems Consortium.
May 10 14:26:31 ZXL dhcpd: All rights reserved.
May 10 14:26:31 ZXL dhcpd: For info, please visit https://www.isc.org/software/dhcp/
May 10 14:26:31 ZXL dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
May 10 14:26:31 ZXL dhcpd: Wrote 0 leases to leases file.
May 10 14:26:31 ZXL dhcpd: Listening on LPF/eth0/00:0c:29:49:40:d6/192.168.44.0/24
May 10 14:26:31 ZXL dhcpd: Sending on LPF/eth0/00:0c:29:49:40:d6/192.168.44.0/24
May 10 14:26:31 ZXL dhcpd: Sending on Socket/fallback/fallback-net 作者: chenyx 時(shí)間: 2013-05-10 14:38
這個(gè)dhcp服務(wù)不是已經(jīng)起來(lái)了嗎作者: linllian8 時(shí)間: 2013-05-10 14:59
額,但是運(yùn)行ifconfig命令,IP還是沒(méi)有改變,而且resolv.conf文件內(nèi)容并沒(méi)有跟著配置的修改而改變。仍需繼續(xù)努力啊