linux上搭建DHCP服务

2019-11-28 04:55栏目:电脑操作

KugaHEL6.5 DHCP服务器搭建:

linux上搭建DHCP服务


 

DHCP服务器是用来分配给任何客商端IP地址用的,在XC60HEL 6.5中DHCP服务器搭建方法如下:

1.先是安装DHCP服务须要的软件包

第一步,通过yum安装dhcp服务:

 

命令:yum install dhcp

yum install dhcp*

其次步:备份dhcp的主配置文件:

 

命令:mv /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak

2.手工业编写翻译DHCP主配置文件/etc/dhcp/dhcpd.conf

其三步:拷贝dhcp模板文件作为主配置文件:

 

命令:cp /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcp/dhcpd.conf

配备内容如下

第四步:为dhcp配置文件加行号:

 

命令:vim /etc/dhcp/dhcod.conf

ddns-update-style none; 

命令::set nu(命令情势下)

default-lease-time 600; 

第五步:清空dhcp配置文件26行未来的持有剧情:

max-lease-time 1200; 

命令:d G(平常情势下)

option domain-name "ceshi.com"; 

第六步:在dhcp配置文件第27行开首增添如下内容:

option domain-name-servers 192.168.3.202; 

subnet *192.168.50.0*(**此处填需要配置的真实网段**) netmask *255.255.255.0*(**此处填需要配置的真实子网掩码**){

    range *192.168.50.100 192.168.50.200*(**此处填需要配置的真实地址池**)

    option routers *192.168.50.254*(**此处填需要配置的真实网关**)

}

subnet 192.168.3.0 netmask 255.255.255.0 { 

     range 192.168.3.190 192.168.3.210; 

     option subnet-mask  255.255.255.0; 

     option routers       192.168.3.253; 

  host Server01 { 

        hardware ethernet B0:51:8E:01:94:86; 

        fixed-address     192.168.3.202; 

  } 

}

 

3应用命令测量试验配置未见是不是留存语法错误

 

[[email protected] ~]# service dhcpd configtest

Syntax: OK

 

正常

 

4开启允许分配IP地址的主机端口文件

 

vim /etc/sysconfig/dhcpd

 

DHCPDARGS= eth0 

 

测验通过测量试验成功收获IP地址

 

Mar 28 10:17:13 localhost dhcpd: DHCPREQUEST for 192.168.3.190 from 00:23:4d:dc:36:41 (home) via eth0

Mar 28 10:17:13 localhost dhcpd: DHCPACK on 192.168.3.190 to 00:23:4d:dc:36:41 (home) via eth0

Mar 28 10:18:53 localhost named-sdb[4247]: network unreachable resolving 'py.qlogo.cn/A/IN': 2001:dc7:1000::1#53

Mar 28 10:19:48 localhost dhcpd: DHCPREQUEST for 192.168.0.163 from 18:87:96:a0:ec:33 via eth0: ignored (not authoritative).

Mar 28 10:22:13 localhost dhcpd: DHCPREQUEST for 192.168.3.190 from 00:23:4d:dc:36:41 (home) via eth0

Mar 28 10:22:13 localhost dhcpd: DHCPACK on 192.168.3.190 to 00:23:4d:dc:36:41 (home) via eth0

 

打响分配给MAC为00:23:4d:dc:36:41主机

 

DHCP中继让不一致网主机凌驾网段获取DHCP服务器分配IP,

 

1安装DHCP服务包

 

yum -y install dhcp*

 

2开启服务器的路由转载作用

 

vim /etc/sysctl.conf

 

将net.ipv4.ip_forward=0修改为1启用

 

动用命令让其纠正生效

 

sysctl -p

 

3安装允许DHCP中继接口及DHCP服务器改进文件

 

[[email protected] ~]# vim /etc/sysconfig/dhcrelay 

# Command line options here

INTERFACES="eth0 eth1"

DHCPSERVERS="192.168.3.202"

 

4开启服务

 

/etc/init.d/dhcrelay restart

 

1.率先安装DHCP服务须求的软件包 yum install dhcp* 2.手工编写翻译DHCP主配置文件/etc/dhcp/dhcpd.conf 配置内容如下 ddns-update-style non...

版权声明:本文由威尼斯人app发布于电脑操作,转载请注明出处:linux上搭建DHCP服务