1. 三层交换机实现VLAN间路由-拓扑图
2. 三层交换机实现VLAN间路由-配置文档解释
本案例中,只需要在汇聚交换机(4楼中心机房SW)上进行配置
本案例中,只需要在汇聚交换机(4楼中心机房SW)上进行配置
enable //从用户模式(>)进入到特权模式(#)
configure terminal //从特权模式(#)进入到全局配置模式
no logging on no ip domain-lookup //禁止DNS解析
hostname 4LouZhongXinJiFangSW //给这台设备起名字
vlan 20 //进入VLAN配置模式,同时创建VLAN 20
name ZongHeGuanliBu //给VLAN20起名字,综合管理部
vlan 30 //进入VLAN配置模式,同时创建VLAN 30
name ShiChangBu //给VLAN30起名字,市场部
vlan 50 //进入VLAN配置模式,同时创建VLAN 50
name JiShuBu //给VLAN50起名字,技术部
exit //退出VLAN配置模式
interface vlan 20 //创建虚拟接口/端口,接口/端口名称是vlan 20
ip address 192.168.20.1 255.255.255.0 //给虚拟接口VLAN20配置IP地址
description ZongHeGuanliBu //描述虚拟接口VLAN20的用途
no shutdown //开启该虚拟接口
exit //退出虚拟接口配置模式
interface vlan 30ip address 192.168.30.1 255.255.255.0
description ShiChangBu
no shutdown
exit
interface vlan 50ip address 192.168.50.1 255.255.255.0
description JishuBu
no shutdown
exitinterface fastEthernet 0/1 //进入端口配置模式,具体配置的端口是fa0/1口。
fastethernet快速以太网,百兆,工作在二层,数据链路层。
description ToZGBSwitchFa0/24 //给实体端口fa0/1起个名字
switchport mode access //端口模式接入口(还有一种是trunk中继口,trunk口允许多个vlan通过,access口和trunk口对应,access只允许某一个vlan通过。)
switchport access vlan 20 //通过该口的数据属于VLAN20,该access口允许vlan 20通过
no shutdown //开启该端口
exit //退出端口配置模式
interface fastEthernet 0/2
description ToSCBSwitchFa0/24
switchport mode access
switchport access vlan 30
no shutdown
exit
interface fastEthernet 0/3
description ToJSBSwitchFa0/24
switchport mode access
switchport access vlan 50
no shutdown
exit
exit
write
copy running-config startup-config
3. 三层交换机实现VLAN间路由-配置脚本
enable
configure terminal
no logging on
no ip domain-lookup
hostname HuiJuCisco3560
vlan 20name ZongHeGuanliBu
vlan 30name ShiChangBu
vlan 50name JiShuBuexitinterface
vlan 20ip address 192.168.20.1 255.255.255.0
description ZongHeGuanliBu
no shutdown
exit
interface vlan 30
ip address 192.168.30.1 255.255.255.0
description ShiChangBu
no shutdown
exit
interface vlan 50
ip address 192.168.50.1 255.255.255.0
description JishuBu
no shutdown
exit
interface fastEthernet 0/1
description ToZGBSwitchFa0/24
switchport mode access
switchport access vlan 20
no shutdown
exit
interface fastEthernet 0/2
description ToSCBSwitchFa0/24
switchport mode access
switchport access vlan 30
no shutdown
exit
interface fastEthernet 0/3
description ToJSBSwitchFa0/24
switchport mode access
switchport access vlan 50
no shutdown
exit
ip routing
exit
write
copy running-config startup-config
4. 三层交换机实现VLAN间路由-刷脚本过程展示