linux DHCP服务器的配置(redhat6.4)

步骤一:给DHCP服务器配置静态ip

[[email protected] ~]# ifconfig eth0         //查看eth0网卡的配置信息

eth0      Link encap:Ethernet  HWaddr 00:0C:29:0C:C3:1F

inet addr:192.168.1.33  Bcast:192.168.1.255  Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fe0c:c31f/64 Scope:Link

UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

RX packets:2519 errors:0 dropped:0 overruns:0 frame:0

TX packets:2644 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:1806182 (1.7 MiB)  TX bytes:1671573 (1.5 MiB)

Interrupt:18 Base address:0x2000

[[email protected] ~]# route -n        //   查看路由表条目

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

步骤二:

根据要求安装DHCP服务器所需软件包

[[email protected] ~]# rpm -q dhcp       // 查看dhcp包是否安装,下面显示未安装

package dhcp is not installed

[[email protected] ~]# mkdir /ww         //建立一个文件夹

[[email protected] ~]# mount /dev/cdrom /ww    //将系统镜像挂载到/ww目录下

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

[[email protected] ~]# rpm -ivh /ww/Packages/dhcp-4.1.1-34.P1.el6.x86_64.rpm    //安装dhcp

warning: /ww/Packages/dhcp-4.1.1-34.P1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

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

1:dhcp                   ########################################### [100%]

[[email protected] ~]#

步骤三:

产生DHCP服务器配置文件

[[email protected] ~]# cp /usr//share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf      cp:是否覆盖“/etc/dhcp/dhcpd.conf"?y

步骤四:配置/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 8.8.8.8, 4.4.4.4;      //指定dns服务器地址

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 192.168.1.0 netmask 255.255.255.0 {

}

# This is a very basic subnet declaration.

subnet 192.168.1.0 netmask 255.255.255.0 {        //声明网址地址

range 192.168.1.10 192.168.1.100;              //设置地址池

option routers 192.168.1.1;                     //设置默认网关

}

# This declaration allows BOOTP clients to get dynamic addresses,

# which we don‘t really recommend.

subnet 10.254.239.32 netmask 255.255.255.224 {

range dynamic-bootp 10.254.239.40 10.254.239.60;

option broadcast-address 10.254.239.31;

option routers rtr-239-32-1.example.org;

}

# A slightly different configuration for an internal subnet.

subnet 10.5.5.0 netmask 255.255.255.224 {

range 10.5.5.26 10.5.5.30;

option domain-name-servers ns1.internal.example.org;

option domain-name "internal.example.org";

option routers 10.5.5.1;

option broadcast-address 10.5.5.31;

default-lease-time 600;

max-lease-time 7200;

}

# Hosts which require special configuration options can be listed in

# host statements.   If no address is specified, the address will be

# allocated dynamically (if possible), but the host-specific information

# will still come from the host declaration.

host passacaglia {

hardware ethernet 0:0:c0:5d:bd:95;

filename "vmunix.passacaglia";

server-name "toccata.fugue.com";

}

# Fixed IP addresses can also be specified for hosts.   These addresses

# should not also be listed as being available for dynamic assignment.

# Hosts for which fixed IP addresses have been specified can boot using

# BOOTP or DHCP.   Hosts for which no fixed address is specified can only

# be booted with DHCP, unless there is an address range on the subnet

# to which a BOOTP client is connected which has the dynamic-bootp flag

# set.

host fantasia {

hardware ethernet 08:00:07:26:c0:a5;

fixed-address fantasia.fugue.com;

}

# You can declare a class of clients and then do address allocation

# based on that.   The example below shows a case where all clients

# in a certain class get addresses on the 10.17.224/24 subnet, and all

# other clients get addresses on the 10.0.29/24 subnet.

class "foo" {

match if substring (option vendor-class-identifier, 0, 4) = "SUNW";

}

shared-network 224-29 {

subnet 10.17.224.0 netmask 255.255.255.0 {

option routers rtr-224.example.org;

}

subnet 10.0.29.0 netmask 255.255.255.0 {

option routers rtr-29.example.org;

}

pool {

allow members of "foo";

range 10.17.224.10 10.17.224.250;

}

pool {

deny members of "foo";

range 10.0.29.10 10.0.29.230;

}

}

步骤五:启动DHCP服务器

[[email protected] ~]# service dhcpd start

启动 dhcpd:                                               [确定]

步骤六:测试

开一台windows7和dhcp同一网络下,自动获取ip

打开/etc/dhcp/dhcpd.conf     修改第五行host后面的参数 绑定win7的mac 给win7指定的ip

