设为首页 收藏本站
查看: 1282|回复: 0

[经验分享] Cisco ios 自反ACL配置详解

[复制链接]

尚未签到

发表于 2018-7-20 06:02:02 | 显示全部楼层 |阅读模式
  反身ACL是在Cisco   IOS   Release   11.3引入的,他只能和扩展的命名IP  ACL一起定义而不能和基于数字或标准ACL,以及其他协议的ACL一起使用,语法如下:
  ip access-list extended permit any any reflect name [timeout]
  ip access-list extended evaluate
  interface   xx
  ip acces-group {name}   {in   |   out}
  1)Reflexive-ACL 的工作流程:
  a.由内网始发的流量到达配置了自反访问表的路由器,路由器根据此流量的第三层和第四层信息自动生成一个临时性的访问表,临时性访问表的创建依据下列原 则:
  protocol 不变,source-IP 地址 , destination-IP  地址严格对调,source-port,destination-port 严格对调,对于ICMP 这样的协议,会根据类型号进行匹配。
  b.路由器将此流量传出,流量到达目标,然后响应流量从目标返回到配置了自反访问表的路由器。
  c.路由器对入站的响应流量进行评估,只有当返回流量的第三、四层信息与先前基于出站流量创建的临时性访问表的第三、四层信息严格匹配时,路由器才会允许 此流量进入内部网络。
  2)自反访问表的超时:
  对于TCP 流量,当下列三种情况中任何一种出现时,才会删除临时性的访问表:
  a)两个连续的FIN 标志被检测到,之后3秒钟删除。
  b)RST 标志被检测到,立即删除。
  c)配置的空闲超时值到期(缺省是300 秒)。
  对于UDP,由于没有各种标志,所以只有当配置的空闲超时值(
  默认300 秒
  )到期才会删除 临时性的访问表。
  如下举例说明:
  R2模拟边界路由器
  R1模拟内部路由器
  R3模拟外部路由器
  试验要求:
  运用reflexive access-list 实现,内网可以ping,telnet等...外部网络.而外部网络不能访问内部网络
  R1的配置:
  interface Ethernet0/0
  no ip address
  shutdown
  half-duplex
  !
  interface Serial0/0
  ip address 10.1.1.1 255.255.255.0
  !
  interface Serial0/1
  no ip address
  shutdown
  !
  interface Ethernet1/0
  no ip address
  shutdown
  half-duplex
  !
  router ospf 100
  log-adjacency-changes
  network 10.1.1.1 0.0.0.0 area 0
  !
  no ip http server
  (R1上的配置很简单,不用解释了)
  R2的配置:
  interface Ethernet0/0
  no ip address
  shutdown
  half-duplex
  !
  interface Serial0/0
  ip address 10.1.1.2 255.255.255.0
  ip access-group neibu_in in
  clock rate 64000
  !
  interface Serial0/1
  ip address 192.168.1.1 255.255.255.0
  ip access-group waibu_in in
  !
  interface Ethernet1/0
  no ip address
  shutdown
  half-duplex
  !
  router ospf 100
  log-adjacency-changes
  network 10.1.1.2 0.0.0.0 area 0
  network 192.168.1.1 0.0.0.0 area 0
  !
  no ip http server
  !
  !
  !
  !
  ip access-list extended neibu_in
  permit icmp host 10.1.1.1 any reflect cisco timeout 30
  permit tcp host 10.1.1.1 any reflect cisco timeout 30    // timeout  默认是300秒.这儿为了测试,设置为30秒
  permit ip any any                         (这句可以不要,但这儿为了保证连通性测试)
  ip access-list extended waibu_in
  evaluate cisco                // 引用(参照)外出的ACL,产生一条临时的permit语句  reflect+evalute实现单向访问控制列表
  deny icmp any any
  deny tcp any any eq telnet
  permit ip any any
  !
  !
  !
  control-plane
  R3的配置:
  interface Ethernet0/0
  no ip address
  shutdown
  half-duplex
  !
  interface Serial0/0
  no ip address
  shutdown
  !
  interface Ethernet0/1
  no ip address
  shutdown
  half-duplex
  !
  interface Serial0/1
  ip address 192.168.1.2 255.255.255.0
  clock rate 64000
  !
  router ospf 100
  log-adjacency-changes
  network 192.168.1.2 0.0.0.0 area 0
  !
  no ip http server
  !
  control-plane
  !
  line con 0
  exec-timeout 0 0
  password cisco
  login
  line aux 0
  line vty 0 4
  password cisco
  login
  在没有测试只前:
  R2#sh   ip   access-lists
  Reflexive IP access list cisco
  Extended IP access list neibu_in
  10 permit icmp host 10.1.1.1 any reflect cisco (54 matches)
  20 permit tcp host 10.1.1.1 any reflect cisco (88 matches)
  30 permit ip any any (602 matches)
  Extended IP access list waibu_in
  10 evaluate cisco
  20 deny icmp any any (68 matches)
  30 deny tcp any any eq telnet (3 matches)
  40 permit ip any any (758 matches)
  R2#
  开始测试:
  r1#ping   192.168.1.2
  Type escape sequence to abort.
  Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
  !!!!!
  Success rate is 100 percent (5/5), round-trip min/avg/max = 56/57/60 ms
  r1#
  r1#telnet   192.168.1.2
  Trying 192.168.1.2 ... Open
  User Access Verification
  Password:
  r3>en
  Password:
  r3#    //telnet上去以后不要关闭,否则timeout时间马上会变为3秒,看不到试验现象
  /////////////////////////////////////////////////////////////////
  r2#sh   ip   access-lists
  Reflexive IP access list cisco
  permit tcp host 192.168.1.2 eq telnet host 10.1.1.1 eq 31699 (103  matches) (time left 28)
  permit icmp host 192.168.1.2 host 10.1.1.1   (20 matches) (time left  0) //这两条是动态产生的,30秒的生存时间
  Extended IP access list neibu_in
  10 permit icmp host 10.1.1.1 any reflect cisco (65 matches)
  20 permit tcp host 10.1.1.1 any reflect cisco (145 matches)
  30 permit ip any any (611 matches)
  Extended IP access list waibu_in
  10 evaluate cisco
  20 deny icmp any any (68 matches)
  30 deny tcp any any eq telnet (3 matches)
  40 permit ip any any (766 matches)
  在外网测试(R3上)
  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#
  r3#telnet   10.1.1.1
  Trying 10.1.1.1 ...
  % Destination unreachable; gateway or host down
  r3#
  外网不能访问内部,达到试验效果.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-538853-1-1.html 上篇帖子: Cisco voice 计算链路带宽消耗 下篇帖子: cisco命令学习,每天加一点
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表