要求,1、DHCP的IP192.168.1.252
2、分配192.168.1.10-200的IP地址,
3、A主机,固定IP
A 00:0C:29:A8:43:F0 192.168.1.100
步骤:
一、安装DHCP服务
rpm -ivh dhcp-3(tab)
二、配置文件
1、配置本机IP地址
vim /etc/sysconfig/network-scripts/ifcfg-eth0 永久配置
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.252
NETMASK=255.255.255.0
GATEMAY=192.168.1.1
HWADDR=00:0C:29:A8:43:F0
ONBOOT=yes
ifconfig eth0 192.168.1.252/24 临时配置(重启无效)
1、配置DHCP
vim /etc/dhcpd.conf DHCP主配置文件
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {网段
option routers 192.168.1.1;网关
option subnet-mask 255.255.255.0;掩码
optionnis-domain "domain.org";
option domain-name "tarena.com";域名
option domain-name-servers 202.160.0.20; DNS
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.1.20 192.168.1.200;地址池
default-lease-time 21600;默认租期
max-lease-time 43200;最大租期
# we want the nameserver to appear at a fixed address
host ns {
next-server marvin.redhat.com;
hardwareethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}
host post {
next-server marvin.redhat.com;
hardware ethernet 00:0C:29:A8:43:F0;//指定MAC地址,为其分配下面的IP
fixed-address 192.168.1.100;
}
service dhcpd restart 重启服务
chkconfigdhcpd on 开机自启
service dhcpdconfigtest排错(失败记录)
三、客户端验证
Linux:
vim /etc/sysconfig/network-scripts/ifcfg-eth0 永久配置
DEVICE=eth0
BOOTPROTO=dhcp
# dhclient -d eth0 临时获取
# dhclient -r eth0 释放
Ifconfig eth0 查看IP
Windows:
cmd>ipconfig /release 释放ip
cmd>ipconfig /renew 重新获取
cmd>ipconfig查看IP
备:
/etc/sysconfig/network-scripts/ifcfg-eth0 网卡配置
cat /etc/sysconfig/network 计算机名
cat /etc/hosts 本地DNS记录
cat /etc/resolv.conf DNS配置文件
service network restart 重启网络服务
架建一台LINUX的DHCP服务器,布布扣,bubuko.com
原文地址:http://9054321.blog.51cto.com/9044321/1426451