blog » linux常用技巧 » DHCP服務器的配置

DHCP服務器的配置

DHCP服務器的配置

要點:注意dhcpd.conf配置要對,然後要查看地址池,到/var/lib/dhcp/dhcpd.leases文件中查看

安裝
安裝:rpm -ivh dhcp-3.0.1-54.EL4
檢查:rpm -ql dhcp

配置
1主配置文件
可以copy那/usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample下的配置文件到/etc/dhcpd.conf

例子:
ddns-update-style interim; #是否可以動態更新主機的dhs記錄,A記錄
ignore client-updates; #忽視客戶機的更新請求

subnet 192.168.0.0 netmask 255.255.255.0 { #DHCP本機的子網地址

# --- default gateway
option routers 192.168.0.1; #網關
option subnet-mask 255.255.255.0;

option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 192.168.1.1; #dns的服務器名
option time-offset -18000; # Eastern Standard Time #時間

range dynamic-bootp 192.168.0.128 192.168.0.254; #DHCP的地址池
default-lease-time 21600; #周期時間
max-lease-time 43200; #最大的租用時間

# we want the nameserver to appear at a fixed address以下為一台主機固定的IP地址
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}

2.地址池查看dhcpd.leases文件
/var/lib/dhcp/dhcpd.leases
文件格式
-lease ip-address {statements...}

lease 192.168.1.154{
-starts 1 2000/05/15 13:36:42;
-ends 1 2000/05/15 21:36:42;
-hardware ethernet 00:00:21:4e:3f:58;
-uid 00:00:21:4e:3f:58;
-client-hostneme "one";
}

3.客戶機的配置
NETWORKING=yes
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes

測試
1.啟動
service dhcpd start
2.檢查
ps -aul |grep dhcpd

RSS 2.0 | leave a response | trackback

17fav 收藏本文

Leave a Reply

收藏 & 分享

Powered by 17fav.com