您的位置:首页 > 其它

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

2013-03-18 20:47 417 查看
 
动态主机配置协议(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
准备工作:


下的settings



[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



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
{      }



 
SNMP代理配置:
安装net-snmp软件,使该主机成为agent。由于安装需要依赖lm_sensors软件,所以使用yum工具解决依赖关系
[root@localhost ~]# vim /etc/yum.repos.d/rhel-debuginfo.repo



[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





去掉#号,启用该行的功能
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
 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息