natejeams 2010-04-06
Linux下DHCP服务端的配置
[root@loaclhost /]mount /dev/hdc /hdc //挂载光盘到/dev/
[root@loaclhost /]cd hdc/Server //进入关盘的Server目录
[root@loaclhost Server]rpm –ivh dhcp-3.0.5-7.el5.i386.rpm //rpm安装DHCP的服务器端
[root@loaclhost Server]cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf // 将/etc/dhcpd.conf替换成/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample
//小提示:DHCP服务器默认情况下是没有配置文件的,需要从/usr目录下复制样本,然后再进行修改,如果是熟练的工程师,可以直接创建。
[root@loaclhost Server]cd /etc
[root@loaclhost etc]vi dhcpd.conf
Ddns-update-style interim;
Ignore client-updates; //动态DNS解析
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"; //NIS域名为domain.org
Option domai-name "domain.org"; //域名为domain.org
Option domain-name-servers "192.168.1.1"; //DNS
Option time-offset -18000; # eastern Standard Time //
# Option ntp-servers 192.168.1.1;
# Option netbios-name-servers 192.168.1.1;
# --- Selscts point-to-point node (default is hybrid). don't change thisunless
# -- 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; //默认租约时间21600s
Max-lease-time 43200; //最大租约时间为43200s
# 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 192.168.0.11;
}
}
注:配置文件,红色部分为全局配置;蓝色部分为机遇MAC,主机名分配静态IP。
[root@localhost etc]ifconfig eth0 192.168.0.1
[root@localhost etc]service dhcpd restart //重新启动dhcpd服务