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

相关内容

热门资讯

原创 中... 在阅读文章前,辛苦您点下“关注”,方便讨论和分享。作者定会不负众望,按时按量创作出更优质的内容 文...
影石创新遭巨头“密集攻击”?刘... 来源:市场资讯 (来源:达摩财经) 影石创新日前正式发布全球首款全景无人机“影翎Antigravi...
欧盟调查谷歌利用网络内容支持A... 新华社布鲁塞尔12月9日电(记者丁英华 张兆卿)欧盟委员会9日宣布,对美国谷歌公司利用网络内容为其人...
圣奥化学公布新型绿色防老剂SA... 来源:市场资讯 (来源:中国化工信息周刊) 关键词 | 圣奥化学SA6000开发进展 共 1064字...
人工智能也有“真香定律”!从科... 潮新闻客户端 记者 谢春晖 通讯员 姜慧君 方临明 人工智能浪潮奔涌。从率先布局抢占赛道先机,到...