+ -
当前位置:首页 → 问答吧 → 有关dhcp配置的问题

有关dhcp配置的问题

时间:2011-01-04

来源:互联网

小弟在配置dhcp的时候遇到了一个棘手的问题,由于小弟经验不足,无法搞定,还望各位大侠求助
问题是这样的。先说下我的环境,我是在虚拟机中配置dhcp。由于想使用putty,于是网卡由vm自动分配IP地址,然后安装dhcp软件包,配置完成后弹出启动,发现报错信息WARNING: Host declarations are global.  They are not limited to the scope you declared them in.于是添加了一快网卡,将其设置成静态IP,然后配置dhcpd.conf。发现报错信息。
  1. dhcpd: WARNING: Host declarations are global.  They are not limited to the scope you declared them in.
  2. Jan  4 20:38:33 localhost dhcpd: Wrote 0 deleted host decls to leases file.
  3. Jan  4 20:38:33 localhost dhcpd: Wrote 0 new dynamic host decls to leases file.
  4. Jan  4 20:38:33 localhost dhcpd: Wrote 0 leases to leases file.
  5. Jan  4 20:38:33 localhost dhcpd: Listening on LPF/eth1/00:0c:29:59:a8:ad/192.168.1/24
  6. Jan  4 20:38:33 localhost dhcpd: Sending on   LPF/eth1/00:0c:29:59:a8:ad/192.168.1/24
  7. Jan  4 20:38:33 localhost dhcpd:
  8. Jan  4 20:38:33 localhost dhcpd: No subnet declaration for eth0 (192.168.137.128).
  9. Jan  4 20:38:33 localhost dhcpd: ** Ignoring requests on eth0.  If this is not what
  10. Jan  4 20:38:33 localhost dhcpd:    you want, please write a subnet declaration
  11. Jan  4 20:38:33 localhost dhcpd:    in your dhcpd.conf file for the network segment
  12. Jan  4 20:38:33 localhost dhcpd:    to which interface eth0 is attached. **
  13. Jan  4 20:38:33 localhost dhcpd:
  14. Jan  4 20:38:33 localhost dhcpd: Sending on   Socket/fallback/fallback-net
复制代码
注:eth0即连接外网和putty的网卡,其IP为192.168.137.128。
在此小弟不理解,报错信息中所示的LPF是什么意思呢?为何会出现如此的报错信息?
顺便贴出dhcpd.conf的配置文件
  1. ddns-update-style interim;
  2. ignore client-updates;
  3. subnet 192.168.1.0 netmask 255.255.255.0 {
  4. # --- default gateway
  5.         option routers                        192.168.1.1;
  6.         option subnet-mask                255.255.255.0;

  7.         option nis-domain                "domain.org";
  8.         option domain-name                "domain.org";
  9.         option domain-name-servers        192.168.1.1;

  10.         option time-offset                -18000;        # Eastern Standard Time
  11.         range dynamic-bootp 192.168.1.2 192.168.1.254;
  12.         default-lease-time 21600;
  13.         max-lease-time 43200;
  14.         host ns {
  15.                 next-server marvin.redhat.com;
  16.                 hardware ethernet 12:34:56:78:AB:CD;
  17.                 fixed-address 207.175.42.254;
  18.         }
复制代码
试问下,该配置文件有什么地方不妥呢?为何会引起上述的报错信息呢?
如果在虚拟机环境下,想使用外网连接putty,又使用dhcp服务器,此时应该配置单网卡还是双网卡呢?应该怎么部署dhcp配置文件及其相关文件呢?
以上的报错又是由何引起的呢?
如果在双网卡的生产环境下,部署dhcp服务器,是否修改/etc/sysconfig/dhcpd文件中的DHCPDARGS="eth1"即可呢eth1为连接内网的网卡

还望各位大侠多多帮帮我,纠结很久了。谢谢各位大侠的看帖和回帖~~~辛苦了~~

作者: 宁愿冷酷到底   发布时间: 2011-01-04

回复 宁愿冷酷到底


    还是不清楚你具体的网络拓扑

   你的意思就是 虚拟机  和  真机环境吗?

     真机用putty 连接虚拟机?

    还是?  麻烦你说具体点!  

    是vm虚拟机吗?

    DHCP 你最好关闭vm虚拟机 编辑菜单 虚拟网络 里面的 DHCP分配!

    还有你再具体说下你的网络环境!

作者: taojie2000   发布时间: 2011-01-04

不好意思,我在描述下我的环境:
我使用vm虚拟机搭建虚拟网络,真机使用putty远程ssh连接虚拟机,虚拟机中有一网卡连接外网,在此环境下,配置dhcp发现报错信息,WARNING: Host declarations are global.They are not limited to the scope you declared them in.个人理解为该虚拟网卡为外网网卡,需要指定一个静态IP配置dhcp。于是添加一个内网网卡,还是有这个报错。

我的意思是说,虚拟机允许和外网通讯的情况下,如何配置dhcp服务?因为dhcp服务需要一个静态的IP地址,单网卡能否实现?如何实现?如果实现不了,那么配置双网卡的话,怎样的拓扑才能实现即能连接外网又能使用dhcp服务器为网络中的主机分配IP地址。

作者: 宁愿冷酷到底   发布时间: 2011-01-04

回复 宁愿冷酷到底


   我以前做过  虚拟机有一个网卡能上外网 就不需要 搭建DHCP    桥接到真机就OK  !

   两个网卡  一个内网 一个外网!  虚拟机的上外网依靠真机的!  如果你虚拟机搭建了DHCP服务 它把IP 分给谁?  真机为了虚拟机上外网 它还要必须能正常联网!

   如果你想内外网 还必须用DHCP  最好再启第2个虚拟机 做内网机器  用DHCP的那台虚拟机给它分配IP!

作者: taojie2000   发布时间: 2011-01-04

做部分实验 会发现最少要开2个虚拟机 才能模拟真实网络环境!

我以前用的环境  就是   外网-真机-桥接-虚拟服务器-hostonly-vmnet1-虚拟内网

虚拟服务器设置内核forward!

作者: taojie2000   发布时间: 2011-01-05