大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
1.公司内网用户需要通过网关服务器共享上网
2.互联网用户需要访问网站服务器
3.只允许192.168.1 .0/24ping网关和服务器
4.网站服务器和网关服务器均通过SSH来远程管理,为了安全,将SSH默认端口改为12345,只允许192.168.1.10主机SSH网关和服务器,允许互联网SSH内部服务器
1.网关服务器:Centos7 -1
2.企业内网测试机:Centos7 -2
3.网站服务器:Centos7 -3
4.Internet测试机:Centos7 -4
1.添加网卡,并绑定网卡为VMent2仅主机模式
2.配置并确认网关地址
[root@192 network-scripts]# ifconfig
ens33: flags=4163 mtu 1500
inet 100.1.1.10 netmask 255.255.255.0 broadcast 100.1.1.255
inet6 fe80::839c:1220:87fc:aef prefixlen 64 scopeid 0x20
ether 00:0c:29:70:78:f5 txqueuelen 1000 (Ethernet)
RX packets 2715 bytes 723845 (706.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 623 bytes 55679 (54.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens36: flags=4163 mtu 1500
inet 192.168.10.1 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::3d7f:4cdc:f7ec:8638 prefixlen 64 scopeid 0x20
ether 00:0c:29:70:78:09 txqueuelen 1000 (Ethernet)
RX packets 38 bytes 7923 (7.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 143 bytes 24516 (23.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens37: flags=4163 mtu 1500
inet 192.168.20.1 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::a6c3:1677:f71d:8e29 prefixlen 64 scopeid 0x20
ether 00:0c:29:70:78:ff txqueuelen 1000 (Ethernet)
RX packets 38 bytes 7923 (7.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 138 bytes 23100 (22.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
3.开启路由转发功能
[root@192 network-scripts]# vim /etc/sysctl.conf
...... //省略注释内容
net.ipv4.ip_forward = 1 //添加此条目
[root@192 network-scripts]# sysctl -p //载入sysctl配置文件
net.ipv4.ip_forward = 1
1.绑定网卡为VMent3仅主机模式
2.配置并确认IP地址与网关
[root@192 network-scripts]# ifconfig //查看ip地址及子网掩码
ens33: flags=4163 mtu 1500
inet 192.168.10.10 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::839c:1220:87fc:aef prefixlen 64 scopeid 0x20
ether 00:0c:29:90:44:7f txqueuelen 1000 (Ethernet)
RX packets 2647 bytes 190172 (185.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 453 bytes 51940 (50.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@192 network-scripts]# route -n //查看路由信息
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.10.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
1.先在联网状态下载安装httpd服务
[root@192 ~]# yum install httpd -y
2.绑定网卡为VMent3仅主机模式**
3.配置并确认IP地址与网关
[root@dmz ~]# ifconfig
ens33: flags=4163 mtu 1500
inet 192.168.20.20 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::839c:1220:87fc:aef prefixlen 64 scopeid 0x20
inet6 fe80::791b:db71:8a12:f34 prefixlen 64 scopeid 0x20
ether 00:0c:29:de:4a:b8 txqueuelen 1000 (Ethernet)
RX packets 5353 bytes 3513622 (3.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1143 bytes 105439 (102.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@dmz ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.20.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
4.开启网站服务
[root@192 ~]# vim /var/www/html/index.html
[root@192 ~]# cat /var/www/html/index.html
this is dmz web
[root@dmz html]# systemctl start httpd
success
[root@dmz ~]# firewall-cmd --add-service=http --zone=dmz --permanent //将防火墙的默认区域改为dmz区域
success
[root@dmz ~]# firewall-cmd --remove-service=ssh --zone=dmz --permanent //添加http服务到dmz区域永久设置中
success
[root@dmz ~]# firewall-cmd --add-icmp-block=echo-request --zone=dmz --permanent //禁止使用ssh进行登录
success
[root@dmz ~]# firewall-cmd --reload //重载防火墙
success
1.先在联网状态下载安装httpd服务
[root@192 ~]# yum install httpd -y
2.绑定网卡为VMent1仅主机模式
3.配置并确认IP地址与网关
[root@192 ~]# ifconfig
ens33: flags=4163 mtu 1500
inet 100.1.1.20 netmask 255.255.255.0 broadcast 100.1.1.255
inet6 fe80::839c:1220:87fc:aef prefixlen 64 scopeid 0x20
inet6 fe80::791b:db71:8a12:f34 prefixlen 64 scopeid 0x20
ether 00:0c:29:9e:f9:aa txqueuelen 1000 (Ethernet)
RX packets 6587 bytes 4090863 (3.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1266 bytes 105686 (103.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@192 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
100.1.1.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
4.开启网站服务,并关闭防火墙与增强型安全功能
[root@192 ~]# vim /var/www/html/index.html
[root@192 ~]# cat /var/www/html/index.html
this is external web
[root@192 ~]# systemctl stop firewalld.service
[root@192 ~]# setenforce 0
[root@192 ~]# firewall-cmd --set-default-zone=external //将防火墙默认区域改为extemal
success
[root@192 ~]# firewall-cmd --change-interface=ens36 --zone=trusted --permanent //将ens36网卡设为信任区域
The interface is under control of NetworkManager, setting zone to 'trusted'.
success
[root@192 ~]# firewall-cmd --change-interface=ens37 --zone=dmz --permanent //将ens37网卡设为dmz区域
The interface is under control of NetworkManager, setting zone to 'dmz'.
success
[root@192 ~]# firewall-cmd --zone=dmz --remove-service=ssh --permanent //dmz区域内禁止使用ssh登录
success
[root@192 ~]# firewall-cmd --zone=dmz --add-service=http --permanent //dmz区域内添加http服务
success
[root@192 ~]# firewall-cmd --zone=dmz --add-icmp-block=echo-request --permanent //dmz区域内阻塞icmp协议
success
[root@192 ~]# firewall-cmd --zone=external --add-service=http --permanent //在外部区域添加http服务
success
[root@192 ~]# firewall-cmd --reload //重载防火墙
success
[root@192 ~]# firewall-cmd --zone=external --add-forward port=port=80:proto=tcp:toaddr=192.168.2.10 --permanent //设定端口映射
success
[root@192 ~]# firewall-cmd --reload //重载防火墙
success
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。