免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123下一页
最近访问板块 发新帖
查看: 5748 | 回复: 23
打印 上一主题 下一主题

[服务应用] DHCP服务器搭建遇到的问题,求帮忙 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-05-08 17:21 |只看该作者 |倒序浏览
我的Linux系统是基于虚拟机创建的,在搭建DHCP服务器过程中遇到以下问题
1、在修改/etc/dhcpd.conf文件时,subnet XXXXXXXXXXXX 其中XXXXXXXXXXXX应该填写什么。虚拟机网络IP地址为192.168.44.128,WIN7本地连接IP地址为192.168.9.100
2、进行cp /usr/share/doc/dhcp-4.2.4/dhcpd.conf.sample /etc/dhcpd.conf ,其中dhcpd.conf文件中的内容应该怎样修改啊,我的文件内容如下,请问应该怎样进行修改。
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时,提示Redirecting to /bin/systemctl  start dhcpd.service 请问是什么意思啊,怎么解决呢?

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
2 [报告]
发表于 2013-05-08 18:00 |只看该作者
subnet XXXXXXXXXXXX 其中XXXXXXXXXXXX应该填写什么--->写上虚拟机网络192.168.44.0

3、在终端输入service dhcpd start时,提示Redirecting to /bin/systemctl猀琀愀爀琀 dhcpd.service 请问是什么意思啊,怎么解决呢?

你用的是fedora吧,那个是正常的,fedora新版本用systemd取代了以前的init.d

论坛徽章:
0
3 [报告]
发表于 2013-05-10 08:28 |只看该作者
用的是fedora 17版的,但是运行service dhcpd start时,DHCP服务器并没有成功启动。

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
4 [报告]
发表于 2013-05-10 08:29 |只看该作者
报错信息是啥

论坛徽章:
0
5 [报告]
发表于 2013-05-10 08:44 |只看该作者
就是Redirecting to /bin/systemctl  start dhcpd.service

论坛徽章:
0
6 [报告]
发表于 2013-05-10 08:46 |只看该作者
帮忙看看配置文件该怎么修改啊,这么多内容,都不知道该改哪儿,什么该删什么该改?

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
7 [报告]
发表于 2013-05-10 09:10 |只看该作者
本帖最后由 chenyx 于 2013-05-10 09:12 编辑

27行以后的都可以删除,然后添加你自己的subnet
照着32~35行的内容添加
  1. subnet 192.168.44.0 netmask 255.255.255.0 {
  2.         range 192.168.44.10 192.168.44.20;
  3.        option routers 192.168.44.2;
  4.        option domain-name-servers 192.168.42.1;
  5.       }
复制代码

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
8 [报告]
发表于 2013-05-10 09:12 |只看该作者
range后面是你想分配的ip范围
routers指定的是dhcp客户端获取到的网关的ip
domain-name-servers客户端获取的dns的地址

论坛徽章:
0
9 [报告]
发表于 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        
端口打开了,但是在查看日志文件的时候,却显示
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服务器是吗?

论坛徽章:
16
IT运维版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每月发帖之星
日期:2015-09-11 19:30:52IT运维版块每周发帖之星
日期:2015-09-11 19:20:31IT运维版块每日发帖之星
日期:2015-08-26 06:20:00每日论坛发贴之星
日期:2015-08-20 06:20:00IT运维版块每日发帖之星
日期:2015-08-20 06:20:002015年辞旧岁徽章
日期:2015-03-03 16:54:15金牛座
日期:2014-05-04 16:58:09双子座
日期:2013-12-17 16:44:37辰龙
日期:2013-11-22 15:20:59狮子座
日期:2013-11-18 22:55:08射手座
日期:2013-11-12 10:54:26
10 [报告]
发表于 2013-05-10 09:54 |只看该作者
配置还有问题。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP