Cisco自反控制列表的应用

        自反访问表实际上是扩展I P命名访问表的一种附加特性或功能。你可以为所有想要创建反向的表项的协议,使用一条p e r m i t语句创建一个扩展I P命名访问表。还要在每个p e r m i t语句中使用r e f l e c t关键字,用以表明访问表中需要使用一个自反向开启表项。除了需要在一个或多个p e r m i t语句中使用r e f l e c t关键字外,还必须考虑两条相关的I O S语
句。一条是e v a l u a t e语句,该语句要加在列表的结尾,以结束自反访问表。另一条语句是i preflexice-list timeout命令,用于改变临时自反访问表表项的全局t i m e - o u t的值(默认是300s,可以在全局模式通过ip reflexive-list timeout修改全局超时时间也可以在相应的应用行设置超时时间,其优先于全局设置值 )。
        自反列表的基本格式是:
         ip access-list extended xxx
         permit protocol source destination reflect name [time-out seconds]
         ip access-list extended yyy
         evaluate name   (此关键字临时创建内部通往外部的返回流量的开启表项,两标红处须相同,意思我想就不用赘述了吧)
        最后在接口启用,这和普通列表的应用规则类似。
        下面用实例演示一下吧:
     
         先查看一下测试前自反列表的配置:
R2#
R2#sh ip acce
Reflexive IP access list cisco
Extended IP access list infilter
    10 permit ospf any any (33 matches)(显示的定义允许ospf流量通过)
    20 evaluate cisco
Extended IP access list outfilter
    10 permit ospf any any (39 matches)
    20 permit icmp any host 2.2.2.2 reflect cisco
    30 permit icmp any host 30.1.1.1 reflect cisco
    40 permit tcp any host 2.2.2.2 eq telnet reflect cisco
    50 permit tcp any host 30.1.1.1 eq telnet reflect cisco
R2#  
        再查看一下测试后的自反列表的配置有什么不同:
Reflexive IP access list cisco
     permit tcp host 2.2.2.2 eq telnet host 1.1.1.1 eq 13232 (73 matches) (time left 293)
     permit icmp host 2.2.2.2 host 1.1.1.1  (19 matches) (time left 262)   (这里就是动态创建的临时开启表项。默认时间是300s后删除)
Extended IP access list infilter
    10 permit ospf any any (100 matches)
    20 evaluate cisco
Extended IP access list outfilter
    10 permit ospf any any (105 matches)
    20 permit icmp any host 2.2.2.2 reflect cisco (22 matches)
    30 permit icmp any host 30.1.1.1 reflect cisco (11 matches)
    40 permit tcp any host 2.2.2.2 eq telnet reflect cisco (245 matches)
    50 permit tcp any host 30.1.1.1 eq telnet reflect cisco (138 matches)
R2#   
        然后我们查看一下在接口下的应用:
interface Serial1/0
 ip address 2.2.2.1 255.255.255.0
 ip access-group infilter in
 clock rate 64000
!
interface Serial1/1
 ip address 1.1.1.2 255.255.255.0
 ip access-group outfilter in
        注意:内外方向列表的应用不一定要在同一个接口下。 
        Ok,我们现在R1上测试一下ping结果:
R1#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 136/213/268 ms
R1#ping 30.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 30.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 72/164/268 ms
R1#
        再测试一下telnet结果:
R1#
R1#telnet 2.2.2.2
Trying 2.2.2.2 ... Open

User Access Verification
Username: test
Password:
R3#
R1#telnet 30.1.1.1
Trying 30.1.1.1 ... Open

User Access Verification
Username: test
Password:
R3#(结果全部ok,符合题目要求)
       我们再在R3执行相同的测试:
R3#
R3#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
U.U.U
Success rate is 0 percent (0/5)
R3#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
U.U.U
Success rate is 0 percent (0/5)
R3#telnet 1.1.1.1
Trying 1.1.1.1 ...
% Destination unreachable; gateway or host down
R3#telnet 10.1.1.1
Trying 10.1.1.1 ...
% Destination unreachable; gateway or host down
R3#(由于不能允许由外部直接发起的流量通过,所以测试全部失败,但结果是正确的,对吗?)
         这里只是个简单的配置,目的是给大家演示一下配置步骤,具体情况还要自己在实验当中细细体会。谢谢!

本文出自 “Kendy” 博客,谢绝转载!

你可能感兴趣的:(职场,Cisco,休闲,自反控制)