linux创建超级作用域,linux dhcp服务器 超级作用域

redhat下dhcp的配制

一.Dhcp动态主机地址协议

动态主机地址协议,给自动获取的客户端分配ip地址

整个过程:

1.客户端广播DHCP discover数据包寻×××器

2.服务端响应DHCP offer

3.客户端选择服务器DHCP request

4.服务器段发送ip地址信息DHCP ack

二.拓扑图

7b5038343fb2f329b76b98baab99fe20.png

环境:vmware下redhat为服务器xp为客户机网络模式均为hostonly

并且不使用vmware自带的dhcp功能

edbdeb76870007f38691a63aeec12ea8.png

三、配制过程

1.建立目录并挂载光盘

[root@dg ~]# mkdir /mnt/cdrom

[root@dg ~]# mount /dev/cdrom /mnt/cdrom

mount: block device /dev/cdrom is write-protected, mounting read-only

2.切换目录并安装Dhcp服务

[root@dg ~]# cd /mnt/cdrom/Server/

[root@dg Server]# ll dhcp*

-r--r--r-- 108 root root 886718 2009-07-16 dhcp-3.0.5-21.el5.i386.rpm

-r--r--r-- 125 root root 134127 2009-07-16 dhcp-devel-3.0.5-21.el5.i386.rpm

-r--r--r-- 108 root root 196554 2009-07-16 dhcpv6-1.0.10-17.el5.i386.rpm

-r--r--r-- 108 root root 125916 2009-07-16 dhcpv6-client-1.0.10-17.el5.i386.rpm

[root@dg Server]# rpm -ivh dhcp-3.0.5-21.el5.i386.rpm

warning: dhcp-3.0.5-21.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...########################################### [100%]

package dhcp-3.0.5-21.el5.i386 is already installed

3.修改配制文件

[root@dg Server]# vim /etc/dhcpd.conf

进去后原始没有几行数据在命令行模式下输入

:r /usr/share/doc/dhcp-3.0.5/dhcpd.confß中间可以用Tab键补全

进入后配置如下

#

ddns-update-style interim;

ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {ß作用域、子网掩码

# --- default gateway

option routers192.168.1.254;网关

option subnet-mask255.255.255.0;

option nis-domain"domain.org";

option domain-name"dg.com";dns服务器域名

option domain-name-servers192.168.1.1;dns服务器地址

option time-offset-18000; # Eastern Standard Time

#option ntp-servers192.168.1.1;

#option netbios-name-servers192.168.1.1;

# --- Selects point-to-point node (default is hybrid). Don't change this unless

# -- you understand Netbios very well

#option netbios-node-type 2;

range dynamic-bootp 192.168.1.30 192.168.1.60;ßip地址池

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;

hardware ethernet 12:34:56:78:AB:CD;

fixed-address 207.175.42.254;

}

}

# DHCP Server Configuration file.

#see /usr/share/doc/dhcp*/dhcpd.conf.sample

4.检查是否有错误并启动dhcp服务

[root@dg Server]# service dhcpd configtest

Syntax: OK

[root@dg Server]# service dhcpd start

启动dhcpd:[确定]

四、验证dhcp服务器

1.客户机首先释放原有ip地址本例是(xp为例)

e44d410b15385c0f0341da017fb84c72.png

2.再次获得ip

b60959bccdf239b3c30c4352fa5a22a7.png

可以看到获得了ip为192.168.1.60  dns服务器为dg.com

3.在dhcp服务器上查看日志

[root@dg ~]# tail -f /var/log/messages

034247e9811333548e40b250e8574031.png

可以看到dhcp服务工作的整个过程,上面显示把192.168.1.60分给了dg-105dd83d02d

4.查看client主机属性

7cc752ae3008fb2517340b9ef9b3baa6.png

5.如果想开机启动的话可以设置

[root@dg Server]# chkconfig dhcpd on

好了,简单的配置就此完成了。

dhcp超级作用域的配置

redhat5.4配置dhcp超级作用域

服务器联网方式是host-only,ip地址为192.168.1.25

服务器的配置:1.安装dhcp服务器,在原有的配置基础上修改配置文件,

[root@dg ~]# vi /etc/dhcpd.conf

#

ddns-update-style interim;

ignore client-updates;

shared-network dgzz{ß定义了一个超级作用域,名为dgzz

subnet 192.168.1.0netmask 255.255.255.0 {ß定义一个子网192.168.1.0

option routers192.168.1.1;#默认路由

option subnet-mask255.255.255.0;

option domain-name"dg.com";#dns服务器名

option domain-name-servers222.88.88.88;

option time-offset-18000; # Eastern Standard Time

#option ntp-servers192.168.1.1;

#option netbios-name-servers192.168.1.1;

range dynamic-bootp 192.168.1.20 192.168.1.20;

#分配的ip地址范围,即地址池,这里就配置了一个ip地址

default-lease-time 21600;

max-lease-time 43200;

host ns {

next-server marvin.redhat.com;

hardware ethernet 12:34:56:78:AB:CD;

fixed-address 207.175.42.254;

}

}

subnet 192.168.2.0 netmask 255.255.255.0{

option routers192.168.2.1;

option subnet-mask255.255.255.0;

option domain-name"dg1.com";

option domain-name-servers222.88.88.88;

option time-offset-18000; # Eastern Standard Time

#option ntp-servers192.168.1.1;

#option netbios-name-servers192.168.1.1;

range dynamic-bootp 192.168.2.30 192.168.2.30;

#分配的ip地址范围,即地址池,这里就配置了一个ip地址

default-lease-time 21600;

max-lease-time 43200;

host ns1{

next-server marvin.redhat.com;

hardware ethernet 12:34:56:78:AB:CD;

fixed-address 207.175.42.254;

}

}

}注:别忘了添加大括号。

注:为了验证,在每个地址池里面只配置了一个ip,为的是让客户端获得两个地址池了的ip地址,如果ip地址足够多的话,客户机就会把一个地址池了的ip用完后,在用另一地址池里的ip地址。

2.重启dhcp服务

[root@dg ~]# service dhcpd restart

关闭dhcpd:[确定]

启动dhcpd:[确定]

客户端的配置:

1.两台xp的虚拟机,联网方式为host-only,ip地址改为自动获取

2.对于xp1

4e186f5fb5ed76f837b397f7bd57a900.png

3.对于xp2

2c2e2ac86358a0a59dca7c6d28f20bbe.png

在实际的应用中,两个地址池ip范围可以根据需求进行配置。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值