歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

Red Hat Enterprise Linux 6.2配置DHCP步驟

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

2、yum install dhcp         #用YUM安裝DHCP

3、Linux 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; #網關地址

}

}

5、Linux DHCP配置 啟動和關閉DHCP服務器

service dhcpd start #開啟dhcp服務

service dhcpd stop #關閉dhcp服務

service dhcpd restart #重啟dhcp服務

6、客戶端獲取IP 地址

7、Linux DHCP配置 查看地址池中已經分配的IP記錄

cat /var/lib/dhcpd/dhcpd.leases

本文出自 “運維工作奮斗” 博客,請務必保留此出處http://yanghuawu.blog.51cto.com/2638960/898691

Copyright © Linux教程網 All Rights Reserved