毕业设计之DHCP服务器的搭建

简介:

 

动态主机配置协议(Dynamic Host Configuration Protocol ,DHCP)是一个局域网的网络协议,使用udp协议工作,主要有两个用途:给内部网络或网络服务供应商自动分配IP地址;给用户或者内部网络管理员作为对所有计算机作中央管理的手段。端口号:server端 67 ,client端 68

服务器环境:

操作系统:

Red Hat Enterprise Linux Server 5.4 内核版本: 2.6.18-164.el5

需要的软件:

dhcp-3.0.5-21.el5.i386.rpm

网络参数:

IP: 192.168.1.178/28 netmask:255.255.255.240 Gateway:192.168.1.190

准备工作:

image 下的settings

image

[root@localhost ~]# mkdir /mnt/cdrom 
[root@localhost ~]# mount /dev/cdrom /mnt/cdrom 
mount: block device /dev/cdrom is write-protected, mounting read-only 
[root@localhost ~]# cd /mnt/cdrom/Server/ 
[root@localhost 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%] 
   1:dhcp                   ########################################### [100%]

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

image

subnet 192.168.1.64 netmask 255.255.255.224 {

# --- default gateway 
        option routers                  192.168.1.94; 
        option subnet-mask              255.255.255.224;

        option nis-domain               "domain.org"; 
        option domain-name              "domain.org"; 
        option domain-name-servers      192.168.1.177;

        option time-offset              -18000; # Eastern Standard Time 
#       option ntp-servers              192.168.1.1; 
#       option netbios-name-servers     192.168.1.1; 
# -- you understand Netbios very well 
#       option netbios-node-type 2;

        range dynamic-bootp 192.168.1.65 192.168.1.92; 
        default-lease-time 21600; 
        max-lease-time 43200;

        # we want the nameserver to appear at a fixed address 
        host vlan10 { 
                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

subnet 192.168.1.0 netmask 255.255.255.192 {

# --- default gateway 
        option routers                  192.168.1.62; 
        option subnet-mask              255.255.255.192;

        option domain-name              "domain.org"; 
        option domain-name-servers      192.168.1.177;

        option time-offset              -18000; # Eastern Standard Time

        range dynamic-bootp 192.168.1.1 192.168.1.60; 
        default-lease-time 21600; 
        max-lease-time 43200;

        # we want the nameserver to appear at a fixed address 
        host vlan20 { 
                next-server marvin.redhat.com; 
                hardware ethernet 12:34:56:78:AB:CD; 
                fixed-address 207.175.42.254; 
        } 

subnet 192.168.1.96 netmask 255.255.255.224 {

# --- default gateway 
        option routers                  192.168.1.126; 
        option subnet-mask              255.255.255.224;

        option domain-name              "domain.org"; 
        option domain-name-servers      192.168.1.177;

        option time-offset              -18000; # Eastern Standard Time

        range dynamic-bootp 192.168.1.97 192.168.1.124; 
        default-lease-time 21600; 
        max-lease-time 43200;

        # we want the nameserver to appear at a fixed address 
        host vlan30 { 
                next-server marvin.redhat.com; 
                hardware ethernet 12:34:56:78:AB:CD; 
                fixed-address 207.175.42.254; 
        } 
}

subnet 192.168.1.160 netmask 255.255.255.240 {

# --- default gateway 
        option routers                  192.168.1.174; 
        option subnet-mask              255.255.255.240;

        option domain-name              "domain.org"; 
        option domain-name-servers      192.168.1.177;

        option time-offset              -18000; # Eastern Standard Time

        range dynamic-bootp 192.168.1.161 192.168.1.172; 
        default-lease-time 21600; 
        max-lease-time 43200;

        # we want the nameserver to appear at a fixed address 
        host vlan40 { 
                next-server marvin.redhat.com;

                hardware ethernet 12:34:56:78:AB:CD; 
                fixed-address 207.175.42.254; 
        } 
}

 

subnet 192.168.1.128 netmask 255.255.255.224 {

# --- default gateway 
        option routers                  192.168.1.158; 
        option subnet-mask              255.255.255.224;

        option domain-name              "domain.org"; 
        option domain-name-servers      192.168.1.177;

        option time-offset              -18000; # Eastern Standard Time

        range dynamic-bootp 192.168.1.129 192.168.1.156; 
        default-lease-time 21600; 
        max-lease-time 43200;

        # we want the nameserver to appear at a fixed address 
        host vlan50 { 
                next-server marvin.redhat.com; 
                hardware ethernet 12:34:56:78:AB:CD; 
                fixed-address 207.175.42.254; 
        } 
}

subnet 192.168.1.176 netmask 255.255.255.240 
{      }

image

 

SNMP代理配置:

安装net-snmp软件,使该主机成为agent。由于安装需要依赖lm_sensors软件,所以使用yum工具解决依赖关系

[root@localhost ~]# vim /etc/yum.repos.d/rhel-debuginfo.repo

image

[root@localhost ~]# yum install net-snmp -y 
Loaded plugins: rhnplugin, security 
This system is not registered with RHN. 
RHN support will be disabled. 
Setting up Install Process 
Resolving Dependencies 
--> Running transaction check 
---> Package net-snmp.i386 1:5.3.2.2-7.el5 set to be updated 
--> Processing Dependency: libsensors.so.3 for package: net-snmp 
--> Running transaction check 
---> Package lm_sensors.i386 0:2.10.7-4.el5 set to be updated 
--> Finished Dependency Resolution

Installed: 
  net-snmp.i386 1:5.3.2.2-7.el5                                           

Dependency Installed: 
  lm_sensors.i386 0:2.10.7-4.el5                                          

Complete! 
[root@localhost ~]# vim /etc/snmp/snmpd.conf

image

image去掉#号,启用该行的功能

49 rocommunity public 
50 rwcommunity private

77 com2sec mynetwork  192.168.1.193/28 public

[root@localhost ~]# service snmpd start 
Starting snmpd:                                            [  OK  ] 
[root@localhost ~]# chkconfig snmpd on 
[root@localhost ~]# netstat -tupln|grep snmp 
tcp        0      0 127.0.0.1:199               0.0.0.0:*                   LISTEN      28703/snmpd         
udp        0      0 0.0.0.0:161                 0.0.0.0:*                               28703/snmpd       

日志转发:

编辑系统日志配置文件/etc/syslog.conf,将需要转发的日志发送到指定的日志服务器上。咋日志类型后面加 @日志服务器的地址 即可将日志发送到指定的日志服务器上。

[root@localhost ~]# vim /etc/syslog.conf

7 *.info;mail.none;authpriv.none;cron.none                @192.168.1.194

 image




本文转自 gjp0731 51CTO博客,原文链接:http://blog.51cto.com/guojiping/1157472

相关实践学习
日志服务之使用Nginx模式采集日志
本文介绍如何通过日志服务控制台创建Nginx模式的Logtail配置快速采集Nginx日志并进行多维度分析。
相关文章
|
8月前
|
网络协议 Windows
网络协议与攻击模拟-12-部署DHCP服务器
网络协议与攻击模拟-12-部署DHCP服务器
43 0
|
7天前
|
监控 负载均衡 网络协议
|
4月前
|
网络协议 Linux Windows
如何在 Debian 11 上设置 DHCP 服务器?
如何在 Debian 11 上设置 DHCP 服务器?
92 1
|
11月前
华为交换使用技术防止非法的DHCP服务器
华为交换使用技术防止非法的DHCP服务器
91 0
华为交换使用技术防止非法的DHCP服务器
华为交换使用技术防止非法的DHCP服务器
|
12月前
|
网络协议 网络虚拟化
【DHCP实验】使用三层交换机配置DHCP Server服务器(基于全局地址池配置)
【DHCP实验】使用三层交换机配置DHCP Server服务器(基于全局地址池配置)
189 0
|
3天前
|
存储 弹性计算 固态存储
阿里云服务器CPU内存配置详细指南,如何选择合适云服务器配置?
阿里云服务器配置选择涉及CPU、内存、公网带宽和磁盘。个人开发者或中小企业推荐使用轻量应用服务器或ECS经济型e实例,如2核2G3M配置,适合低流量网站。企业用户则应选择企业级独享型ECS,如通用算力型u1、计算型c7或通用型g7,至少2核4G配置,公网带宽建议5M,系统盘可选SSD或ESSD云盘。选择时考虑实际应用需求和性能稳定性。
|
5天前
|
域名解析 弹性计算 Linux
阿里云购买云服务器、注册域名、备案及绑定图文教程参考
本文为大家介绍了2024年购买阿里云服务器和注册域名,绑定以及备案的教程,适合需要在阿里云购买云服务器、注册域名并备案的用户参考,新手用户可通过此文您了解在从购买云服务器到完成备案的流程。
阿里云购买云服务器、注册域名、备案及绑定图文教程参考
|
1天前
|
弹性计算
阿里云ECS使用体验
在申请高校学生免费体验阿里云ECS云服务器后的一些使用体验和感受。