【思科】ACL综合实例应用

实验拓扑:

实验要求:

  1. 三台交换机划分3个vlan
  2. vlan成员可以上网,但是vlan10,vlan20不可以访问vlan30中的C3,但是可以访问其他服务器
  3. 上班时间员工不可以访问淘宝网(12.0.0.2)
  4. 允许某些员工只能访问指定网站,不能访问其他网站(以vlan10成员为例)

实验步骤:

  1. 配置R2,R3,R4,划分vlan

R2#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R2(config)#no ip routing

R2(config)#vlan 10,20,30

R2(config-vlan)#ex

R2(config)#int f1/1

R2(config-if)#switchport access vlan 10

R2(config-if)#int f1/0

R2(config-if)#switchport mode trunk

R3#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R3(config)#no ip routing

R3(config)#vlan 10,20,30

R3(config-vlan)#ex

R3(config)#int f1/2

R3(config-if)#switchport access vlan 20

R3(config-if)#int f1/0

R3(config-if)#switchport mode trunk

R4#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R4(config)#no ip routing

R4(config)#vlan 10,20,30

R4(config-vlan)#ex

R4(config)#int f1/3

R4(config-if)#switchport access vlan 30

R4(config-if)#int f1/0

R4(config-if)#switchport mode trunk

2.配置网关R1

R1#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)#ip routing

R1(config)#vlan 10,20,30

R1(config-vlan)#ex

R1(config)#int f1/2

R1(config-if)#no sh

R1(config-if)#switchport mode trunk

R1(config-if)#no sh

*Mar  1 00:09:09.947: %DTP-5-TRUNKPORTON: Port Fa1/2 has become dot1q trunk

R1(config-if)#int f1/3

R1(config-if)#no sh

R1(config-if)#switchport mode trunk

*Mar  1 00:09:17.603: %DTP-5-TRUNKPORTON: Port Fa1/3 has become dot1q trunk

R1(config-if)#int f1/4

R1(config-if)#no sh

R1(config-if)#switchport mode trunk

R1(config-if)#ex

*Mar  1 00:09:23.499: %DTP-5-TRUNKPORTON: Port Fa1/4 has become dot1q trunk

R1(config)#int vlan 10

*Mar  1 00:09:37.339: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up

R1(config-if)#ip add 192.168.10.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#int vlan 20

R1(config-if)#ip add 192.168.10.1 255.255.255.0

*Mar  1 00:09:49.115: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up

R1(config-if)#ip add 192.168.20.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#int vlan 30

R1(config-if)#ip add 192.168.20.1 255.255.255.0

*Mar  1 00:09:57.779: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up

R1(config-if)#ip add 192.168.30.1 255.255.255.0

R1(config-if)#no sh

此时,vlan10,20是可以访问vlan30的

要使得C3不能被访问,需要定义ACL控制列表

R1(config)#ip access-list extended test

R1(config-ext-nacl)#deny ip ?

A.B.C.D  Source address

any      Any source host

host     A single source host

R1(config-ext-nacl)#deny ip 192.168.10.0 0.0.0.255 host 192.168.30.30

R1(config-ext-nacl)#deny ip 192.168.20.0 0.0.0.255 host 192.168.30.30

R1(config-ext-nacl)#permit ip any any

需要应用在vlan30上

R1(config-if)#int vlan 30

R1(config-if)#ip access-group test out

应用后,测试结果

已经不通了,达到目的。

3.配置R1和R6

需要vlan成员成员上网,需要在出口路由器上面做NAT。

首先配置R1

R1(config)#int f1/5

R1(config-if)#no switchport

R1(config-if)#ip add 192.168.16.1 255.255.255.0

R1(config-if)#no sh

*Mar  1 00:26:09.023: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/5, changed state to up

R1(config-if)#ex

R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.16.6    //这里别忘了指一条默认路由给出口路由器

配置R6

R6#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R6(config)#int f0/1

R6(config-if)#ip add 192.168.16.6 255.255.255.0

R6(config-if)#no sh

R6(config-if)#ex

*Mar  1 00:15:42.207: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up

*Mar  1 00:15:43.207: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

