最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 正文

思科设备三层交换机的vlan间通信配置

来源:动视网 责编:小OO 时间:2025-09-26 04:31:25
文档

思科设备三层交换机的vlan间通信配置

本次主要讲解三层交换实现vlan间的相互通信:本例配置模型图命令行:swA配置命令:Switch>enableSwitch#vlandatabase//进入vlan配置模式%Warning:ItisrecommendedtoconfigureVLANfromconfigmode,asVLANdatabasemodeisbeingdeprecated.PleaseconsultuserdocumentationforconfiguringVTP/VLANinconfigmode.Switch(v
推荐度:
导读本次主要讲解三层交换实现vlan间的相互通信:本例配置模型图命令行:swA配置命令:Switch>enableSwitch#vlandatabase//进入vlan配置模式%Warning:ItisrecommendedtoconfigureVLANfromconfigmode,asVLANdatabasemodeisbeingdeprecated.PleaseconsultuserdocumentationforconfiguringVTP/VLANinconfigmode.Switch(v
本次主要讲解三层交换实现vlan间的相互通信:

本例配置模型图

命令行:

swA配置命令:

Switch>enable

Switch#vlan database  //进入vlan配置模式

% Warning: It is recommended to configure VLAN from config mode,

  as VLAN database mode is being deprecated. Please consult user

  documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vlan 2 name TztA  //在swA上创建vlan 2 名为TztA

VLAN 2 added:

    Name: TztA

Switch(vlan)#vlan 3 name TztB  //在swA上创建vlan 3 名为TztB

VLAN 3 added:

    Name: TztB

Switch(vlan)#exit

APPLY completed.

Exiting....

Switch#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#int f0/2

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 2  //将f0/2划分给vlan 2

Switch(config-if)#exit

Switch(config)#int f0/3

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 3  //将f0/3划分给vlan 3

Switch(config-if)#exit

Switch(config)#int f0/1

Switch(config-if)#switchport mode trunk  //配置与三层设备连接的f0/1为trunk模式

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

Switch(config-if)#switchport trunk allowed vlan all //允许所有vlan通过f0/1端口

Switch(config-if)#exit

Switch(config)#exit

Switch#

%SYS-5-CONFIG_I: Configured from console by console

Switch#wr

Building configuration...

[OK]

Switch#

(三层交换机)M sw命令配置:

Switch>

Switch>enable

Switch#vlan database  //进入vlan配置模式

% Warning: It is recommended to configure VLAN from config mode,

  as VLAN database mode is being deprecated. Please consult user

  documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vlan 2 name TztA  //在Msw上创建vlan 2 名为TztA

VLAN 2 added:

    Name: TztA

Switch(vlan)#vlan 3 name TztB  //在Msw上创建vlan 2 名为TztA

VLAN 3 added:

    Name: TztB

Switch(vlan)#exit

APPLY completed.

Exiting....

Switch#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#int f0/1 

Switch(config-if)#switchport mode trunk   //配置三层设备与二层设备连接的f0/1为trunk模式

Command rejected: An interface whose trunk encapsulation is "Auto" can not be configured to "trunk" mode.

Switch(config-if)#switchport trunk allowed vlan all //允许所有vlan通过f0/1端口

Switch(config-if)#no shutdown  //激活端口

Switch(config-if)#exit

Switch(config)#ip routing  //使用三层设备的路由功能

Switch(config)#int vlan 2  //进入vlan 2配置模式虚拟端口

%LINK-5-CHANGED: Interface Vlan2, changed state to up

Switch(config-if)#

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to up

Switch(config-if)#ip address 192.168.1.1 255.255.255.0  //配置vlan 2的ip地址

Switch(config-if)#no shutdown  //激活端口

Switch(config-if)#exit

Switch(config)#int vlan 3  //配置vlan 3虚拟端口

Switch(config-if)#

%LINK-5-CHANGED: Interface Vlan3, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to up

Switch(config-if)#ip address 192.168.2.1 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#exit

Switch(config)#do show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

       * - candidate default, U - per-user static route, o - ODR

       P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, Vlan2  //上述的配置成果

C    192.168.2.0/24 is directly connected, Vlan3

Switch(config)#

Switch(config)#exit

Switch#

%SYS-5-CONFIG_I: Configured from console by console

Switch#wr

Building configuration...

[OK]

以上配置结束完成后,两台PC能够相互通信(如图):

注意:通信基础需要配置网关

本次讲解结束!

文档

思科设备三层交换机的vlan间通信配置

本次主要讲解三层交换实现vlan间的相互通信:本例配置模型图命令行:swA配置命令:Switch>enableSwitch#vlandatabase//进入vlan配置模式%Warning:ItisrecommendedtoconfigureVLANfromconfigmode,asVLANdatabasemodeisbeingdeprecated.PleaseconsultuserdocumentationforconfiguringVTP/VLANinconfigmode.Switch(v
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top