只有一个思科三层交换机3560怎么实现两个VLAN间通信

2024-12-01 18:12:43
推荐回答(2个)
回答1:

给你一个完整版的

Switchserver#vlan dat

Switchserver(vlan)#vlan 4 name test4 为vlan4and vlan5 命名
VLAN 4 added:
Name: test4
Switchserver(vlan)#vlan 5 name test5
VLAN 5 added:
Name: test5
Switchserver(vlan)#exit
APPLY completed.
Exiting....
Switchserver#config t 进入全局模式,为vlan4和vlan 5指定IP和网关
Enter configuration commands, one per line. End with CNTL/Z.
Switchserver(config)#int vlan 4
Switchserver(config-if)#
%LINK-5-CHANGED: Interface Vlan4, changed state to up
ip add 172.16.8.254 255.255.255.0
Switchserver(config-if)#ip add 172.16.8.254 255.255.255.0
Switchserver(config-if)#no shutdown
Switchserver(config-if)#end
Switchserver#
%SYS-5-CONFIG_I: Configured from console by console
Switchserver#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switchserver(config)#int vlan 5
Switchserver(config-if)#
%LINK-5-CHANGED: Interface Vlan5, changed state to up
Switchserver(config-if)#ip add 172.16.7.254 255.255.255.0
Switchserver(config-if)#no shutdown
Switchserver(config-if)#ip routing 开通vlan4和vlan5的IP路由功能
Switchserver(config)#end
Switchserver#
%SYS-5-CONFIG_I: Configured from console by console
Switchserver#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switchserver(config)#int vlan 4
Switchserver(config-if)#ip routing
Switchserver(config)#
Switchserver#
%SYS-5-CONFIG_I: Configured from console by console

Switchserver#config

Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switchserver(config)#int vlan 4 将vlan4和交换机的11-15号端口相关联
Switchserver(config-if)#interface range fa0/11-15
Switchserver(config-if-range)#sw access vlan 4
Switchserver(config-if-range)#exit
Switchserver(config)#interface range fa0/16-20 将vlan5和交换机的16-20号端口相关联
Switchserver(config-if-range)#sw access vlan 5
Switchserver(config-if-range)#end

以上一切就Ok了,实现了同个三层交换机上,两个vlan里的PC互访的功能!

回答2:

开启三层功能 ip routing