云计算实验部署题
要求:
1.在Web1机器上构建Web服务,实现基于域名的虚拟Web主机,提供www.163.com与www.qq.com两个网站
2.在Web2机器上构建Web服务,实现基于域名的虚拟Web主机,提供www.163.com与www.qq.com两个网站
3.客户端192.168.4.207访问www.163.com与www.qq.com两个网站,由Web1服务器提供
4.客户端192.168.4.208访问www.163.com与www.qq.com两个网站,由Web2服务器提供
5.在192.168.4.7上实现DNS服务器分离解析,5台机器DNS服务器指向192.168.4.7
- List item
所有虚拟机防火墙与SELinux设置
1.设置防火墙默认区域
[[email protected] ~]# firewall-cmd --set-default-zone=trusted
2.设置SELinux运行模式
[[email protected] ~]# getenforce
[[email protected] ~]# setenforce 0
[[email protected] ~]# vim /etc/selinux/config
SELINUX=permissive
•虚拟机C:构建Web1,实现提供www.163.com与www.qq.com两个网站
[[email protected] ~]# yum -y install httpd
[[email protected] ~]# vim /etc/httpd/conf.d/nsd.conf
<VirtualHost *:80>
ServerName www.163.com
DocumentRoot /var/www/163
<VirtualHost *:80>
ServerName www.qq.com
DocumentRoot /var/www/qq
[[email protected] ~]# mkdir /var/www/163 /var/www/qq
[[email protected] ~]# echo ‘Web1 163’ > /var/www/163/index.html
[[email protected] ~]# echo ‘Web1 QQ’ > /var/www/qq/index.html
[[email protected] ~]# systemctl restart httpd
•虚拟机D:构建Web2,实现提供www.163.com与www.qq.com两个网站
[[email protected] ~]# yum -y install httpd
[[email protected] ~]# vim /etc/httpd/conf.d/nsd.conf
<VirtualHost *:80>
ServerName www.163.com
DocumentRoot /var/www/163
<VirtualHost *:80>
ServerName www.qq.com
DocumentRoot /var/www/qq
[[email protected] ~]# mkdir /var/www/163 /var/www/qq
[[email protected] ~]# echo ‘Web2 163’ > /var/www/163/index.html
[[email protected] ~]# echo ‘Web2 QQ’ > /var/www/qq/index.html
[[email protected] ~]# systemctl restart httpd
•虚拟机A:构建DNS分离解析
192.168.4.207—DNS—》192.168.4.10
192.168.4.208—DNS—》192.168.4.20
[[email protected] ~]# yum -y install bind bind-chroot
[[email protected] ~]# vim /etc/named.conf
options {
directory “/var/named”;
};
view “haha” {
match-clients { 192.168.4.207; };
zone “163.com” IN {
type master;
file “163.com.zone”;
};
zone “qq.com” IN {
type master;
file “qq.com.zone”;
};
};
view “xixi” {
match-clients { any; };
zone “163.com” IN {
type master;
file “163.com.other”;
};
zone “qq.com” IN {
type master;
file “qq.com.other”;
};
};
[[email protected] ~]# cp -p /var/named/named.localhost /var/named/163.com.zone
[[email protected] ~]# vim /var/named/163.com.zone
…此处省略一万字
163.com. NS svr7
svr7 A 192.168.4.7
www A 192.168.4.10
[[email protected] ~]# cp -p /var/named/163.com.zone /var/named/qq.com.zone
[[email protected] ~]# vim /var/named/qq.com.zone
…此处省略一万字
qq.com. NS svr7
svr7 A 192.168.4.7
www A 192.168.4.10
[[email protected] ~]# cp -p /var/named/163.com.zone /var/named/163.com.other
[[email protected] ~]# vim /var/named/163.com.other
…此处省略一万字
163.com. NS svr7
svr7 A 192.168.4.7
www A 192.168.4.20
[[email protected] ~]# cp -p /var/named/qq.com.zone /var/named/qq.com.other
[[email protected] ~]# vim /var/named/qq.com.other
…此处省略一万字
qq.com. NS svr7
svr7 A 192.168.4.7
www A 192.168.4.20
[[email protected] ~]# systemctl restart named
•所有虚拟机指定DNS服务器地址为192.168.4.7
[[email protected] ~]# echo nameserver 192.168.4.7 > /etc/resolv.conf
[[email protected] ~]# echo nameserver 192.168.4.7 > /etc/resolv.conf
[[email protected] ~]# echo nameserver 192.168.4.7 > /etc/resolv.conf
[[email protected] ~]# echo nameserver 192.168.4.7 > /etc/resolv.conf
[[email protected] ~]# echo nameserver 192.168.4.7 > /etc/resolv.conf