ACL实验-交换机实现三层隔离

要求:

        192.168.20.0/24网段不能访问192.168.30.0/24网段。

        192.168.20.0/24网段可以访问192.168.40.1(web服务器) 不能访问192.168.40.2(ftp服务器)

        192.168.30.0/24网段可以访问192.168.40.1(web服务器) 不能访问192.168.40.2(ftp服务器)

1、实验拓扑图

2、交换机配置 

1)vlan配置

交换机与交换机之间使用trunk,交换机与PC、服务器之间使用Access。

LSW4:

vlan batch 20
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 20
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 20
#

LSW5:

vlan batch 30
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 30
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 30
#

LSW3:

#
vlan batch 20 30 40
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 20
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 30
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 40
#
interface GigabitEthernet0/0/4
 port link-type access
 port default vlan 40
#
interface Vlanif20
 ip address 192.168.20.254 255.255.255.0
#
interface Vlanif30
 ip address 192.168.30.254 255.255.255.0
#
interface Vlanif40
 ip address 192.168.40.254 255.255.255.0
#

2)ACL配置

要求:

192.168.20.0/24网段不能访问192.168.30.0/24网段。

192.168.20.0/24网段可以访问192.168.40.1(web服务器) 不能访问192.168.40.2(ftp服务器)

192.168.30.0/24网段可以访问192.168.40.1(web服务器) 不能访问192.168.40.2(ftp服务器)

第一步:创建两个acl,acl 3001 和acl 3002,acl 3001里面写允许策略,acl 3002里面写拒绝策略。均在LSW3上配置。

acl number 3001
 rule 5 permit ip source 192.168.20.0 0.0.0.255 destination 192.168.40.1 0
 rule 10 permit ip source 192.168.30.0 0.0.0.255 destination 192.168.40.1 0
acl number 3002
 rule 5 deny ip source 192.168.20.0 0.0.0.255 destination 192.168.30.0 0.0.0.255
 rule 10 deny ip source 192.168.30.0 0.0.0.255 destination 192.168.20.0 0.0.0.25
5
 rule 15 deny ip source 192.168.20.0 0.0.0.255 destination 192.168.40.2 0
 rule 20 deny ip source 192.168.30.0 0.0.0.255 destination 192.168.40.2 0
#

第二步:配置分流策略。tc1匹配ACL 3001,tc2匹配acl 3002。分流操作都是and操作,与的操作。

#
traffic classifier tc1 operator and
 if-match acl 3001
traffic classifier tc2 operator and
 if-match acl 3002
#

第三步:配置分流行为。配置tb1的行为为permit。tb2的行为为deny。

#
traffic behavior tb1
 permit
traffic behavior tb2
 deny
#

第四步:配置流量分配策略。设置策略名为tp。类tc1与tb1对应,类tc2与tb2对应。

#
traffic policy tp
 classifier tc1 behavior tb1
 classifier tc2 behavior tb2
#

第五步:在交换机的入接口(vlan所属的一段)配置流策略。也就是LSW3的G0/0/1(vlan 20)\G0/0/2(vlan 30)配置。

 

#
vlan 20
 traffic-policy tp inbound
vlan 30
 traffic-policy tp inbound
#

 3、测试

PC3:PC3ping192.168.30.1(不通)、192.168.40.1(通)、192.168.40.2(不通)。

PC4:PC4ping192.168.20.1(不通)、192.168.40.1(通)、192.168.40.2(不通)。

通过上述操作,已完成要求的ACL策略。

  • 26
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值