提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
目录
前言
一、实验目的
二、实验要求
三、实验拓扑
四、实验步骤
1. DHCP 安装
2、DNS 服务器搭建
3、web服务器配置
3.1基础配置
3.2查看IP获得情况
3.3 配置本地yum源
4、DHCP中继服务器配置(多网卡)
五、客户端访问测试
总结
今天开始做实验了,以下就是实验的完整过程,其实是为了考验这段时间的学习成果,所以,认真对待哦。
提示:以下是本篇文章正文内容,下面案例可供参考
2. 实现Clients主机能通过域名访问对应的web服务器。
二、实验要求
3.用中继器实现DHCP分配不同网段的IP
(1) 基础配置
systemctl stop firewalld && systemctl disable firewalld
Setenforce 0
vim /etc/selinux/config
SELINUX=enforcing 改为SELINUX=disabled
systemctl stop NateworkManager && sysytemctl disable NetworkManager
vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=static
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.100.253
PREFIX=24
GATEWAY=192.168.100.254
ifdown ens33 && ifup ens33
(2) 配置本地源
cd /etc/yum.repos.d/
mkdir backup
mv CentOS-* backup
vim local.repo
[local]
name=local
baseurl=file:///mnt
enabled=1
gpgcheck=0
mount /dev/sr0 /mnt
(3) 安装DHCP
yum install -y dhcp
(4) 修改配置文件
(5) 重启DHCP
systemclt restart dhcpd
(1)基础配置
systemctl stop firewalld && systemctl disable firewalld
setenforce 0
vim /etc/selinux/config
SELINUX=enforcing 改为SELINUX=disabled
systemctl stop NetworkManager && systemctl disable NetworkManager
vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=static
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.100.252
PREFIX=24
GATEWAY=192.168.100.254
ifdown ens33 && ifup ens33
(2)配置本地yum源
cd /etc/yum.repos.d/
mkdir backup
mv CentOS-* backup
vim local.repo
[local]
name=local
baseurl=file:///mnt
enabled=1
gpgcheck=0
mount /dev/sr0 /mnt
(3)安装DNS bind
yum install -y bind
(4)修改配置文件
vim /etc/named.conf
cd /var/named/
cp -p named.empty apache.com.zones
cp -p named.empty nginx.com.zones
cp -p named.empty tomcat.com.zones
vim apache.com.zones
vim nginx.com.zones
vim tomcat.com.zones
(5)启动DNS
systemctl restart named
(6)修改文件
vim /etc/resolv.conf
(7)解析
Nslookup
systemctl stop firewalld && systemctl disable firewalld
setenforce 0
vim /etc/selinux/config
SELINUX=enforcing 改为SELINUX=disabled
ifdown ens33 && ifup ens33并重启
cd /etc/yum.repos.d/
mkdir backup
mv CentOS-* backup
vim local.repo
[local]
name=local
baseurl=file:///mnt
enabled=1
gpgcheck=0
mount /dev/sr0 /mnt
3.3.1 安装apache
yum install -y httpd
(1)配置Apache
vim /etc/httpd/conf/httpd.con
cd /var/web/
echo lq12112 > apache/index.html
Systemctl start httpd
netstat - anptu | grep httpd
测试
3.3.2 安装Nginx
mv /tmp/VMwareDnD/U3EqOa/nginx-1.24.0.tar.gz .
tar xf nginx-1.24.0.tar.gz
yum install -y nginx-1.24.0-1.el7.ngx.x86_64.rpm
rpm -ivh ./*.rpm
(1)配置Nginx
vim /etc/nginx/conf.d/defauit.conf
cd /var/web/nginx/
index.access.log
vim index.html
Sdaadff
netstat -anptu | grep nginx
systemctl start nginx
测试
3.3.3装Tomcat
java -version
mv /tmp/VMwareDnD/U3EqOa/apache-tomcat-8.5.16.tar.gz .
tar xf apache-tomcat-8.5.16.tar.gz(解压)
mv apache-tomcat-8.5.16 /usr/local/tomcat8
cd /usr/local/tomcat8/
(1)配置Tomcat
ln -s /usr/local/tomcat8/bin/startup.sh /usr/local/bin/btomcat
ln -s /usr/local/tomcat8/bin/shutdown.sh /usr/local/bin/stomca
vim /usr/local/tomcat8/conf/server.xml
mkdir /var/web/tomcat/ROOT -p
cp /var/web/nginx/index.html /var/web/tomcat/ROOT/
vim /var/web/tomcat/ROOT/index.html
Tomcat
netstat -anptu | grep java
btomcat
测试
systemctl stop firewalld && systemctl disable firewalld
setenforce 0
vim /etc/selinux/config
SELINUX=enforcing 改为SELINUX=disabled
2. 配置静态IP地址
systemctl stop NetworkManager ; systemctl disable NetworkManager
ip a
cd /etc/sysconfig/network-scripts/
vim ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=static
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.100.254
PREFIX=24
cp ifcfg-ens33 ifcfg-ens37
vim ifcfg-ens36
TYPE=Ethernet
BOOTPROTO=static
NAME=ens37
DEVICE=ens37
ONBOOT=yes
IPADDR=192.168.200.254
PREFIX=24
ifdown ens33 && ifup ens33
ifdown ens37 && ifup ens37
ip a
3. 配置本地yum源
cd /etc/yum.repos.d/
mkdir backup
mv CentOS-* backup
vim local.repo
[local]
name=local
baseurl=file:///mnt
enabled=1
gpgcheck=0
mount /dev/sr0 /mnt
4. 安装DHCP
yum install -y dhcp
5. 配置DHCP中继
vim /etc/sysctl.conf
sysctl - p
dhcrelay 192.168.100.253
systemctl restart dhcpd
设置客户端的路由
route add default gw 192.168.200.254
客户端1
ip a
ping 192.168.100.251
客户端2
ip a
ping 192.168.100.251
echo "nameserver 192.168.100.252" > /etc/resolv.conf
在网页查看
以上就是今天的实验,配置的比较多,但是如果肯下功夫的话,一定可以成功的,加油!