以下是Centos5.5配置DHCP过程,(IP:192.168.1.150 网关:192.168.1.254 子网掩码:255.255.255.0 DNS:192.168.1.150 202.96.128.166 域名:seakv.com)
一 安装 DHCP
yum -y install dhcp
二 配置 DHCP (红色部分根据自己的实际情况进行修改)
[root@tonecan ~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
[root@tonecan ~]# vim /etc/dhcpd.conf
ddns-update-style interim; #(interim,ad-hoc,none三种启动模式) ignore client-updates; #(none:表示不支持动态更新,interim:表示DNS互动更新模式,ad-hoc:表示特殊DNS更新模式)
subnet 192.168.1.0 netmask 255.255.255.0 {
# --- default gateway option routers 192.168.1.254; # 网关 option subnet-mask 255.255.255.0; # 子网掩码
option nis-domain "seakv.com"; # 主机所在NIS域的名称 option domain-name "seakv.com"; # 主机所在域的名称 option domain-name-servers 192.168.1.150,202.96.128.86; # DNS设置
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.1 192.168.1.253; # IP地址池 default-lease-time 21600; max-lease-time 43200;
# we want the nameserver to appear at a fixed address host ns { (保留地址 固定IP(类似IPMAC绑定,可绑定多个) next-server marvin.redhat.com; hardware ethernet 12:34:56:78:AB:CD; fixed-address 192.168.1.149; } }
|
三 指定DHCP服务的网络接口
[root@tonecan ~]# vi /etc/sysconfig/dhcpd
# Command line options here DHCPDARGS=eth0 |
四 启动DHCP服务
[root@tonecan ~]# service dhcpd start
启动 dhcpd: [确定]
五 测试。