基于acl的相关实验

 拓扑图如下(学号26):

 

 

配置静态路由:

R1(config)#int f0/0

R1(config-if)#ip address 10.26.1.1 255.255.255.0

R1(config-if)#no shutdown

R1(config)#int f0/1

R1(config-if)#ip address 14.26.2.1 255.255.255.0

R1(config-if)#no shutdown

 

R4(config)#ip route 10.26.1.0 255.255.255.0 14.26.2.1

R3(config)#ip route 14.26.2.0 255.255.255.0 10.26.1.1

R2(config)#ip route 14.26.2.0 255.255.255.0 10.26.1.1

 

测试网络是否Ping通:

R2pingR4

 

 

R1pingR4

 

 

R3pingR2

 

 

R4pingR2

 

 

标准acl

R4(config)#access-list 1 deny 10.26.1.2  0.0.0.0

R4(config)#int f0/1

R4(config-if)#ip access-group 1 in

R4(config-if)#end

自反acl

R1(config)#ip access-list extended come

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

R1(config-ext-nacl)#evaluate abc

R1(config)#int f0/1

R1(config-if)#ip access-group come in

说明ICMP是可以任意访问的

 

R1(config)#ip access-list extended goto

R1(config-ext-nacl)#permit tcp any any eq telnet reflect abc timeout 60

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

R1(config)#int f0/1

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

动态acl

R1(config)#access-list 100 permit tcp an an eq telnet

R1(config)#access-list 100 dynamic ccie timeout 2 permit icmp any any

R1(config)#int f0/0

R1(config-if)#ip access-group 100 in

 

 

配置本地用户数据库

R1(config)#username ccie password ysx

R1(config)#line vty 0 181

R1(config-line)#login local

R1(config-line)#autocommand access-enable

 

 

R1#show ip access-lists

Extended IP access list 100

    10 permit tcp any any eq telnet (84 matches)

    20 Dynamic ccie permit icmp any any

Reflexive IP access list abc

Extended IP access list come

    10 permit icmp any any (35 matches)

    20 evaluate abc

Extended IP access list goto

    10 permit tcp any any eq telnet reflect abc (23 matches)

20 permit ip any any (15 matches)

 

 

基于时间的acl

R1(config)#time-range  TELNET

R1(config-time-range)#periodic weekdays 9:00 to 14:00

R1(config)#access-list 150 deny tcp host 10.26.1.2 any eq 23 time TELNET

 R1(config)#$ 150 deny tcp host 10.26.1.2 any eq 23 time-range TELNET

R1(config)#access-list 150 permit ip any any

R1(config)#int f0/0

R1(config-if)#ip access-group 150 in

查看路由器时间

 

 

测试R2R4发起telnet会话

r2#telnet 14.26.2.4

Trying 14.26.2.4 ...

% Destination unreachable; gateway or host down

r2#

说明:可以看到,在规定的时间范围内,R2R4发起telnet会话是被拒绝的。

测试除telnet外的其它流量

r2#ping 14.26.2.4

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 14.26.2.4, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms

r2#

说明:可以看到,在规定的时间范围内,除了telnet之外,其它流量不受限制

 

 

查看当前R1的时间

r1#sh clock

 

 

测试R2R4发起telnet会话

r2#telnet 14.26.2.4

Trying 14.26.2.4 ... Open

r4>

说明:在时间范围之外,所限制的流量被放开。

 

 

posted @ 2019-05-26 17:52  yuesx  阅读(423)  评论(2编辑  收藏  举报