ACL实验-交换机实现三层隔离
创始人
2024-09-25 19:24:05

要求:

        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策略。

相关内容

热门资讯

未来三年销售目标突破千亿元!京... 上证报中国证券网讯(记者 刘暄)京东与荣耀4月2日签署战略合作协议,明确未来三年荣耀在京东全渠道销售...
我国科研人员发现99个新物种 我国科研人员发现99个昆虫新物种 为青藏高原生物多样性再添新证 4月1日,我国科研人员在国际动物分类...
兴源自动化取得电芯高效测漏设备... 国家知识产权局信息显示,惠州市兴源自动化设备有限公司取得一项名为“一种电芯高效测漏设备”的专利,授权...
量旋科技完成6亿元C+轮融资 ... 本报讯 (记者张敏)4月3日,深圳量旋科技有限公司(以下简称“量旋科技”)宣布完成6亿元C+轮融资。...
李云泽:推动构建与未来产业全生... 上证报中国证券网讯 据金融监管总局4月3日消息,4月1日,金融监管总局举办党委理论学习中心组集体(扩...