CentOS之dhcp篇.

一、DHCP(Dynamic Host Configuration Protocol):动态主机配置协议。

二、搭建DHCP服务器:
1、安装DHCP服务器组件:
[root@CentOS ~]#yum -y install dhcp
2、配置DHCP:
DHCP配置文件为/etc/dhcpd.conf,但该文件默认是没有内容的,可以从dhcp安装目录复制一个到/etc下。
[root@CentOS ~]#cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
[root@CentOS ~]#vi /etc/dhcpd.conf
ddns-update-style none;       #不要更新DDNS的设置
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.254;                   #网关
option subnet-mask 255.255.255.0;                 #子网掩码
option domain-name “mycentos";           #域名
option domain-name-servers 192.168.0.254,202.103.0.68;               #域名服务器地址
range 192.168.0.1 192.168.0.254;               #提供的IP地址段
default-lease-time 21600;             #默认租期
max-lease-time 43200;                 #最大租期
}
#以下内容为特定机器保留的IP
host game   {
   hardware ethernet 00:11:22:33:44:55;
   fixed-address 192.168.0.123;
}
编辑/etc/sysconfig/dhcpd文件为:
# Command line options here
DHCPDARGS=eth0

三、启动DHCP服务器
[root@CentOS ~]#service dhcpd start
让dhcp服务随系统而启动:
[root@CentOS ~]#chkconfig dhcpd on

查看dhcp分发地址日志: /var/lib/dhcp/dhcpd.leases

你可能感兴趣的:(centos,职场,DHCP,休闲)