Red Hat Enterprise Linux 6.2配置DHCP步骤

 

1、rpm -qa | grep dhcpd   #查看主机是否安装dhcp包

2yum install dhcp         #YUM安装DHCP

3Linux DHCP配置文件默认是没有的,可以手动去编写,或可到/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample目录下复制模板到/etc/dhcp/dhcpd.conf目录下

   # cp /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcp/dhcpd.conf

4、编辑配置文件

    #vim /etc/dhcp/dhcpd.conf  

Linux DHCP配置 单网配置文件    

ddns-update-style. interim;    #dhcp支持的dns动态更新方式

ignore client-updates;         #忽略客户端DNS动态更新

subnet 192.168.1.0 netmask 255.255.255.0 { #作用域网段

range 192.168.1.11 192.168.1.100; #ip地址段范围

option routers 192.168.1.253; #网关地址

option subnet-mask 255.255.255.0; #子网掩码

option domain-name "infogrid.local"; #域名

option domain-name-servers 192.168.1.100,202.96.134.133; #dns IP

option broadcast-address 192.168.1.255; #广播地址

default-lease-time 86400; #租期1天,秒数

max-lease-time 172800; #最长租期2天

#绑定pc1主机ip地址配置

host pc1 {

hardware ethernet 00:a0:cc:cf:9C:14; #绑定机MAC地址

fixed-address 192.168.1.20; #最长租期2天

}

host pc2 {

hardware ethernet 04:20:c1:f8:37:11;

fixed-address 192.168.1.30;

}

}

 

Linux DHCP配置 超网配置文件

#vim /etc/dhcp/dhcp.conf

ddns-update-style. interim;      #dhcp支持的dns动态更新方式

ignore client-updates;      #忽略客户端DNS动态更新

shared-network mynet {      #超网作用域选项,共同部分

option subnet-mask 255.255.255.0;      #子网掩码

option domain-name "infogrid.local";      #域名

option domain-name-servers 192.168.1.100;      #dns IP

option broadcast-address 192.168.1.255;      #广播地址

default-lease-time 86400;      #租期1天,秒数

max-lease-time 172800; #最长租期2天

subnet 192.168.1.0 netmask 255.255.255.0 { #1.0子网段

range 192.168.1.11 192.168.1.100; #ip地址段范围

option routers 192.168.1.253; #网关地址

   #绑定pc1主机ip地址配置

host pc1 {

hardware ethernet 00:a0:cc:cf:9C:14;

fixed-address 192.168.1.20;

}

#绑定pc2主机ip地址配置

host pc2 {

hardware ethernet 04:20:c1:f8:37:11;

fixed-address 192.168.1.30;

}

}

subnet 192.168.2.0 netmask 255.255.255.0 { #2.0子网段

range 192.168.2.10 192.168.2.100; #ip地址段范围

option routers 192.168.2.253; #网关地址

}

subnet 192.168.3.0 netmask 255.255.255.0 { #3.0子网段

range 192.168.3.10 192.168.3.100; #ip地址段范围

option routers 192.168.3.253; #网关地址

}

}

5Linux DHCP配置 启动和关闭DHCP服务器

     service dhcpd start #开启dhcp服务

     service dhcpd stop #关闭dhcp服务

     service dhcpd restart #重启dhcp服务

6、客户端获取IP 地址

7Linux DHCP配置 查看地址池中已经分配的IP记录

    cat /var/lib/dhcpd/dhcpd.leases

你可能感兴趣的:(linux,enterprise,DHCP)