阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

最简单的DHCP服务

128次阅读
没有评论

共计 2385 个字符,预计需要花费 6 分钟才能阅读完成。

这几天在准备网络安装 linux 操作系统。最后决定用 pxe + kickstart 的方式完成。原理、方案弄完了之后,开始搭建,结果被 DHCP 给挡住了。这不就得研究研究最简单最实用的 DHCP 使用方法。

* 红色的是必须有

* 绿色的是要注意

 

* 蓝色的是包安装时,要有的程序包

 

1. DHCP 的实现

2. 配置文件实例

实例 1

实例 2

—————————————————————–

1. DHCP 的实现

DHCP 服务必须给本网段提供一个地址池。

 

# yum -y install dhcp-devel

# rpm -aq | grep dhcp

dhcp-4.1.1-38.P1.el6.CentOS.i686

dhcp-devel-4.1.1-38.P1.el6.centos.i686

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

 

# vi dhcpd.conf

ddns-update-style interim( 这项不能少,否则服务起不来的 )

default-lease-time 21600;

max-lease-time 43200;

option domain-name test.com;

option domain-name-servers 192.168.1.1,202.106.0.20;

 

subnet 192.168.1.0 netmask 255.255.2550 {

range 192.168.1.128 192.168.1.254;

option subnet-mask 255.255.255.0;

option routers 192.168.1.1;

}

 

host server01 {

hardware ethernet 0:c0:c3:22:46:81;

fixed-address 192.168.1.11;

option subnet-mask 255.255.255.0;

option routers 192.168.1.1;

}

 

subnet 117.34.70.0 netmask 255.255.255.0 {

default-lease-time 21600;

max-lease-time 43200;

option routers 117.34.70.1;

option subnet-mask 255.255.255.0;

 

}

 

一台主机有多块网卡,需要在某个网卡上启用 DHCP 服务时,需要配置如下:

# vi /etc/sysconfig/dhcpd

 

# Command line options here

DHCPDARGS=eth0

 

 

——————————

2. 配置文件实例

简单的样例:(红色部分必须有)

 

# vi /etc/dhcp/dhcpd.conf

# dhcpd.conf

# Sample configuration file for ISC dhcpd

# option definitions common to all supported networks…

 

option domain-name “example.org”;

option domain-name-servers ns1.example.org, ns2.example.org;

 

default-lease-time 600;

max-lease-time 7200;

 

# Use this to enble / disable dynamic dns updates globally.

ddns-update-style none;

 

# If this DHCP server is the official DHCP server for the local

# network, the authoritative directive should be uncommented.

#authoritative;

 

# Use this to send dhcp log messages to a different log file (you also

# have to hack syslog.conf to complete the redirection).

log-facility local7;

 

# No service will be given on this subnet, but declaring it helps the

# DHCP server to understand the network topology.

 

subnet 117.34.73.0 netmask 255.255.255.0 {

}

 

subnet 10.152.187.0 netmask 255.255.255.0 {

}

 

# vi /etc/dhcp/dhcpd.conf

default-lease-time 600;

max-lease-time 7200;

 

ddns-update-style none;

 

subnet 117.34.73.0 netmask 255.255.255.0 {

}

相关阅读:

Linux 系统下构建 DHCP 服务器 http://www.linuxidc.com/Linux/2013-06/86531.htm

CentOS 下配置主从 DNS 服务器以及 DHCP 下的 DDNS http://www.linuxidc.com/Linux/2013-06/85634.htm

SUSE Linux 11 pxe+DHCP+tftp+ftp 无人值守安装 http://www.linuxidc.com/Linux/2013-06/85481.htm

Linux 下架设 DHCP 服务器过程及 3 种测试 http://www.linuxidc.com/Linux/2013-05/84832.htm

Linux 上一步一步实现 DHCP 服务器 http://www.linuxidc.com/Linux/2013-04/82244.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计2385字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中