R6(config)#ip route 192.168.10.0 255.255.255.0 192.168.16.1

R6(config)#ip route 192.168.20.0 255.255.255.0 192.168.16.1

R6(config)#ip route 192.168.30.0 255.255.255.0 192.168.16.1        //回程路由也要指的

R6(config)#int f0/1

R6(config-if)#ip nat inside

*Mar  1 00:16:20.815: %LINEPROTO-5-UPDOWN: Line protocol on Interface NVI0, changed state to up

R6(config-if)#int f0/0

R6(config-if)#ip add 12.0.0.1 255.255.255.0

R6(config-if)#no sh

*Mar  1 00:16:42.079: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up

*Mar  1 00:16:43.079: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

R6(config-if)#ip nat outside

R6(config-if)#ex

首先定义允许上网的内网网段

R6(config)#access-list 10 permit 192.168.10.0 0.0.0.255

R6(config)#access-list 10 permit 192.168.20.0 0.0.0.255

R6(config)#access-list 10 permit 192.168.30.0 0.0.0.255

查看一下

R6(config)#do show access-lists

Standard IP access list 10

10 permit 192.168.10.0, wildcard bits 0.0.0.255

20 permit 192.168.20.0, wildcard bits 0.0.0.255

30 permit 192.168.30.0, wildcard bits 0.0.0.255

无误。利用外网口负载上网。

R6(config)#ip nat inside source list 10 int f0/0 overload

实验要求上班时间不可以访问淘宝网,我用linux虚拟机来模拟,IP地址12.0.0.2

此时是可以上网的

在上班时间不能上淘宝,需要先定义时间列表,设上班时间为8:30-11:30 ,13:30-17:30

R6(config)#time-range work

R6(config-time-range)#periodic weekdays 8:30 to 11:30

R6(config-time-range)#periodic weekdays 13:30 to 17:30

R6(config-time-range)#ex

R6(config)#end

*Mar  1 00:35:21.703: %SYS-5-CONFIG_I: Configured from console by console

R6#clock set 15:30:00 27 AUG 2014          //校正路由器时间

*Aug 27 15:30:00.000: %SYS-6-CLOCKUPDATE: System clock has been updated from 00:36:01 UTC Fri Mar 1 2002 to 15:30:00 UTC Wed Aug 27 2014, configured from console by console.

R6#show clock

15:30:03.867 UTC Wed Aug 27 2014

R6#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R6(config)#ip access-list extended nowww

R6(config-ext-nacl)#deny tcp any host 12.0.0.2 eq www time-range work  //定义上班时间不允许

R6(config-ext-nacl)#permit ip any any

应用在出口路由器的内网口

R6(config-if)#int f0/1

R6(config-if)#no ip access-group nowww in

这时候,测试下能上网否?

网已经断了。实验目的达到

最后,要使vlan10成员只能访问百度,假设IP为12.0.0.3,需要在R1上配置ACL访问控制列表。

R1(config)#ip access-list extended vlan10

R1(config-ext-nacl)#permit tcp ?

A.B.C.D  Source address

any      Any source host

host     A single source host

R1(config-ext-nacl)#permit tcp host 192.168.10.10 host 12.0.0.3 eq www

R1(config-ext-nacl)#ex

在vlan10上面应用

R1(config)#int vlan 10

R1(config-if)#ip access-group vlan10 out

实验完毕。

时间: 2024-08-02 19:29:19

【思科】ACL综合实例应用的相关文章

Qt布局管理器综合实例

1.布局管理器的综合实例------模拟向导用户界面(Windows平台) -----练习开发一个向导用户界面 @1:在同一界面上展现不同的向导页面 @2:通过上一步和下一步按钮进行切换 @3:不同页面上的元素组件和这些组件排布都不相同 @4:页面中的组件通过布局管理进行排布 (1)通过布局嵌套进行界面设计 @1:上一步和下一步这两个按钮用水平布局管理器QHBoxLayout来进行管理,不同页面上的显示的内容只有按钮不变,所以讲不同页面的内容用栈式布局管理器QStackedLayout进行管理,

