ACL访问控制列表——扩展访问控制列表(实操!!!)
发布时间:2020-12-14 00:15:05 所属栏目:Linux 来源:网络整理
导读:实验环境 一台Linux系统做服务器 两台pc机 Linux:192.168.100.100 win10:192.168.1.2 win10-2:192.168.2.2 实验需求 允许win10访问Linux的web服务 禁止win10访问Linux的其他服务 允许win10访问win10-2主机 实验拓扑图 1,打开Linux服务器,安装http和vsft
实验环境
实验需求
实验拓扑图1,打开Linux服务器,安装http和vsftp两个服务[[email?protected] ~]# yum install vsftpd -y ##安装vsftp服务 [[email?protected] ~]# yum install httpd -y ##安装http服务 2,修改Linux服务器的网卡信息,固定Ip为192.168.100.100,并且重新启动网卡[[email?protected]~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 ##修改网卡信息 [[email?protected] ~]# service network restart ##重启网卡 3,将Linux和两台win10分别连接vmnet三个网卡上
4,分别给win10和win10-2配置一个固定的IP地址和网关
5,打开Linux服务器编辑网站内容并开启http服务[[email?protected] ~]# cd /var/www/html/ ##切换到网站的站点中 [[email?protected] html]# vim index.html ##编辑网站信息 [[email?protected] html]# systemctl start httpd ##开启网站服务 [[email?protected] html]# systemctl stop firewalld.service ##关闭防火墙 [[email?protected] html]# setenforce 0 ##关闭增强型功能 [[email?protected] html]# systemctl start vsftpd ##开启vsftp服务 [[email?protected] html]# cd /var/ftp ##切换到ftp站点目录下 [[email?protected] ftp]# echo "this is test ftp" > ftp.txt ##创建一个测试文件 [[email?protected] html]# netstat -ntap | egrep ‘(21|80)‘ ##查看两个服务的端口,看服务服务有没有正常启动 6,配置R1路由器,测试pc机能否访问Linux服务器R1#conf t ##全局模式 R1(config)#int f0/0 ##进入接口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 用win10访问Linux服务7,打开R1路由器配置扩展访问控制列表R1(config)#access-list 100 permit tcp host 192.168.1.2 host 192.168.100.100 eq www ##允许win10访问Linux服务器的网站服务 R1(config)#access-list 100 deny ip host 192.168.1.2 host 192.168.100.100 ##禁止win10访问Linux服务 R1(config)#access-list 100 permit ip host 192.168.1.2 192.168.2.0 0.0.0.255 ##允许win10访问2.0网段的机器 R1(config)#do show access-li ##查看控制访问列表 R1(config)#int f0/0 ##进入f0/0接口 R1(config-if)#ip access-group 100 in 应用于接口 8,测试win10能否访问Linux的网站服务,能不能访问2.0网段访问Linux服务器的web服务 访问Linux服务的ftp服务 访问2.0网段的主机 谢谢阅读!!!(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |