一个简单的DHCP服务器搭建过程

DHCP的全称  Dynamic Host Configuration Protocol

 

安装RPM包:

    yum install dhcp

 

 

[root@test ~]# vi /etc/dhcp/dhcpd.conf

也可直接copy模板,修改一下即可:

[root@test ~]# cp -rf  /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample  /etc/dhcp/dhcpd.conf

 

 

[root@test ~]# cat /etc/dhcp/dhcpd.conf

#支持DDNS

ddns-update-style interim;             

#忽略DDNS更新 

ignore client-updates;

 

# A slightly different configuration for an internal subnet.

subnet 192.168.2.0 netmask 255.255.255.0 {      #声明作用域

  option routers 192.168.2.201;          #网关

  option subnet-mask 255.255.255.0;      #网关掩码

  option domain-name-servers 192.168.2.201;      #给客户机分配的DNS

  option domain-name "test";       #DNS NAME

  range 192.168.2.100 192.168.2.200;     #供自动获取的网段

  default-lease-time 600;

  max-lease-time 7200;

 

#固定IP分配

        host RAC-2 {                        #需要分配固定IP的主机名

                hardware ethernet 00:0c:29:83:b5:dc;    #需要分配固定IP的服务器MAC地址

                fixed-address 192.168.2.202;   #需要分配的固定IP

        }

}

[root@test ~]# cat /etc/sysconfig/dhcpd

# Command line options here

DHCPDARGS=eth0      #dhcpd启动时所带的网卡

 

重启服务,即可使用

[root@test ~]# service dhcpd restart

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章