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 20:38
下一篇 2017-05-04 08:22

相关推荐

  • 交互式与非交互式的区别

    交互式与非交互式shell /登录shell于非登录shell 外网连不上,教室装修太吵,相关资料找不到,云云不知所云,托托症又犯了 登录shell_非登录shell // .bash_profile .bashrc profile 文件的作用的执行顺序 http://blog.csdn.net/robertaqi/archive/2010/04/04/54…

    Linux干货 2017-06-11
  • 3、文本处理命令、用户与组命令练习

    1.列出当前系统上所有已登录用户的用户名,同一个用户登录,则只显示一次 [root@localhost ~]# who root     tty1         2016-08-23 06…

    Linux干货 2016-09-19
  • 程序包管理yum

    YUM: YellowdogUpdate Modifier,rpm的前端程序,用来解决软件包相关依赖性,可以在多个库之间定位软件包 存储了众多rpm包,以及包的相关的元数据文件(放置于特定目录下:repodata) 文件服务器:     ftp://     http:// &n…

    Linux干货 2016-08-23
  • shell脚本总结

    shell脚本简要总结 脚本调试 bash -n /path/to/some_script检测脚本中的语法错误 bash -x /path/to/some_script调试执行 变量 环境变量 变量声明、赋值:export name=VALUEdeclare -x name=VALUE 变量引用:$name, ${name} 显示所有环境变量: export…

    Linux干货 2016-08-21
  • 第十二周:httpd和lamp

    看了一下作业内容,发现所有的都在51cto上写过了。这里就不在做了。 毕竟当时几篇博客写下来,还是非常繁琐的,不想在写。 文档地址:RHEL6.8编译安装LAMP环境:httpd-2.4+mysql5.6+php5.5;基于LAMP环境部署WordPress: http://afterdawn.blog.51cto.com/7503144/1876171 配…

    Linux干货 2016-12-09
  • PXE

    BootStraping 系统提供 PXE 简介 PXE(preboot execute environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持通过网络启动操作系统,在启动过程中,终端要求服务器分配IP地址,再用TFTP(trivial file…

    Linux干货 2016-11-05

评论列表(1条)

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

    请问代码怎么插入的?