分享

CentOS 5.2 下配置DHCP服务器全过程

 忧郁_小刚 2010-11-15
[root@linux /]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@linux /]# cd /mnt
[root@linux mnt]# cd CentOS/
[root@linux CentOS]# ll | grep dhcp
-rw-r--r-- 2 root root   895142 06-15 07:30 dhcp-3.0.5-13.el5.i386.rpm
-rw-r--r-- 2 root root   133684 06-15 07:30 dhcp-devel-3.0.5-13.el5.i386.rpm
-rw-r--r-- 2 root root   194577 06-15 07:30 dhcpv6-1.0.10-4.el5.i386.rpm
-rw-r--r-- 2 root root   122343 06-15 07:30 dhcpv6-client-1.0.10-4.el5.i386.rpm
-rw-r--r-- 2 root root    60689 06-15 07:36 libdhcp-1.20-5.el5.i386.rpm
-rw-r--r-- 2 root root   248045 06-15 07:36 libdhcp4client-3.0.5-13.el5.i386.rpm
-rw-r--r-- 2 root root   385180 06-15 07:36 libdhcp4client-devel-3.0.5-13.el5.i386.rpm
-rw-r--r-- 2 root root    89829 06-15 07:36 libdhcp6client-1.0.10-4.el5.i386.rpm
-rw-r--r-- 2 root root   123434 06-15 07:36 libdhcp6client-devel-1.0.10-4.el5.i386.rpm
-rw-r--r-- 2 root root    70592 06-15 07:36 libdhcp-devel-1.20-5.el5.i386.rpm
[root@linux CentOS]# rpm -qa | grep dhcp
dhcpv6-client-1.0.10-4.el5
[root@linux CentOS]# rpm -ivh dhcp-3.0.5-13.el5.i386.rpm
warning: dhcp-3.0.5-13.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
   1:dhcp                   ########################################### [100%]
[root@linux CentOS]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp:是否覆盖“/etc/dhcpd.conf”? y
[root@linux CentOS]# vi /etc/dhcpd.conf
[root@linux CentOS]# cat /etc/dhcpd.conf
ddns-update-style interim;
#ignore client-updates;
default-lease-time 21600;
max-lease-time 43200;
subnet 192.168.1.0 netmask 255.255.255.0 {
        range dynamic-bootp 192.168.1.100 192.168.1.200;

# --- default gateway
        option routers                  192.168.1.1;
        option subnet-mask              255.255.255.0;

#       option nis-domain               "domain.org";
        option domain-name              "huyinglong.com";
        option domain-name-servers      192.168.1.1,202.96.209.6;

#       option time-offset              -18000; # Eastern Standard Time
#       option ntp-servers              192.168.1.1;
#       option netbios-name-servers     192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#       option netbios-node-type 2;


        # we want the nameserver to appear at a fixed address
        host ns {
#               next-server marvin.redhat.com;
                hardware ethernet 12:34:56:78:AB:CD;
                fixed-address 207.175.42.254;
        }
}
[root@linux CentOS]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:3C:5B:4A  
          inet6 addr: fe80::20c:29ff:fe3c:5b4a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:66 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7068 (6.9 KiB)  TX bytes:2832 (2.7 KiB)
          Interrupt:169 Base address:0x2000

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3235 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3235 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4688172 (4.4 MiB)  TX bytes:4688172 (4.4 MiB)

[root@linux CentOS]# ifconfig eth0 192.168.1.11
[root@linux CentOS]# service dhcpd start
启动 dhcpd:                                               [确定]
[root@linux CentOS]# cat /var/lib/dhcpd/dhcpd.leases
# All times in this file are in UTC (GMT), not your local timezone.   This is
# not a bug, so please don't ask about it.   There is no portable way to
# store leases in the local timezone, so please don't request this as a
# feature.   If this is inconvenient or confusing to you, we sincerely
# apologize.   Seriously, though - don't ask.
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-V3.0.5-RedHat

lease 192.168.1.200 {
  starts 6 2008/12/06 09:14:53;
  ends 6 2008/12/06 15:14:53;
  tstp 6 2008/12/06 15:14:53;
  binding state active;
  next binding state free;
  hardware ethernet 00:c0:9f:4c:35:c7;
  uid "\001\000\300\237L5\307";
  client-hostname "bbsdiy";
}
lease 192.168.1.200 {
  starts 6 2008/12/06 09:14:53;
  ends 6 2008/12/06 09:16:17;
  tstp 6 2008/12/06 09:16:17;
  binding state free;
  hardware ethernet 00:c0:9f:4c:35:c7;
  uid "\001\000\300\237L5\307";
}
lease 192.168.1.200 {
  starts 6 2008/12/06 09:16:20;
  ends 6 2008/12/06 15:16:20;
  binding state active;
  next binding state free;
  hardware ethernet 00:c0:9f:4c:35:c7;
  uid "\001\000\300\237L5\307";
  client-hostname "bbsdiy";
}
lease 192.168.1.200 {
  starts 6 2008/12/06 09:16:20;
  ends 6 2008/12/06 15:16:20;
  binding state active;
  next binding state free;
  hardware ethernet 00:c0:9f:4c:35:c7;
  uid "\001\000\300\237L5\307";
  client-hostname "bbsdiy";
}
[root@linux CentOS]#

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多