接入层交换机端口设置access且分别设置不同的vlan之后,竟然还能互通。
现象:PC4能ping通PC6
此次实验暂未涉及到交换机3
交换机1:
sysname SW1
dhcp enable
vlan 1
vlan 10
vlan 20
vlan 30
dhcp server ip-pool vlan10
gateway-list 192.168.10.254
network 192.168.10.0 mask 255.255.255.0
dhcp server ip-pool vlan20
gateway-list 192.168.20.254
network 192.168.20.0 mask 255.255.255.0
dhcp server ip-pool vlan30
gateway-list 192.168.30.254
network 192.168.30.0 mask 255.255.255.0
interface Vlan-interface1
ip address 192.168.1.1 255.255.255.0
interface Vlan-interface10
ip address 192.168.10.254 255.255.255.0
interface Vlan-interface20
ip address 192.168.20.254 255.255.255.0
interface Vlan-interface30
ip address 192.168.30.254 255.255.255.0
interface GigabitEthernet1/0/1
port link-type trunk
port trunk permit vlan 1 10 20 30
interface GigabitEthernet1/0/2
port link-type trunk
port trunk permit vlan 1 10 20 30
交换机2:
sysname SW2
vlan 1
vlan 10
vlan 20
vlan 30
interface Vlan-interface1
ip address 192.168.1.2 255.255.255.0
interface GigabitEthernet1/0/1
port link-type trunk
port trunk permit vlan 1 10 20 30
interface GigabitEthernet1/0/2
port access vlan 10
interface GigabitEthernet1/0/3
port access vlan 10
interface GigabitEthernet1/0/4
port access vlan 20
interface GigabitEthernet1/0/5
port access vlan 20
(0)
最佳答案
你这是跨三层转发了,不同vlan的三层报文是可以互通的
(0)
做包过滤,参考这个链接学习下,讲不太清楚 https://www.h3c.com/cn/d_202106/1413138_30005_0.htm#_Toc73553745
做包过滤,参考这个链接学习下,讲不太清楚 https://www.h3c.com/cn/d_202106/1413138_30005_0.htm#_Toc73553745
因为经过了最上面的网关设备,所以是可以互通的。
如果要实现隔离不能互通,可以使用高级ACL来实现,以下是配置举例:
组网说明:
本案例采用H3C HCL模拟器来模拟高级ACL典型组网配置。服务器在网络拓扑图中已有明确的标识。要求VLAN 10仅能访问server1,VLAN 20仅能访问server2。R1与SW1运行OSPF路由协议。
1、按照网络拓扑图正确配置IP地址
2、SW1与R1运行OSPF路由协议
3、在SW1配置高级ACL,VLAN 10仅能访问server1,VLAN 20仅能访问server2。
第一阶段调试(基础网络配置):
SW1:
SW1:
System View: return to User View with Ctrl+Z.
[H3C]sysname SW1
[SW1]int loopback 0
[SW1-LoopBack0]ip address 1.1.1.1 32
[SW1-LoopBack0]quit
[SW1]router id 1.1.1.1
[SW1]vlan 10
[SW1-vlan10]quit
[SW1]vlan 20
[SW1-vlan20]quit
[SW1]int vlan 10
[SW1-Vlan-interface10]ip address 172.16.10.1 24
[SW1-Vlan-interface10]quit
[SW1]int vlan 20
[SW1-Vlan-interface20]ip address 172.16.20.1 24
[SW1-Vlan-interface20]quit
[SW1]int gi 1/0/2
[SW1-GigabitEthernet1/0/2]port link-type access
[SW1-GigabitEthernet1/0/2]port access vlan 10
[SW1-GigabitEthernet1/0/2]quit
[SW1]int gi 1/0/3
[SW1-GigabitEthernet1/0/3]port link-type access
[SW1-GigabitEthernet1/0/3]port access vlan 20
[SW1-GigabitEthernet1/0/3]quit
[SW1]int gi 1/0/1
[SW1-GigabitEthernet1/0/1]port link-mode route
[SW1-GigabitEthernet1/0/1]des
[SW1-GigabitEthernet1/0/1]ip address 10.0.0.1 30
[SW1-GigabitEthernet1/0/1]quit
[SW1]ospf 1 router-id 1.1.1.1
[SW1-ospf-1]area 0.0.0.0
[SW1-ospf-1-area-0.0.0.0]network 10.0.0.1 0.0.0.0
[SW1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[SW1-ospf-1-area-0.0.0.0]network 172.16.10.0 0.0.0.255
[SW1-ospf-1-area-0.0.0.0]network 172.16.20.0 0.0.0.255
[SW1-ospf-1-area-0.0.0.0]quit
[SW1-ospf-1]quit
[SW1]
R1:
System View: return to User View with Ctrl+Z.
[H3C]sysname R1
[R1]int gi 0/0
[R1-GigabitEthernet0/0]des
[R1-GigabitEthernet0/0]ip address 10.0.0.2 30
[R1-GigabitEthernet0/0]quit
[R1]int gi 0/1
[R1-GigabitEthernet0/1]ip address 192.168.1.1 24
[R1-GigabitEthernet0/1]quit
[R1]int gi 0/2
[R1-GigabitEthernet0/2]ip address 192.168.2.1 24
[R1-GigabitEthernet0/2]quit
[R1]int loopback 0
[R1-LoopBack0]ip address 2.2.2.2 32
[R1-LoopBack0]quit
[R1]router id 2.2.2.2
[R1]ospf 1 router-id 2.2.2.2
[R1-ospf-1]area 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 10.0.0.2 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]quit
[R1-ospf-1]quit
第一阶段测试:
所有PC都填写IP地址,且都能互通:
第二阶段调试(高级ACL关键配置点):
SW1:
[SW1]acl advanced 3000
[SW1-acl-ipv4-adv-3000]rule 0 permit ip source 172.16.10.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
[SW1-acl-ipv4-adv-3000]rule 1 permit ip source 172.16.20.0 0.0.0.255 destination 192.168.2.0 0.0.0.255
[SW1-acl-ipv4-adv-3000]rule 3 deny ip source 172.16.10.0 0.0.0.255 destination 192.168.2.0 0.0.0.255
[SW1-acl-ipv4-adv-3000]rule 4 deny ip source 172.16.20.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
[SW1-acl-ipv4-adv-3000]quit
[SW1]int gi 1/0/1
[SW1-GigabitEthernet1/0/1]packet-filter 3000 outbound
[SW1-GigabitEthernet1/0/1]quit
第二阶段测试:
VLAN 10的终端能PING通server1,无法Ping通server2:
Vlan 20的终端能PING通server2,PING不通server1:
Server1能PING通VLAN 10的终端,PING不通VLAN 20的终端:
Server2能PING通VLAN 20的终端,PING不通VLAN 10的终端:
查看ACL的匹配情况:
(0)
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
真机可以端口加隔离组,不过模拟器暂时不支持,要用acl。或者用super vlan(模拟器需要手动切版本到b59)、vxlan这类投机取巧的方法。