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

相关内容

热门资讯

小米MiMo Token Pl... IT之家 6 月 2 日消息,小米今日正式公布了 MiMo Token Plan 老用户专属“回归礼...
2026年6月防销售飞单AI工... 销售飞单、私单、客资外流,是各大销售型企业长期面临的核心难题。普通通讯设备缺乏管控能力,改装机型存在...
苹果智能眼镜据报道推迟至202... 如果你一直期待着拥有一副苹果智能眼镜,恐怕需要比预期等待更长的时间了。 据彭博社记者马克·古尔曼透露...
Anthropic刚递表IPO... Anthropic已经秘密向美国证券交易委员会(SEC)递交了 S-1注册声明草稿。这意味着一旦SE...
智博会启新章 中国电信深耕AI... (记者 林碧涓)2026世界智能产业博览会于5月28日至31日在天津举办。本届博览会由天津重庆两地政...