html5-表单的综合实例

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>表单的综合实例</title>    <style type="text/css">        body{background:url(pic/1.png);}        form{width: 400px;b

Android笔记三十四.Service综合实例二

综合实例2:client訪问远程Service服务 实现:通过一个button来获取远程Service的状态,并显示在两个文本框中. 思路:如果A应用须要与B应用进行通信,调用B应用中的getName().getAuthor()方法,B应用以Service方式向A应用提供服务.所以.我们能够将A应用看成是client,B应用为服务端,分别命名为AILDClient.AILDServer. 一.服务端应用程序 1.src/com.example.aildserver/song.aidl:AILD文

ReportingServies——SQLServer报表开发综合实例

上一篇:ReportingServies报表开发实例教程 如果我们安装了sqlserver2008 R2,将会自动安装一个报表开发工具 不要以为此报表开发工具只适合于sqlserver2008,其实在sqlserver2012中也是支持的,事实上我现在项目中就是使用的sqlserver2012. 使用此工具进行报表开发,将会十分快速而且方便.这里我通过一个综合实例来演示它的使用技巧,可以毫不夸张的说,如果你能使用此工具把这个Demo做出来,那么工作中遇到的80%报表,你都能够使用此工具进行开发了

Win10系列:JavaScript综合实例1

上面几个小节讲解了使用HTML5和JavaScript语言开发Windows 应用商店应用时会用到的一些技术,本小节将前面介绍的知识融合在一起创建一个菜谱应用程序,帮助读者更进一步地理解和掌握这些知识. 此菜谱应用程序主要的功能是介绍一些菜肴和主食的做法,其中包含三个页面:第一个页面为主页面,用于按类别显示一些菜肴和主食:第二个页面为分类页面,显示某个类别的信息和属于该类别的菜肴或主食:第三个页面为菜肴页面,显示某项菜肴或主食的详细信息,如名称.图片和具体做法.这三个页面可以相互跳转,例如,在主

第四节 综合实例:使用多态完善汽车租赁系统计价功能

综合实例:使用多态完善汽车租赁系统计价功能 主讲教师:王少华      QQ群号:483773664 学习目标 在案例中应用多态; 使用父类类型作为方法的形参 一.计算一次租赁多辆汽车的总租金 (一) 需求说明 在前一章(继承)汽车租赁系统的基础上,即已经实现了汽车租赁系统的简单计价功能,客户可以租赁一辆某种型号的汽车若干天.现在要增加需求: 客户可以一次租赁多辆不同品牌的不同型号的汽车若干天,要求计算出总租赁价. 假设有一客户要租赁: 2辆宝马 1辆别克商务舱 1辆金龙(34)座 租5天共多少

23种设计模式综合实例应用目录

突然发现学所到的知识并不能满足日常工作的需要,便想起了设计模式,在此以北风网的Java设计模式全面解析(23种设计模式综合实例应用)课程为蓝本,以文本的形式记录各种设计模式的介绍.使用方法.优缺点.使用场景等. 观看地址:http://www.ed2000.com/ShowFile.asp?FileID=153245 1.简单工厂模式 2.工厂方法模式

Loadrunner 关联 web_custom_request综合实例

Loadrunner 关联 web_custom_request综合实例 Loadrunner 关联web_custom_request,针对自带的订票系统的一个综合实例,相信看了本文大家对学习loadrunner脚本会有很大的帮助. 本实例要解决的问题: (1)动态删除Loadrunner订票系统的一条订单: (2)动态判断表单订单条目,执行取消第一条订单: (3)Loadrunner关联  web_custom_request以及循环语句的应用. 代码不足之处:变量定义太多,希望和大家共同交

Qt Quick综合实例之文件查看器

如果你基于Qt SDK 5.3.1来创建一个Qt Quick App项目,项目模板为你准备的main.qml文档的根元素是ApplicationWindow或Window.这次我们就以ApplicationWindow为例,围绕着它实现一个综合实例:文件查看器.通过文件查看器的实现,我们来再次领略一下Qt Quick的犀利. 版权所有foruok,转载请注明出处:http://blog.csdn.net/foruok. 本实例将会用到下列特性: ApplicationWindow MenuBar