ESW1: (主要配置) 其它 电脑 就配置上IP 网关
!
interface FastEthernet1/0
switchport access vlan 10
duplex full
speed 100
!
interface FastEthernet1/1
switchport access vlan 30
duplex full
speed 100
!
interface FastEthernet1/2
switchport access vlan 20
duplex full
speed 100
!
interface FastEthernet1/3
switchport access vlan 10
duplex full
speed 100
!
interface Vlan10
ip address 172.24.42.254 255.255.255.0
ip access-group flow-in in
ip access-group flow-out out
!
interface Vlan20
ip address 172.24.8.254 255.255.255.0
!
interface Vlan30
ip address 172.24.16.254 255.255.255.0
!
no ip http server
no ip http secure-server
!
!
!
!
ip access-list extended flow-in
evaluate back
ip access-list extended flow-out
deny ip 172.24.16.0 0.0.0.255 host 172.24.42.1 log
permit ip 172.24.8.0 0.0.0.255 host 172.24.42.1 log reflect back
permit tcp any host 172.24.42.2 eq www log reflect back
permit ip any any
************************************************0.0*************************************************
工作原理
只含临时性条目,没有“拒绝一切”语句
临时性条目的特点:
1.总是允许语句;
2.指定与最初的外出数据包相同的协议(TCP);
3.指定与最初外出数据包相同的源地址和目的地址,但这两个地址的位置被互换;
4.指定与最初外出数据包相同的源和目的端口号码(对TCP/UDP),但这两个地址的位置被
互换;
5.对于不含端口号码的协议,如ICMP 和IGMP,它会指定其他准则;
6.入数据流将根据自反条目被评判,直到该条目过期被删除;
自反访问控制列表配置
自反访问列表的配置
需求:在公司的边界路由器上,要求只允许内网用户主动访问外网的流量,外网主动访问内网的所有流量都拒绝,注意:在企业边界路由器外口的入方向上要拒绝掉所有外网主动发起的流量,但是要能够允许内网发起而由外网返回的流量,否则内网发起的流量也不能正常通讯
—————————————————————–
企业边界路由器:
interface FastEthernet0/0
ip address 23.0.0.1 255.255.255.0
ip access-group ZIFAN-2 in
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 12.0.0.2 255.255.255.0
ip access-group ZIFAN in
duplex auto
speed auto
!
ip http server
no ip http secure-server
!
!
!
!
ip access-list extended ZIFAN
permit ip host 12.0.0.1 any reflect LINK_IN //指定该条语句执行自反,自反列表的名字为LINK_IN
ip access-list extended ZIFAN-2
evaluate LINK_IN //计算并生成自反列表
deny ip any any
—————————————————————–
说明1:reflect和evalute后面的对应名应该相同,此例中为LINK_IN
说明2:自反ACL只能在命名的扩展ACL里定义
—————————————————————–
试验结果:
router#sh access-lists
Reflexive IP access list LINK_IN
permit icmp host 23.0.0.2 host 12.0.0.1 (39 matches) (time left 289)
Extended IP access list ZIFAN
10 permit ip host 12.0.0.1 any reflect LINK_IN (188 matches)
Extended IP access list ZIFAN-2
10 evaluate LINK_IN
20 deny ip any any (52 matches)