network

  IT博客 :: 首页 :: 联系 :: 聚合  :: 管理
  28 Posts :: 8 Stories :: 0 Comments :: 0 Trackbacks

下载最新的dhcp***.tar.gz

 cp dhpc***.tar.gz /tmp
   tar xvzf dhcp***.tar.gz
   cd dhcp***
   ./configure
   
   make
   make install
      
   cp server/dhcpd.conf  /etc/
   
   /etc/init.d/dhcdbd start

 开机启动
 chkconfig --add dhcdbd
  chkconfig --level  2345 dhcdbd on
 
 设置单域dhcp

vi /etc/dhcpd.conf

  #option domain-name "example";

 ddns-update-style ad-hoc

 option domain-name-servers 192.168.1.1;

 default-lease-time 600;
   
   max-lease-time 7200;

 authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {
            range 192.168.1.10 192.168.1.200;
            option routers 192.168.1.254;
   }


 更多配置,请查看dhcpd.conf


  还有一个要注意的地方,

 那就是以tar安装的包..在/tmp/dhcp***/server/dhcpd.leases.5中有个说明,
 需要一个DHCP Client database

dhcpd.leases - DHCP client lease database

有这样一段

hen dhcpd is first installed, there is no lease database.   However,
dhcpd requires that a lease database be present before it will start.
To make the initial lease database, just create an empty file called
DBDIR/dhcpd.leases.   You can do this with:
.PP
.nf
        touch DBDIR/dhcpd.leases


 所以在启动服务前最好在

 /var/state/dhcp/ 目录下面新建一个dhcpd.leases

 touch /var/state/dhcp/dhcpd.leases

另在/tmp/dhcp***/README 中找到一段在LINUX下安装DHCP服务器的说明
如下:
  LINUX: BROADCAST

If you are running a recent version of Linux, this won't be a problem,
but on older versions of Linux (kernel versions prior to 2.2), there
is a potential problem with the broadcast address being sent
incorrectly.

In order for dhcpd to work correctly with picky DHCP clients (e.g.,
Windows 95), it must be able to send packets with an IP destination
address of 255.255.255.255.  Unfortunately, Linux changes an IP
destination of 255.255.255.255 into the local subnet broadcast address
(here, that's 192.5.5.223).

This isn't generally a problem on Linux 2.2 and later kernels, since
we completely bypass the Linux IP stack, but on old versions of Linux
2.1 and all versions of Linux prior to 2.1, it is a problem - pickier
DHCP clients connected to the same network as the ISC DHCP server or
ISC relay agent will not see messages from the DHCP server.   It *is*
possible to run into trouble with this on Linux 2.2 and later if you
are running a verson of the DHCP server that was compiled on a Linux
2.0 system, though.

It is possible to work around this problem on some versions of Linux
by creating a host route from your network interface address to
255.255.255.255.   The command you need to use to do this on Linux
varies from version to version.   The easiest version is:

        route add -host 255.255.255.255 dev eth0

On some older Linux systems, you will get an error if you try to do
this.   On those systems, try adding the following entry to your
/etc/hosts file:

255.255.255.255 all-ones

Then, try:

        route add -host all-ones dev eth0

Another route that has worked for some users is:

        route add -net 255.255.255.0 dev eth0

If you are not using eth0 as your network interface, you should
specify the network interface you *are* using in your route command.

                        LINUX: IP BOOTP AGENT

Some versions of the Linux 2.1 kernel apparently prevent dhcpd from
working unless you enable it by doing the following:

              echo 1 >/proc/sys/net/ipv4/ip_bootp_agent


                      LINUX: MULTIPLE INTERFACES

Very old versions of the Linux kernel do not provide a networking API
that allows dhcpd to operate correctly if the system has more than one
broadcast network interface.  However, Linux 2.0 kernels with version
numbers greater than or equal to 2.0.31 add an API feature: the
SO_BINDTODEVICE socket option.  If SO_BINDTODEVICE is present, it is
possible for dhcpd to operate on Linux with more than one network
interface.  In order to take advantage of this, you must be running a
2.0.31 or greater kernel, and you must have 2.0.31 or later system
headers installed *before* you build the DHCP Distribution.

We have heard reports that you must still add routes to 255.255.255.255
in order for the all-ones broadcast to work, even on 2.0.31 kernels.
In fact, you now need to add a route for each interface.   Hopefully
the Linux kernel gurus will get this straight eventually.

Linux 2.1 and later kernels do not use SO_BINDTODEVICE or require the
broadcast address hack, but do support multiple interfaces, using the
Linux Packet Filter.

                    LINUX: 802.1q VLAN INTERFACES

If you're using 802.1q vlan interfaces on Linux, it is necessary to
vconfig the subinterface(s) to rewrite the 802.1q information out of
packets received by the dhcpd daemon via LPF:

        vconfig set_flag eth1.523 1 1

Note that this may affect the performance of your system, since the
Linux kernel must rewrite packets received via this interface.  For
more information, consult the vconfig man pages.


 这个文件告诉我们..
It is possible to work around this problem on some versions of Linux
by creating a host route from your network interface address to
255.255.255.255.   The command you need to use to do this on Linux
varies from version to version.   The easiest version is

说明一些版本的LINUX上运行可能出再错误,我们需要添加一条
路由
  route add -host 255.255.255.255 dev eth0

On some older Linux systems, you will get an error if you try to do
this.   On those systems, try adding the following entry to your
/etc/hosts file:
255.255.255.255 all-ones 

 在一些老的版本的LINUX 可能会出现错误.所以我们得编辑
 /etc/hosts
 加入下面一行

255.255.255.255 all-ones (这个名字可以自己定义,方便记忆.你也可以写成255.255.255.255 dhcp.)

 然后在添加路由的时候,你可以用下面的命令:

  route add -host all-ones dev eth0;

Another route that has worked for some users is:

        route add -net 255.255.255.0 dev eth0
If you are not using eth0 as your network interface, you should
specify the network interface you *are* using in your route command.

 这个是说明是为了在你不使用eth0的时候.你可以用其它接口代替命令行中的接口.

 Some versions of the Linux 2.1 kernel apparently prevent dhcpd from
working unless you enable it by doing the following:

              echo 1 >/proc/sys/net/ipv4/ip_bootp_agent

             在现在新的版本里,可能用到的是

          echo 1 >/proc/sys/net/ipv4/ip_forward

 有一些版本的内核可能不允许dhcp工作.你就得使用下面的命令
  echo 1 >/proc/sys/net/ipv4/ip_bootp_agent

 端口多路复用问题.是针对一些老板本的内核.自己看着办吧!


最后就是一个802.1Q虚拟接口的问题....
没有研究过...
 



 

 
  


   

posted on 2008-06-18 00:37 network 阅读(321) 评论(0)  编辑 收藏 引用 所属分类: 學習心得
只有注册用户登录后才能发表评论。