服务器:一台Linux虚拟机(CentOS 7)
客户机:两台Windows 10虚拟机(win10-1\win0-2)html
yum install httpd -y //安装web服务 yum install vsftpd -y //安装ftp服务
root@192 ~]# cd /var/www/html/ //进入web站点目录 [root@192 html]# vim index.html //编辑网页内容文件 <h1>this is test web </h1> //写入内容
[root@192 ftp]# cd /var/ftp/ 进入ftp目录 [root@192 ftp]# echo "this is test ftp" > test.txt //写入内容到测试文本 [root@192 ftp]# cat test.txt //查看文件及内容 this is test ftp
[root@192 ~]# systemctl start httpd //开启web服务 [root@192 ~]# systemctl start vsftpd //开启ftp服务 [root@192 ~]# systemctl stop firewalld.service //关闭防火墙 [root@192 ~]# setenforce 0 //关闭加强型安全功能 [root@192 ~]# netstat -ntap | egrep '(21|80)' //查看服务端口状态 tcp6 0 0 :::80 :::* LISTEN 3293/httpd tcp6 0 0 :::21 :::* LISTEN 3312/vsftpd
[root@192 ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 //编辑网卡文件 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static //将dhcp换成static,静态模式 DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=88cf4975-29b8-4041-9cb0-456a56d1fddb DEVICE=ens33 ONBOOT=yes IPADDR=192.168.100.100 //设定IP地址 NETMASK=255.255.255.0 //设定子网掩码 GATEWAY=192.168.100.1 //设定网关ip地址 [root@192 ~]# systemctl restart network //从新启动网络服务
(1)配置win10-1的IP地址web
(2)配置win10-2的IP地址vim
(3)关闭防火墙安全
R1#conf t R1(config-if)#int f0/0 R1(config-if)#ip add 192.168.1.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int f0/1 R1(config-if)#ip add 192.168.100.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int f1/0 R1(config-if)#ip add 192.168.2.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#do show ip route C 192.168.1.0/24 is directly connected, FastEthernet0/0 C 192.168.2.0/24 is directly connected, FastEthernet1/0 C 192.168.100.0/24 is directly connected, FastEthernet0/1
C:\Users\czt>ping 192.168.2.2 //使用客户机win10-1ping客户机win10-2IP地址 正在 Ping 192.168.2.2 具备 32 字节的数据: 来自 192.168.2.2 的回复: 字节=32 时间=14ms TTL=127 来自 192.168.2.2 的回复: 字节=32 时间=13ms TTL=127 来自 192.168.2.2 的回复: 字节=32 时间=19ms TTL=127 来自 192.168.2.2 的回复: 字节=32 时间=18ms TTL=127 192.168.2.2 的 Ping 统计信息: 数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失), 往返行程的估计时间(以毫秒为单位): 最短 = 13ms,最长 = 19ms,平均 = 16ms
(1)访问web服务服务器
(2)服务ftp服务网络
R1(config)#access-list 100 permit tcp host 192.168.1.2 host 192.168.100.100 eq www //根据需求设定容许客户机1访问Linux服务器的web服务 R1(config)#access-list 100 deny ip host 192.168.1.2 host 192.168.100.100 //设定拒绝客户机1访问Linux服务器的其余服务 R1(config)#access-list 100 permit ip host 192.168.1.2 192.168.2.0 0.0.0.255 //容许客户机1访问客户机2的整个网段 R1(config)#int f0/0 R1(config-if)#ip access-group 100 in //将扩展ACL放置在端口f0/0的入方向 R1(config-if)#do show access-list //查看ACL列表 Extended IP access list 100 //扩展IP访问列表100 10 permit tcp host 192.168.1.2 host 192.168.100.100 eq www 20 deny ip host 192.168.1.2 host 192.168.100.100 (6 matches) 30 permit ip host 192.168.1.2 192.168.2.0 0.0.0.255 //根据设定逐条执行
C:\Users\czt>ping 192.168.2.2 正在 Ping 192.168.2.2 具备 32 字节的数据: 来自 192.168.2.2 的回复: 字节=32 时间=14ms TTL=127 来自 192.168.2.2 的回复: 字节=32 时间=21ms TTL=127 来自 192.168.2.2 的回复: 字节=32 时间=15ms TTL=127 来自 192.168.2.2 的回复: 字节=32 时间=20ms TTL=127 192.168.2.2 的 Ping 统计信息: 数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失), 往返行程的估计时间(以毫秒为单位): 最短 = 14ms,最长 = 21ms,平均 = 17ms
(1)访问web服务,反向能够正常访问tcp
(2)服务ftp服务,会跳出没法链接服务器的提示信息ide