ip access-list extended infilter permit ip any any reflect cciepass 在出方向放置 evaluate
ip access-list extended outfilter evaluate cciepass
deny ip 10.54.48.0 0.0.0.255 any deny ip 10.54.49.0.0.0.0.255 any
deny ip 10.54.50.0 0.0.0.255 any
deny ip 10.54.51.0 0.0.0.255 any permit ip any any
!应用到管理接口
int vlan 63
ip access-group infilter in
ip access-group outfilter out
方法二:在管理 VLAN 接口上不放置任何访问列表,而是在其它 VLAN 接口都放。 以办公 VLAN 为例
在出方向放置 reflect
ip access-list extended outfilter permit ip any any reflect cciepass 在入方向放置 evaluate
ip access-list extended infilter
deny ip 10.54.48.0 0.0.0.255 10.54.49.0 0.0.0.255 deny ip 10.54.48.0 0.0.0.255 10.54.50.0 0.0.0.255 deny ip 10.54.48.0 0.0.0.255 10.54.51.0 0.0.0.255 deny ip 10.54.48.0 0.0.0.255 10.54.63.0 0.0.0.255 evaluate cciepass
permit ip any any 应用到办公 VLAN 接口: int vlan 48
ip access-group infilter in
ip access-group outfilter out
总结:
1) Reflect 放置在允许的方向上(可进可出)
2) 放在管理 VLAN 上配置简单,但是不如放在所有其它 VLAN 上直接。
3) 如果在内网口上放置: 在入上设置 Reflect 如果在外网口上放置: 在出口上放置 Reflect LAN WAN
inbound outbound
4)reflect 不对本地路由器上的数据包跟踪,所以对待进入的数据包时注意,要允许 一些数据流进入
关于访问列表的in/out
不管在那个端口启用,就在那个端口下ip access-group x in/out 所谓IN,就是在数据包进入路由器之前作访问表的对照,如果是OUT,就是数据可以先进 路由器,然后在出路由器时检查访问列表,所以默认是IN.
例如,假如你的例子中,E口是指向内网,并用IN,就是数据包----来自内网----在进入路
由器之前并检查.
思科的访问列表中,最后默认为DENY ANY,所以一般都要在列表最后一项加,
access-list xxx permit ip any any
从IOS12.0 开始,CISCO路由器新增加了一种基于时间的访问列表。通过它,可以根据一 天中的不同时间,或者根据一星期中的不同日期,当然也可以二者结合起来,控制对网 络数据包的转发。
一、使用方法这种基于时间的访问列表就是在原来的标准访问列表和扩展访问列表中加入有效
的时间范围来更合理有效的控制网络。它需要先定义一个时间范围,然后在原来的各种 访问列表的基础上应用它。并且,对于编号访问表和名称访问表都适用。
二、使用规则
用time-range 命令来指定时间范围的名称,然后用absolute命令或者一个或多个
periodic命令来具体定义时间范围。 IOS命令格式为:
time-range time-range-name absolute [start time date] [end time date]
periodic days-of-the week hh:mm to [days-of-the week] hh:mm
我们分别来介绍下每个命令和参数的详细情况
time-range : 用来定义时间范围的命令
time-range-name:时间范围名称,用来标识时间范围,以便于在后面的访问列表 中引用
absolute: 该命令用来指定绝对时间范围。它后面紧跟这start和 end两个关键字。 在这两个关键字后面的时间要以 24 小时制、hh:mm(小时:分钟)表示,日期要按照日/月/年来表示。可以看到,他们两个可以都省略。如果省略start及其后面的时间,那 表示与之相联系的permit 或deny语句立即生效,并一直作用到end处的时间为止;若省 略如果省略end及其后面的时间,那表示与之相联系的permit 或deny语句在start处表 示的时间开始生效,并且永远发生作用,当然把访问列表删除了的话就不会起作用了。怎么样,看明白了吗?上面讲的就是命令和基本参数为了便于理解,我们看两个例子。
1、如果要表示每天的早 8 点到晚 8 点就可以用这样的语句:
absolute start 8:00 end 20:00
2、再如,我们要使一个访问列表从 2006 年 10 月 1 日早 5 点开始起作用,直到 2006 年 10 月 31 日晚 24 点停止作用,语句如下:
absolute start 5:00 1 December 2000 end 24:00 31 December 2000 这样一来,我们就可以用这种基于时间的访问列表来实现,而不用半夜跑到办公室
去删除那个访问列表了。这对于网络管理员来说,是个很好的事情。如果你恰好是网管。。 哇。。。什么也不要讲了,快回去好好配置吧:)。好了接下来,让我们接着看下一个
periodic命令及其参数。一个时间范围只能有一个absolute语句,但是可以有几个
periodic语句。
periodic:主要是以星期为参数来定义时间范围的一个命令。它的参数主要有宾 Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday中的一个或者几个的 组合,也可以是daily(每天)、 weekday(周一到周五)或者 weekend(周末)。
示例一: 带Established选项的扩展访问列表 拓扑:
R2-(S2/0)-----------------(S2/0)-R1(S2/1)---------------(S2/1)-R3
带有Established的扩展访问列表允许内部用户访问外部网络,而拒绝外部网络访问内 部网络,而没带Established的标准访问列表和扩展访问列表没有这个特性. 这个示例首先用OSPF来使全网互联.
R1:
r1#sh run
*Mar 1 00:25:17.275: %SYS-5-CONFIG_I: Configured from console by console
Building configuration...
Current configuration : 1410 bytes version 12.2
service timestamps debug datetime msec service timestamps log datetime msec
no service password-encryption hostname r1
logging queue-limit 100 ip subnet-zero
ip audit notify log
ip audit po max-events 100
mpls ldp logging neighbor-changes no voice hpi capture buffer
no voice hpi capture destination mta receive maximum-recipients 0 interface Loopback0
ip address 1.1.1.1 255.255.255.0 interface FastEthernet0/0
no ip address shutdown duplex auto speed auto
interface FastEthernet1/0
no ip address
shutdown duplex auto speed auto
interface Serial2/0
ip address 12.1.1.1 255.255.255.0 encapsulation frame-relay
ip ospf network point-to-point serial restart_delay 0
frame-relay map ip 12.1.1.2 102 broadcast no frame-relay inverse-arp
interface Serial2/1
ip address 13.1.1.1 255.255.255.0 encapsulation frame-relay
ip ospf network point-to-point serial restart_delay 0
frame-relay map ip 13.1.1.3 113 broadcast interface Serial2/2
no ip address shutdown
serial restart_delay 0 interface Serial2/3
no ip address shutdown
serial restart_delay 0 router ospf 10
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0 ip http server
no ip http secure-server ip classless
call rsvp-sync
mgcp profile default dial-peer cor custom line con 0
line aux 0 line vty 0 4 no login
end
R2:
r2#sh run
Building configuration...
*Mar 1 00:27:29.871: %SYS-5-CONFIG_I: Configured from console by console
Current configuration : 1298 bytes version 12.2
service timestamps debug datetime msec service timestamps log datetime msec
no service password-encryption hostname r2
logging queue-limit 100 ip subnet-zero
ip audit notify log
ip audit po max-events 100
mpls ldp logging neighbor-changes no voice hpi capture buffer
no voice hpi capture destination mta receive maximum-recipients 0 interface Loopback0
ip address 2.2.2.2 255.255.255.0 interface FastEthernet0/0
no ip address shutdown duplex auto speed auto
interface FastEthernet1/0 no ip address
shutdown duplex auto speed auto
interface Serial2/0
ip address 12.1.1.2 255.255.255.0 encapsulation frame-relay
ip ospf network point-to-point serial restart_delay 0
frame-relay map ip 12.1.1.1 201 broadcast
no frame-relay inverse-arp
interface Serial2/1 no ip address shutdown
serial restart_delay 0 interface Serial2/2
no ip address shutdown
serial restart_delay 0 interface Serial2/3
no ip address shutdown
serial restart_delay 0 router ospf 10
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0 ip http server
no ip http secure-server ip classless
call rsvp-sync
mgcp profile default dial-peer cor custom line con 0
line aux 0 line vty 0 4 no login
end
r3
r3#sh run
Building configuration...
Current configuration : 1298 bytes version 12.2
service timestamps debug datetime msec service timestamps log datetime msec
no service password-encryption hostname r3
logging queue-limit 100
ip subnet-zero
ip audit notify log
ip audit po max-events 100
mpls ldp logging neighbor-changes no voice hpi capture buffer
no voice hpi capture destination mta receive maximum-recipients 0 interface Loopback0
ip address 3.3.3.3 255.255.255.0 interface FastEthernet0/0
no ip address shutdown duplex auto speed auto
interface FastEthernet1/0 no ip address
shutdown duplex auto speed auto
interface Serial2/0 no ip address shutdown
serial restart_delay 0 interface Serial2/1
ip address 13.1.1.3 255.255.255.0 encapsulation frame-relay
ip ospf network point-to-point serial restart_delay 0
frame-relay map ip 13.1.1.1 311 broadcast no frame-relay inverse-arp
interface Serial2/2 no ip address shutdown
serial restart_delay 0 interface Serial2/3
no ip address shutdown
serial restart_delay 0
router ospf 10
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0 ip http server
no ip http secure-server ip classless
call rsvp-sync
mgcp profile default dial-peer cor custom line con 0
line aux 0 line vty 0 4 no login
end
监视和测试配置:
我们让R2 作为内部网络,R3 作为内部网络,以下配置使R2 发起访问R3 没问题,从R3 访问 R2 则被拒绝.注意这个配置方案是针对基于TCP的应用,任何TCP通讯都是双向的,从R2 发 起的访问外部网络之后,外部网络的流量得以通过,这个时候TCP报文,ACK或RST位被设 置为 1
R1(configure)access-list 101 permit tcp any any established log-input
R1(configure)access-list 101 permit ospf any any R1(configure)access-list 101 deny ip any any log-input R1(configure)int s2/1
R1(configure-if)ip access-group 101 in
以上log-input是为了显示监视数据报文被过滤的情况,接下来用debug ip packet detailed来监视报文经过R1 的情况,应该路由器还有OSPF报文产生,因此我们对DEBUG信 息做了限制.
r1(config)#access-list 102 permit tcp any any
我们这样做 让R2 发起telnet访问R3 r1#telnet 3.3.3.3
Trying 3.3.3.3 ... Open r3>
注意R3 返回R2 的数据报文得以通过,接下来我们测试从R3 发起访问R2 的情况
r3#telnet 2.2.2.2
Trying 2.2.2.2 ...
% Destination unreachable; gateway or host down r1#
注意,TCP协议的第一次发送是SYN字段,这是用来同步准备建立一个新连接的两端主机, 而ACK位由接收者置位从而向发送者表明数据已经成功接收.RST(reset)位说明什么时 候重新启动连接.带Eetablished的扩展访问列表只允许ACK或RST位置 1 的TCP报文通过