标准访问控制列表 CISCO之CCNA篇之七(2)
2009-06-27 07:09
218 查看
前文我们已经提到了标准的访问列表,下面就用两个实例来详细介绍下具体的应用。
标准ACL配置语法:
Lab(config)#access-list [1-99] [permit/deny] 源IP地址/网段 目标IP地址/网段
或者是Lab(config)#access-list [1-99] [permit/deny] host 源IP地址/网段
Lab(config)#access-list [1-99] permit any (若禁用某个IP需要把其他的设置打开)
Lab(config)#interface {interface-number} (把访问列表绑定到端口上)
Lab(config-if)#ip access-group [1-99] in/out
下面以一个具体的IP实例写(实际这要根据你的需要而写),帮助大家理解:
Lab(config)#access-list 10 deny 192.168.1.10 0.0.0.0
或Lab(config)#access-list 10 deny host 192.168.1.10
Lab(config)#access-list 10 permit any
Lab(config)#int s0/0
Lab(config-if)#ip access-group 10 out
标准ACL实验一:只禁用PC1对R2的任何访问
实验均是用的Packet Tracer 5.0模拟器,具体实验拓扑如下:
路由器R1上需要的配置(基本配置见上图)
下面都是直接复制了路由器里配置后的命令:
r1>
r1>en
r1#sh run
Building configuration...
Current configuration : 534 bytes
!
version 12.2
no service password-encryption
!
hostname r1
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0
ip address 172.16.1.1 255.255.255.0
ip access-group 10 out
clock rate 64000
!
interface Serial0/1
no ip address
shutdown
!
ip classless
!
!
access-list 10 deny host 192.168.1.2
access-list 10 permit any
!
!
!
line con 0
line vty 0 4
login
!
!
end
路由器R2上需要的配置(基本配置见上图)
r2>
r2>en
r2#sh run
Building configuration...
Current configuration : 463 bytes
!
version 12.2
no service password-encryption
!
hostname r2
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0
ip address 172.16.1.2 255.255.255.0
!
interface Serial0/1
no ip address
shutdown
!
ip classless
ip route 192.168.1.0 255.255.255.0 172.16.1.1
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
end
实验结果:先来看下面的图(实践是检验真理的唯一标准):
从图片上不难看出,只有PC1不能ping通R2,其他两台主机可正常通讯。那有人可能会问:是不是PC1和R1之间不能通讯导致和R2不能通讯呢?那我们就来看下PC1和R1之间是否可以正常通讯,
看过这个结果后,相信大家就明白实验的目的已经达到了,只禁用了PC1对R2的任何访问,其他条件不受影响。
标准ACL实验二:只允许PC1对R1进行Telnet
路由器R1上需要的配置(基本配置见上图)
r1>en
r1#sh run
Building configuration...
Current configuration : 546 bytes
!
version 12.2
no service password-encryption
!
hostname r1
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0
ip address 172.16.1.1 255.255.255.0
ip access-group 10 out
clock rate 64000
!
interface Serial0/1
no ip address
shutdown
!
ip classless
!
!
access-list 10 permit host 192.168.1.2
!
!
!
line con 0
line vty 0 4
access-class 10 in
password cisco
login
!
!
end
路由器R2上需要的配置(基本配置见上图)
r2>
r2>en
r2#sh run
Building configuration...
Current configuration : 463 bytes
!
version 12.2
no service password-encryption
!
hostname r2
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0
ip address 172.16.1.2 255.255.255.0
!
interface Serial0/1
no ip address
shutdown
!
ip classless
ip route 192.168.1.0 255.255.255.0 172.16.1.1
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
end
这里就用到了控制VTY(Telnet)访问(虚拟通道)(语法可参考上篇文章访问控制列表(ACL)简介 CISCO之CCNA篇之七(1)),在R1上做相关的配置,最后看实验的结果,
从上面的三个图片不难看出,只有在PC1上输入了正确的密码后可以Telnet登录到R1上,而PC2和PC3都是拒绝的(Connection refused by remote host远程连接主机被拒绝)。当然在实际中是 不允许使用Telnet登录的,这样很不安全,应用SSH远程登录,不过我们这里是为了做虚拟通道的实验,暂不考虑安全问题。
标准的访问列表就介绍到这里,后面为大家实验介绍扩展访问列表,敬请关注!本文出自 “冰泉” 博客,请务必保留此出处http://shuangyang.blog.51cto.com/540829/170176
标准ACL配置语法:
Lab(config)#access-list [1-99] [permit/deny] 源IP地址/网段 目标IP地址/网段
或者是Lab(config)#access-list [1-99] [permit/deny] host 源IP地址/网段
Lab(config)#access-list [1-99] permit any (若禁用某个IP需要把其他的设置打开)
Lab(config)#interface {interface-number} (把访问列表绑定到端口上)
Lab(config-if)#ip access-group [1-99] in/out
下面以一个具体的IP实例写(实际这要根据你的需要而写),帮助大家理解:
Lab(config)#access-list 10 deny 192.168.1.10 0.0.0.0
或Lab(config)#access-list 10 deny host 192.168.1.10
Lab(config)#access-list 10 permit any
Lab(config)#int s0/0
Lab(config-if)#ip access-group 10 out
标准ACL实验一:只禁用PC1对R2的任何访问
实验均是用的Packet Tracer 5.0模拟器,具体实验拓扑如下:
路由器R1上需要的配置(基本配置见上图)
下面都是直接复制了路由器里配置后的命令:
r1>
r1>en
r1#sh run
Building configuration...
Current configuration : 534 bytes
!
version 12.2
no service password-encryption
!
hostname r1
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0
ip address 172.16.1.1 255.255.255.0
ip access-group 10 out
clock rate 64000
!
interface Serial0/1
no ip address
shutdown
!
ip classless
!
!
access-list 10 deny host 192.168.1.2
access-list 10 permit any
!
!
!
line con 0
line vty 0 4
login
!
!
end
路由器R2上需要的配置(基本配置见上图)
r2>
r2>en
r2#sh run
Building configuration...
Current configuration : 463 bytes
!
version 12.2
no service password-encryption
!
hostname r2
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0
ip address 172.16.1.2 255.255.255.0
!
interface Serial0/1
no ip address
shutdown
!
ip classless
ip route 192.168.1.0 255.255.255.0 172.16.1.1
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
end
实验结果:先来看下面的图(实践是检验真理的唯一标准):
从图片上不难看出,只有PC1不能ping通R2,其他两台主机可正常通讯。那有人可能会问:是不是PC1和R1之间不能通讯导致和R2不能通讯呢?那我们就来看下PC1和R1之间是否可以正常通讯,
看过这个结果后,相信大家就明白实验的目的已经达到了,只禁用了PC1对R2的任何访问,其他条件不受影响。
标准ACL实验二:只允许PC1对R1进行Telnet
路由器R1上需要的配置(基本配置见上图)
r1>en
r1#sh run
Building configuration...
Current configuration : 546 bytes
!
version 12.2
no service password-encryption
!
hostname r1
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0
ip address 172.16.1.1 255.255.255.0
ip access-group 10 out
clock rate 64000
!
interface Serial0/1
no ip address
shutdown
!
ip classless
!
!
access-list 10 permit host 192.168.1.2
!
!
!
line con 0
line vty 0 4
access-class 10 in
password cisco
login
!
!
end
路由器R2上需要的配置(基本配置见上图)
r2>
r2>en
r2#sh run
Building configuration...
Current configuration : 463 bytes
!
version 12.2
no service password-encryption
!
hostname r2
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0
ip address 172.16.1.2 255.255.255.0
!
interface Serial0/1
no ip address
shutdown
!
ip classless
ip route 192.168.1.0 255.255.255.0 172.16.1.1
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
end
这里就用到了控制VTY(Telnet)访问(虚拟通道)(语法可参考上篇文章访问控制列表(ACL)简介 CISCO之CCNA篇之七(1)),在R1上做相关的配置,最后看实验的结果,
从上面的三个图片不难看出,只有在PC1上输入了正确的密码后可以Telnet登录到R1上,而PC2和PC3都是拒绝的(Connection refused by remote host远程连接主机被拒绝)。当然在实际中是 不允许使用Telnet登录的,这样很不安全,应用SSH远程登录,不过我们这里是为了做虚拟通道的实验,暂不考虑安全问题。
标准的访问列表就介绍到这里,后面为大家实验介绍扩展访问列表,敬请关注!本文出自 “冰泉” 博客,请务必保留此出处http://shuangyang.blog.51cto.com/540829/170176
相关文章推荐
- 时间访问控制列表 CISCO之CCNA篇之七(4)
- Cisco Press CCNA (640-802) Video Mentor 2nd Edition - RAGAiSO
- CCNA-Cisco-Chapter4
- CCNA-Cisco-Chapter7
- CCNA2-Cisco-Chapter4
- Cisco CCNA 之 Packet Tracer 练习题系列
- cisco CCNA第三学期第二章官方测试题
- cisco的ccna题的拷贝
- 来自CISCO官网“CCNA考试预习中心”的最新消息
- CCNA(二)cisco三层模型
- cisco-ccna-第八章测试-work1-汉语
- CCNA Cisco基础 学习总结
- 以前学习cisco ccna 课程的时候做的笔记
- CCNA学习笔记4-安装Cisco设备
- CCNA系列课程(2) 路由器的启动及Cisco设备管理 推荐
- 点到点协议PPP CISCO之CCNA篇之九
- CCNA-Cisco-Chapter8
- CCNA2-Cisco-Chapter5
- Cisco CCNA 之 Packet Tracer 练习题系列
- Cisco CCNA 之 Packet Tracer 练习题系列