Fedora8中DHCP服务的配置

DHCP基于客户/服务器模式。当DHCP客户端启动时,它会自动与DHCP服务器通信,由DHCP服务器为DHCP客户端提供自动分配IP地址的服务。安装了DHCP服务软件的服务器称为DHCP服务器,而启用了
DHCP功能的客户机称为DHCP客户端。DHCP服务器是以地址租约的方式为DHCP客户端
提供服务的,它有以下两种方式。
1.限定租期
2.永久租用
一、 安装
[root@localhost etc]# cd /media/Fedora\ 8\ i386\ DVD/Packages/
[root@localhost Packages]# find . -name "*dhcp*"
./dhcpv6-client-0.10-51.fc8.i386.rpm
./libdhcp-1.27-3.fc8.i386.rpm
./libdhcp4client-3.0.6-10.fc8.i386.rpm
./libdhcp6client-0.10-51.fc8.i386.rpm
[root@localhost Packages]# rpm -ivh libdhcp-1.27-3.fc8.i386.rpm
warning: libdhcp-1.27-3.fc8.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...        ########################################### [100%]
        package libdhcp-1.27-3.fc8 is already installed
[root@localhost Packages]# rpm -ivh libdhcp4client-3.0.6-10.fc8.i386.rpm
warning: libdhcp4client-3.0.6-10.fc8.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...        ########################################### [100%]
        package libdhcp4client-3.0.6-10.fc8 is already installed
[root@localhost DHCP]# rpm -ivh dhcp-3.0.6-10.fc8.i386.rpm
warning: dhcp-3.0.6-10.fc8.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...        ########################################### [100%]
   1:dhcp         ########################################### [100%]
*********************************************************************DHCP配置文件dhcpd.conf的格式如下:
*******************************
选项/参数 # 这些选项/参数全局有效
声明{
  选项/参数 # 这些选项/参数局部有效
}
*********************************************************************
dhcpd.conf文件中常用的声明及功能
********************************
声明                                         功能
shared-network 名称 {…}                 定义超级作用域
subnet 网络号 netmask 子网掩码 {…}       定义作用域(或IP子网)
range 起始IP地址 终止IP地址               定义作用域(或IP子网)范围
host 主机名 {…}                          定义保留地址
group {…}                                 定义一组参数
*********************************************************************
dhcpd.conf文件中常用的参数及功能 :
*******************************
参数                                  功能
ddns-update-style 类型          定义所支持的DNS动态更新类型(必选)
allow/ignore client-updates      允许/忽略客户机更新DNS记录
default-lease-time 数字          指定默认的租约期限
max-lease-time 数字              指定最大租约期限
hardware 硬件类型 MAC地址    指定网卡接口类型和MAC地址
server-name 主机名              通知DHCP客户机服务器的主机名
fixed-address  IP地址           分配给客户端一个固定的IP地址
*********************************************************************dhcpd.conf文件中常用的选项及功能:
******************************
选项                                  功能
subnet-mask 子网掩码         为客户端指定子网掩码
domain-name “域名”         为客户端指定DNS域名
domain-name-servers  IP地址  为客户端指定DNS服务器的IP地址
host-name “主机名”          为客户端指定主机名
routers  IP地址                为客户端指定默认网关
broadcast-address 广播地址     为客户端指定广播地址
netbios-name-servers  IP地址  为客户端指定WINS服务器的IP地址
netbios-node-type 节点类型      为客户端指定节点类型
ntp-server  IP地址             为客户端指定网络时间服务器的IP地址
nis-servers  IP地址             为客户端指定NIS域服务器的地址
nis-domain “名称”          为客户端指定所属的NIS域的名称
time-offset 偏移差             为客户端指定与格林尼治时间的偏移差
*********************************************************************
二、 dhcp配置文件/etc/dhcpd.conf默认是空的
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
例子/usr/share/doc/dhcp-3.0.6/dhcpd.conf.sample 从例子拷贝到/etc/dhcpd.conf
*********************************************************************
dhcpd.conf.sample源文件内容:
*****************************
[root@localhost dhcp-3.0.6]# more dhcpd.conf.sample
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
        option routers                  192.168.0.1;
        option subnet-mask              255.255.255.0;
        option nis-domain               "domain.org";
        option domain-name              "domain.org";
        option domain-name-servers      192.168.1.1;
        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;
        range dynamic-bootp 192.168.0.128 192.168.0.254;
        default-lease-time 21600;
        max-lease-time 43200;
        # 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;
        }
}
三、 修改后/etc/dhcpd.conf内容:
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {    注:修改
# --- default gateway
        option routers                  192.168.1.1;      注:修改
        option subnet-mask              255.255.255.0;    注:修改
        option nis-domain               "jw.com";     注:修改
        option domain-name              "jw.com";     注:修改
        option domain-name-servers      192.168.1.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;
        range dynamic-bootp 192.168.1.100 192.168.1.110;
        default-lease-time 21600;
        max-lease-time 43200;
        # 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@localhost etc]# /etc/rc.d/init.d/dhcpd start
启动 dhcpd:                                               [确定]
在XP下测试通过
四、 关闭
[root@localhost etc]# /etc/rc.d/init.d/dhcpd stop
关闭 dhcpd:

你可能感兴趣的:(DHCP)