linux下安装配置DHCP服务器

前提是已经安装了 core 及 base 两个组

 

1
2
3
4
5
# cat /etc/redhat-release  
Red Hat Enterprise Linux Server release 6.8 (Santiago)  
# uname -a 
Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 
11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

修改本机IP为静态获取

1
2
3
4
5
6
7
8
9
10
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 
TYPE=Ethernet 
ONBOOT=yes 
NM_CONTROLLED=yes 
BOOTPROTO=static 
IPADDR=192.168.101.11 
NETMASK=255.255.255.0 
GATEWAY=192.168.101.1
# service network restart

关闭 selinux

1
2
3
4
5
6
7
8
9
10
11
12
# vi /etc/sysconfig/selinux 
# This file controls the state of SELinux on the system. 
# SELINUX= can take one of these three values: 
#     enforcing – SELinux security policy is enforced. 
#     permissive – SELinux prints warnings instead of enforcing. 
#     disabled – No SELinux policy is loaded. 
#SELINUX=enforcing 
SELINUX=disabled 
# SELINUXTYPE= can take one of these two values: 
#     targeted – Targeted processes are protected, 
#     mls – Multi Level Security protection. 
SELINUXTYPE=targeted

安装服务器组件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# mkdir /mnt/cdrom 
# mount /dev/cdrom /mnt/cdrom/ 
mount: block device /dev/sr0 is write-protected, mounting read-only 
  
# cd /mnt/cdrom/Packages/ 
# ls dhcp* 
dhcp-4.1.1-34.P1.el6.x86_64.rpm  
dhcp-common-4.1.1-34.P1.el6.x86_64.rpm 
  
#安装 DHCP 软件包 
# rpm -Uvh dhcp-4.1.1-34.P1.el6.x86_64.rpm  
error: Failed dependencies: 
        portreserve is needed by dhcp-12:4.1.1-34.P1.el6.x86_64 
  
#解决包的依赖性 
# rpm -Uvh dhcp-4.1.1-34.P1.el6.x86_64.rpm \ 
 portreserve-0.0.4-9.el6.x86_64.rpm  
Preparing…                ########################### [100%] 
   1:portreserve            ########################### [ 50%] 
   2:dhcp                    ########################### [100%]

更改配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# cat dhcpd.conf 
option domain-name “bigcloud.local”;#此处设置主机名
option domain-name-servers 192.168.188.11, 192.168.188.12;#此处设置默认DNS
subnet 192.168.188.0  netmask 255.255.255.0 {   #此处设置第一个子网
  range dynamic-bootp 192.168.188.100  192.168.188.160;  #此处设定为不连续的IP段
  range dynamic-bootp 192.168.188.169  192.168.188.253;
  default-lease-time 259200; #默认租约时间
  max-lease-time 259200;
  option routers 192.168.188.2;  # 默认网关
}
subnet 192.168.189.0  netmask 255.255.255.0 {    #第二个子网
  range dynamic-bootp 192.168.189.100  192.168.189.253;
  default-lease-time 691200;
  max-lease-time 691200;
  option routers 192.168.189.2;
}
host pc1 {     #为某一台主机单独配置静态IP
  hardware ethernet 00:12:34:56:78:90;
  fixed-address 192.168.188.111;
#启动服务。 
# service dhcpd start 
Starting dhcpd:                                            [  OK  ]

原创文章,作者:zero,如若转载,请注明出处:http://www.178linux.com/74747

(1)
zerozero
上一篇 2017-05-03
下一篇 2017-05-04

相关推荐

  • linux时间

    linux有两个时间:     系统时间和硬件时间 系统时间: 最简单的使用date命令显示当前系统的时间,命令行输入date。 # date Thu Jun  2 17:11:48 CST 2016 date的具体使用方式:     1. date格式显示:date …

    Linux干货 2016-06-03
  • linux基础学习之SElinux

    1、SElinux简介 SELinux: Secure Enhanced Linux,是美国国家安全局「NSA=The National Security Agency」和SCC(Secure Computing Corporation)开发的Linux的一个强制访问控制的安全模块。2000年以GNU GPL发布,Linux内核2.6版本后集成在内核中 2、…

    Linux干货 2016-09-15
  • WEB 常见故障与处理

    一、应用故障 HTTP 502 故障 502 Bad Gateway 故障检测: 首先定位到前端故障服务器节点,在前端服务器(Telnet)上访问后端服务端口响应时间。如发现响应时间超时>10s。说明后端应用程序出现故障。需要到后端服务器查看,并查明情况。 PS:HTTP 502 Bad Gateway 故障一般分为以下2种情况: 网络问题:前端无法连…

    2016-06-03
  • gawk

    简介     AWK是一种优良的文本处理工具。它不仅是 Linux 中也是任何环境中现有的功能最强大的数据处理引擎之一。AWK 提供了极其强大的功能:可以进行样式装入、流控制、数学运算符、进程控制语句甚至于内置的变量和函数。它具备了一个完整的语言所应具有的几乎所有精美特性。实际上 AWK 的确拥有自…

    Linux干货 2016-03-25
  • 自我介绍

    个人简介     基本信息:     何秋雨,男,安徽人,22岁,初中学历 工作经验:     目前就职于南京的一家互联网公司做Java Web 开发,大概有一年半的工作经验。工作内容包括前端和Java后端两个部分。 个人爱好:   &nb…

    Linux干货 2016-08-08
  • 马哥教育网络班21期-第三周课程练习

    第三周课程练习 1、列出当前系统上所有已经登录的用户的用户名,注意:同一个用户登录多次,则只显示一次即可。 [root@localhost ~]# who | cut -f1 -d' ' | uniq  root 2、取出最后登录到当前系统的用…

    Linux干货 2016-07-12

评论列表(1条)

  • 成都
    成都 2018-02-16 09:57

    请问代码怎么插入的?