重启dhcp服务 service dhcpd restart

查看win7 的网络连接详细信息

时间: 2024-12-17 21:07:04

linux DHCP服务器的配置(redhat6.4)的相关文章

Linux DHCP服务器简单配置示例

1.DHCP安装及配置 yum install dhcp cp /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcp/dhcpd.conf vim /etc/dhcp/dhcpd.conf option domain-name "redhat.com"; option domain-name-servers 202.96.128.166, 114.114.114.114;        # 设置DNS default-lease-time 3

在Linux中DHCP服务器的配置

前提:设置为DHCP服务器,则将该机子的IP地址设置将于分配的地址范围处于同一网段 1.             查看是否安装DHCP服务器 # rpm -qa | grepdhcp 2.             若没安装则安装 # yum install dhcp 3.             安装了之后再查看安装文件,即重复第一步操作 4.             找到要复制的文件 # cat /etc /dhcpd.conf 将会出现以下文件: See / usr /share/doc/d

linux下的DHCP服务器基本配置

linux下的DHCP服务器基本配置: 首先进入网卡配置网卡的IP地址,设置相关的网络信息 配置的网卡信息如下: 安装dhcp软件包 查看dhcp软件包是否已经安装 进入/etc/dhcp/目录下,编辑dhcp.conf配置文件 语法检测,检测配置文件中的语法是否存在语法错误 重启dhcp服务,并设置服务为开机自启动 查看dhcp服务器是否已经启动,运行 将dhcp客户端与dhcp服务器连接在同一网段,检测dhcp客户端是否能够自动获取IP地址 进入/var/lib/dhcpd/目录下,查看dh

Linux DHCP服务器

Linux DHCP服务器 1.1. 安装DHCP yum install dhcp* -y 1.2. DHCP配置文件 [[email protected] ~]# ls  /etc/dhcp/ dhclient.d dhcpd6.conf  dhcpd.conf [[email protected] ~]# vi /etc/dhcp/dhcpd.conf # # DHCP Server Configuration file. #   see /usr/share/doc/dhcp*/dhcp

Linux dhcp服务器搭建

Dhcp就是动态主机配置协议,可以自动的去分配IP地址.子网掩码.网关以及DNS等tcp/ip信息. 服务器 ip 192.168.1.201 试验要求:要求linux dhcp 服务器实现给linux客户机分配ip地址. 首先: yum install dhcp -y  安装dhcp包 cd /etc/dhcp   进入dhcp文件夹 我们可以看到dhcpd.conf 文件的内容   接下来 拷贝一份 来本目录 vi dhcpd.conf   修改成下面这样就行(简单的) 红框内 第一行是 名

linux学习笔记 DHCP服务器的配置

首先,在学习之前,我们需要了解 DHCP DHCP服务器:动态主机配置协议是一个局域网的网络协议.指的是由服务器控制一段IP地址范围,客户机登录服务器时就可以自动获得服务器分配的IP地址和子网掩码. DHCP服务器的功能: 两台连接到互联网上的电脑相互之间通信,必须有各自的IP地址,由于IP地址资源有限,宽带接入运营商不能做到给每个报装宽带的用户都能分配一个固定的IP地址(所谓固定IP就是即使在你不上网的时候,别人也不能用这个IP地址,这个资源一直被你所独占),所以要采用DHCP方式对上网的用户

linux DHCP 服务器

配置  1:/etc/dhcp.conf 配置文件 2:dhcp.leases 启动 dhcp 服务器 linux dhcp客户端 windows dhcp 客户端

Linux dhcp服务器设置(可复制代码)

DHCP服务器设置 1.先将DHCP服务器网络地址设置为静态分配: vim /etc/sysconfig/network-*/*-eth0 DEVICE=eth0 ONBOOT=yes BOOTPROTO=statics HWADDR=00:0C:29:56:ea:8a IPADDR=192.168.1.109 GATEWAY=192.168.1.1 NETMASK=255.255.255.0 service network restart 2.安装配置dhcp服务器 yum install d

linux dhcp的详细配置

部署dhcp服务器 1.用yum安装dhcp 2.编辑配置文件 3.使用:r 读取这个目录这个目录相当于一个模板 /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample 4.删除注释 以便看的更清楚 5.删除空行 6.详细的配置如下 7.重启服务看能不能开启  若不能检查配置文件  设置开机启动服务 (1)启动服务 (2)开机启动服务 8.用一台电脑进行验证保证在同一网络内 9.ping测试 详细命令: [[email protected] ~]# yum -y