您的当前位置:首页正文

Vlan的配置方法

2023-11-11 来源:步旅网
Vlan的配置方法

命令及注释 说明 vlan database 进入vlan配置模式 vtp domain 称为管理域,交换vtp domain com 设置vtp管理域名称 com vtp更新信息的所有交换机必须vtp server 设置交换机为服务器模式 配置为相同的管理域。核心交换vtp client 设置交换机为客户端模式 机和分支交换机都要配置

2、配置中继 interface fa0/1 进入端口配置模式 核心交换机上以上都要配置,不

switchport 过在分支交换机进入端口模式只switchport trunk encapsulation isl 配置中配置这个命令就可以了 继协议

switchport mode trunk

3、创建vlan vlan 10 name counter 创建vlan一旦建立了管理域,就

创建了一个编号为10 名字为counter的 可以创建vlan了。在核心交换机vlan。 上配置

4、将交换机端在分支交换机的端口配置模式下

switchport access vlan 10 归属counter vlan

口划入vlan 配置。 5、配置三层交interface vlan 10 在核心交换机上配置 换 ip address 172.16.58.1 255.255.255.0 给

vlan10配置ip

常见的VLAN配置类型 名称 简介及优缺点 适用范围

按VLAN交换机上的物理端口和内部的PVC(永久虚电路)端口来划分。

基于端口划优点:定义VLAN成员时非常简单,只要将所有的端口都定义为相适合于任何大小分的VLAN 应的VLAN组即可。 的网络

缺点:如果某用户离开原来的端口到一个新的交换机的某个端口,必须重新定义。

基于MAC地 这种划分VLAN的方法是根据每个用户主机的MAC地址来划适用于小型局域址划分VLAN 分。 网。 步骤

1、设置vtp domain

优点:当用户物理位置从一个交换机换到其他的交换机时,VLAN不用重新配置。

缺点:初始化时,所有的用户都必须进行配置。 VLAN按网络层协议来划分,可分为IP、IPX、DECnet、AppleTalk等VLAN网络。

基于网络层适用于需要同时

优点:用户的物理位置改变了,不需要重新配置所属的VLAN,而

协议划分运行多协议的网

且可以根据协议类型来划分VLAN,并且可以减少网络通信量,可

VLAN 络

使广播域跨越多个VLAN交换机。 缺点:效率低下。

IP 组播实际上也是一种VLAN的定义,即认为一个IP组播组适合于不在同一

根据IP组播就是一个VLAN。 地理范围的局域划分VLAN 优点:更大的灵活性,而且也很容易通过路由器进行扩展。 网用户组成一个

缺点:适合局域网,主要是效率不高。 VLAN 基于策略的VLAN能实现多种分配,包括端口、MAC地址、IP地址、网络层协议等

按策略划分适用于需求比较

优点:网络管理人员可根据自己的管理模式和需求来决定选择哪

VLAN 复杂的环境

种类型的VLAN 。

缺点:建设初期步骤繁复。

是指为了适应特别的VLAN网络,根据具体的网络用户的特别

按用户定义、

要求来定义和设计VLAN,而且可以让非VLAN群体用户访问VLAN,

非用户授权

但是需要提供用户密码,在得到VLAN管理的认证后才可以加入一

划分VLAN

个VLAN。

Vlan配置+实际工作需要 2008-03-13 17:54

Vlan管理地址:172.16.0.1 255.255.255.0 F0/0端口用于管理来用

划分四个Vlan 学生(students)Vlan100,教师(teacher)Vlan30,财务(marketing)Vlan40,市场部(accounting)Vlan10,然后将相应的端口划分到其Vlan下面 sw#sh run interface VLAN1

ip address 172.16.0.1 255.255.255.0 no ip directed-broadcast no ip route-cache line con 0

exec-timeout 0 0 logging synchronous transport input none stopbits 1 line vty 0 4 login

line vty 5 15 login ! end

Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#int f0/2 Switch(config-if)#swit

Switch(config-if)#switchport mode Switch(config-if)#switchport mode ac Switch(config-if)#switchport mode access Switch(config-if)#swit

Switch(config-if)#switchport a

Switch(config-if)#switchport access vlan 10 Switch(config-if)#int f0/3 Switch(config-if)#swit

Switch(config-if)#switchport mode a

Switch(config-if)#switchport mode access

Switch(config-if)#sw

Switch(config-if)#switchport a

Switch(config-if)#switchport access lan 10 ^ % Invalid input detected at '^' marker.

Switch(config-if)#exit Switch(config)#end Switch#show v

00:20:32: %SYS-5-CONFIG_I: Configured from console by console Switch#show vlan

VLAN Name Status Ports

---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1, Fa0/3, Fa0/4, Fa0/5, Fa0/6, Fa0/7, Fa0/8, Fa0/9, Fa0/10, Fa0/11, Fa0/12, Fa0/13, Fa0/14, Fa0/15, Fa0/16, Fa0/17, Fa0/18, Fa0/19, Fa0/20, Fa0/21, Fa0/22, Fa0/23, Fa0/24, Gi0/1, Gi0/2 10 Markeing active Fa0/2 30 Teacher active 40 Accouting active 100 Students active 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2

---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 1 enet 100001 1500 - - - - - 0 0 10 enet 100010 1500 - - - - - 0 0 30 enet 100030 1500 - - - - - 0 0 Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#int f0/3 Switch(config-if)#s Switch(config-if)#sw

Switch(config-if)#switchport mode a

Switch(config-if)#switchport mode access Switch(config-if)#sw

Switch(config-if)#switchport a

Switch(config-if)#switchport access vlan 10 Switch(config-if)#int f0/4 Switch(config-if)#swit

Switch(config-if)#switchport mode access Switch(config-if)#swit

Switch(config-if)#switchport access vlan 10 Switch(config-if)#int f0/5 Switch(config-if)#swit

Switch(config-if)#switchport mode a

Switch(config-if)#switchport mode access Switch(config-if)#sw

Switch(config-if)#switchport access vlan 10 Switch(config-if)#int f0/6 Switch(config-if)#swit

Switch(config-if)#switchport mode access Switch(config-if)#sw

Switch(config-if)#switchport access vlan 10 Switch(config-if)#exit Switch(config)#end Switch#show

00:23:04: %SYS-5-CONFIG_I: Configured from console by console Switch#show vlan

VLAN Name Status Ports

---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1, Fa0/7, Fa0/8, Fa0/9, Fa0/10, Fa0/11, Fa0/12, Fa0/13, Fa0/14, Fa0/15, Fa0/16, Fa0/17, Fa0/18, Fa0/19, Fa0/20, Fa0/21, Fa0/22, Fa0/23, Fa0/24, Gi0/1, Gi0/2

10 Markeing active Fa0/2, Fa0/3, Fa0/4, Fa0/5, Fa0/6 30 Teacher active 40 Accouting active 100 Students active 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 1 enet 100001 1500 - - - - - 0 0 10 enet 100010 1500 - - - - - 0 0 30 enet 100030 1500 - - - - - 0 0

Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#interface range f0/7 - 8 ^

% Invalid input detected at '^' marker. Switch(config)#interface range f0/7 -8 ^

% Invalid input detected at '^' marker.

Switch(config)#int f0/7 Switch(config-if)#switch

Switch(config-if)#switchport mode access Switch(config-if)#sw

Switch(config-if)#switchport access vlan 30 Switch(config-if)#int f0/8 Switch(config-if)#switch

Switch(config-if)#switchport mode access Switch(config-if)#swit

Switch(config-if)#switchport acces

Switch(config-if)#switchport access vlan 30 Switch(config-if)#int f0/9 Switch(config-if)#swit

Switch(config-if)#switchport mode access Switch(config-if)#switchport access vlan 40 Switch(config-if)#end Switch#show

00:26:28: %SYS-5-CONFIG_I: Configured from console by console Switch#show vlan

VLAN Name Status Ports

---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1, Fa0/10, Fa0/11, Fa0/12, Fa0/13, Fa0/14, Fa0/15, Fa0/16, Fa0/17, Fa0/18, Fa0/19, Fa0/20, Fa0/21, Fa0/22, Fa0/23, Fa0/24, Gi0/1, Gi0/2

10 Markeing active Fa0/2, Fa0/3, Fa0/4, Fa0/5, Fa0/6

30 Teacher active Fa0/7, Fa0/8 40 Accouting active Fa0/9 100 Students active 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 1 enet 100001 1500 - - - - - 0 0 10 enet 100010 1500 - - - - - 0 0 30 enet 100030 1500 - - - - - 0 0 40 enet 100040 1500 - - - - - 0 0 Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#int rang f0/10, f12 ^

% Invalid input detected at '^' marker. Switch(config)#int rang f0/10, f0/12

^

% Invalid input detected at '^' marker.

Switch(config)#end Switch#show vlan

00:27:55: %SYS-5-CONFIG_I: Configured from console by console Switch#int rang f0/10, f0/12 ^

% Invalid input detected at '^' marker.

Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#int f0/10 Switch(config-if)#swi

Switch(config-if)#switchport mode access Switch(config-if)#sw

Switch(config-if)#switchport access vlan 100 Switch(config-if)#int f0/11 Switch(config-if)#sw

Switch(config-if)#switchport mode access Switch(config-if)#sw

Switch(config-if)#switchport access vlan 100 Switch(config-if)#int f0/12 Switch(config-if)#swit

Switch(config-if)#switchport acc

Switch(config-if)#switchport access vlan 100] ^ % Invalid input detected at '^' marker. Switch(config-if)#switchport access vlan 100

Switch(config-if)#end Switch#show vlan

VLAN Name Status Ports

---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1, Fa0/13, Fa0/14, Fa0/15, Fa0/16, Fa0/17, Fa0/18, Fa0/19, Fa0/20, Fa0/21, Fa0/22, Fa0/23, Fa0/24, Gi0/1, Gi0/2 10 Markeing active Fa0/2, Fa0/3, F

00:29:33: %SYS-5-CONFIG_I: Configured from console by consolea0/4, Fa0/5, Fa0/6

30 Teacher active Fa0/7, Fa0/8 40 Accouting active Fa0/9

100 Students active Fa0/10, Fa0/11, Fa0/12 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 1 enet 100001 1500 - - - - - 0 0 10 enet 100010 1500 - - - - - 0 0 30 enet 100030 1500 - - - - - 0 0 40 enet 100040 1500 - - - - - 0 0 100 enet 100100 1500 - - - - - 0 0 --More--

划分Vlan成功之后,来将需要的端口划分到相应的vlan下。例如: 将F0/11划分到VLAN 40 下 sw#conf t

sw#int f0/11

sw#switchport mode access Sw#switchport access vlan 40

思考题:2900交换机支持的最大Vlan数目是多少?3500 了? 3500支持29个。。

思考题:能否使用一条命令将一批端口一次性划分到一个Vlan下面? conf t

int range f0/1 - 10

试验二和试验三

观察2900和3500等交换机的启动过程,IOS的版本,以及它有多少接口等。。。 配置管理IP地址和默认网关 SW#conf t

SW#interface vlan 1

ip add 192.168.0.1 255.255.255.0 ip default-gateway 172.16.0.1

清除交换机残留配置,erase startup-config 删除划分的Vlan del vlan.dat sw1为 rack62sw1 sw2为 rack62sw2

Trunk配置

设备:3500交换机 Ios:Version 12.0(5)WC17,

第一步:在SW1上配置VTP SW1#vlan da

SW1(vlan)#vtp domain norvel

Changing VTP domain name from NULL to norvel SW1(vlan)#vtp server

Device mode already VTP SERVER. SW1(vlan)#exit APPLY completed. Exiting.... SW1#

第二步:在SW2上配置VTP

SW2#vlan da

SW2(vlan)#vtp domain norvel

Changing VTP domain name from cisco to norvel SW2(vlan)#vtp client

Setting device to VTP CLIENT mode. SW2(vlan)#exit

In CLIENT state, no apply attempted. Exiting.... SW2#

第三步:在SW1上配置Trunk中继端口

SW1wangwanli#conf t

Enter configuration commands, one per line. End with CNTL/Z. SW1wangwanli(config)#int f0/23

SW1wangwanli(config-if)#sw

SW1wangwanli(config-if)#switchport mode trunk 配置f0/23交换机端口为trunk SW1wangwanli(config-if)#swi

SW1wangwanli(config-if)#switchport trunk en

SW1wangwanli(config-if)#switchport trunk encapsulation dot SW1wangwanli(config-if)#switchport trunk encapsulation dot1q 配置中继的封装类型为8021.Q

SW1wangwanli(config-if)#switchport trunk allowed vlan all 配置交换机通过中继传输的vlan为all 第四步在SW2上配置trunk中继端口

SW2wangwanli#conf t

Enter configuration commands, one per line. End with CNTL/Z. SW2wangwanli(config)#int f0/23 SW2wangwanli(config-if)#sw

SW2wangwanli(config-if)#switchport mode trunk SW2wangwanli(config-if)#

01:08:25: %LINK-4-ERROR: FastEthernet0/23 is experiencing errors

SW2wangwanli#show int f0/23 switchport Name: Fa0/23

Switchport: Enabled

Administrative mode: trunk Operational Mode: trunk

Administrative Trunking Encapsulation: isl 封装了为isl协议 Operational Trunking Encapsulation: isl Cisco 默认采用的是ISL封装

Negotiation of Trunking: Disabled Access Mode VLAN: 0 ((Inactive))

Trunking Native Mode VLAN: 1 (default) Trunking VLANs Enabled: ALL Trunking VLANs Active: 1

Pruning VLANs Enabled: 2-1001 Priority for untagged frames: 0 Override vlan tag priority: FALSE Voice VLAN: none

Appliance trust: none Self Loopback: No

第五步是在SW1上创建VLAN SW1wangwanli(config)#vlan ta SW1wangwanli(config)#exit SW1wangwanli#vlan da

01:20:31: %SYS-5-CONFIG_I: Configured from con SW1wangwanli#vlan da

SW1wangwanli(vlan)#vlan 2 name vlan 2 ^ % Invalid input detected at '^' marker. SW1wangwanli(vlan)#vlan 2 name VLAN2 VLAN 2 added: Name: VLAN2

SW1wangwanli(vlan)#vlan 3 name VLAN3 VLAN 3 added: Name: VLAN3

SW1wangwanli(vlan)#vlan 4 name VLAN4

VLAN 4 added: Name: VLAN4

SW1wangwanli(vlan)#vlan 5 name VLAN5 VLAN 5 added: Name: VLAN5

SW1wangwanli(vlan)#exit APPLY completed. Exiting.... SW1wangwanli#

SW1wangwanli#show int f0/23 switchport Name: Fa0/23

Switchport: Enabled

Administrative mode: trunk Operational Mode: trunk

Administrative Trunking Encapsulation: dot1q SW1议是ISL

Operational Trunking Encapsulation: dot1q Negotiation of Trunking: Disabled Access Mode VLAN: 0 ((Inactive))

Trunking Native Mode VLAN: 1 (default) Trunking VLANs Enabled: ALL

Trunking VLANs Active: 1-5,10,30,40,100 Pruning VLANs Enabled: 2-1001 Priority for untagged frames: 0 Override vlan tag priority: FALSE Voice VLAN: none

Appliance trust: none Self Loopback: No

是VTP server 在SW1封装的是dot1q SW2 show int f0/23 switchport 协SW1wangwanli#

第七步 到SW2上查看是否可以学习到。。。。 在SW2通过trunk学习到SW1上所建的VLAN

配置生成树协议 SW1#conf t

int range f0/11 - 12 no sh

switchport mode trunk end

SW2#conf t

int rang f0/11 - 12 no sh

switchport mode trunk end

在SW2上 show spanning-tree SW2#show spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol We are the root of the spanning tree

问题1:生成树的根桥是那一个交换机?怎么来确定根桥?

根桥的选择取决于交换机的BPDU值,查看ID值和MAC地址表。两者比较最小的为rootswitch 问题2:如何知道一个交换机成为根桥? 问题3:为什么交换机会选择成为根桥?

问题4:为什么sw2的F0/12会被阻塞?为什么不是F0/11? 开销小为根端口,其他的端口就会阻塞。

配置Spanning-tree 根桥和根路径开销

第一步 :配置SW1接口 conf t int f0/23 sw me tr int f0/24 sw me tr

第二步:配置SW2接口 conf t int f0/23 sw me tr int f0/24 sw me tr

第三步:查看那SW1运行spanning-tree的运行情况 SW1#show spanning-tree

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol Bridge Identifier has priority 32768, address 0030.1956.8400 Configured hello time 2, max age 20, forward delay 15 Current root has priority 32768, address 0001.9634.eb80 Root port is 38, cost of root path is 19

Topology change flag not set, detected flag not set, changes 9 Times: hold 1, topology change 35, notification 2 hello 2, max age 20, forward delay 15 Timers: hello 0, topology change 0, notification 0 第四步 查看SW2的生成树(Spanning-treee)运行情况

观察有无此数据

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol Bridge Identifier has priority 32768, address 0001.9634.eb80

We are the root of the spanning tree

第五步是 配置SW1的网桥优先级

SW1(config)#spanning-tree priority 1

01:23:55: ST: we are the spanning tree root 你是否将它设置根生成树 01:23:55: ST: FastEthernet0/24 become designated port SW1(config)#int f0/23 SW1(config-if)#sh

经过SW1(config)#spanning-tree priority 1 设置了优先级

再来shouw spanning-tree 得多的结果如下,(只复制了重要一行内容)

Spanning tree 1 is executing the IEEE compatible Spanning Tree protocol Bridge Identifier has priority 1, address 0030.1956.8400

Configured hello time 2, max age 20, forward delay 15 We are the root of the spanning tree

Topology change flag not set, detected flag not set, changes 13 Times: hold 1, topology change 35, notification 2 hello 2, max age 20, forward delay 15 Timers: hello 1, topology change 0, notification 0

已经成功修改成了根网桥

SW1#show spanning-tree interface f0/23

Interface Fa0/23 (port 37) in Spanning tree 1 is FORWARDING Port path cost 19, Port priority 128

SW1#show spanning-tree interface f0/24

Interface Fa0/24 (port 38) in Spanning tree 1 is FORWARDING Port path cost 19, Port priority 128

Designated root has priority 1, address 0030.1956.8400 Designated bridge has priority 1, address 0030.1956.8400 Designated port is 38, path cost 0

Timers: message age 0, forward delay 0, hold 0 BPDU: sent 483, received 2413

第七步 修改SW2的F0/23的路径开销 SW2(config)#int f0/23 SW2(config-if)#sp SW2(config-if)#spa

SW2(config-if)#spanning-tree cost 100 SW2(config-if)#

02:05:03: ST: stp_set_pathcost_for_api

02:05:03: ST: Adjust topology SW2(config-if)#

02:05:08: %LINK-4-ERROR: FastEthernet0/23 is experiencing errors SW2(config-if)#no sh SW2(config-if)#sh SW2(config-if)#

02:05:18: ST: sent Topology Change Notice on FastEthernet0/24 vlan 1 02:05:18: ST: FastEthernet0/23 vlan 1 -> blocking 02:05:18: ST: FastEthernet0/23 vlan 2 -> blocking 02:05:18: ST: FastEthernet0/23 vlan 3 -> blocking 02:05:18: ST: FastEthernet0/23 vlan 4 -> blocking 02:05:18: ST: FastEthernet0/23 vlan 5 -> blocking

02:05:18: %LINK-5-CHANGED: Interface FastEthernet0/23, changed state to administratively down SW2(config-if)#

02:05:18: ST: Topology Change rcvd on FastEthernet0/24 vlan 2 02:05:18: ST: Topology Change rcvd on FastEthernet0/24 vlan 3 02:05:18: ST: Topology Change rcvd on FastEthernet0/24 vlan 4 02:05:18: ST: Topology Change rcvd on FastEthernet0/24 vlan 5 SW2(config-if)#

02:05:19: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down VLAN实现的配置命令 2008-02-29 14:42

一.中心交换的VLAN配置 (1)激活vlan路由 Switch1#config t

Switch1(config)#ip routing (2)创建三个VLAN Switch1#

Switch1#vlan database Switch1(vlan)#vlan 2 Switch1(vlan)#vlan 3 Switch1(vlan)#vlan 10 Switch1(vlan)#exit

(3)给VLAN分配IP Switch1#config t

Switch1(config)#config vlan2

Switch1(config-if)#ip address 192.168.2.1 255.255.255.0 Switch1(config-if)#no shutdown Switch1#config t

Switch1(config)#config vlan3

Switch1(config-if)#ip address 192.168.3.1 255.255.255.0 Switch1(config-if)#no shutdown Switch1#config t

Switch1(config)#config vlan10

Switch1(config-if)#ip address 192.168.10.1 255.255.255.0 Switch1(config-if)#no shutdown

(4)配VTP Switch1#

Switch1#config t

Switch1(config)#vtp domain china_mobile Switch1(config)#vtp mode server Switch1(config)#end (5)配Trunk Switch1#

Switch1#config t

Switch1(config)#interface gigabitethernet0/1

Switch1(config-if)#switchport trunk encapsulation isl Switch1(config-if)#switchport mode trunk Switch1(config-if)#end

(6)给中心交换机通往路由器的接口配IP Switch1#

Switch1#config t

Switch1(config)#interface fastethernet0/1 Switch1(config-if)#no switchport

Switch1(config-if)#ip address 200.1.1.1 255.255.255.0 Switch1(config-if)#no shutdown

(7)给中心交换机配置缺省路由 Switch1#

Switch1#config t

Switch(config)#ip route 0.0.0.0 0.0.0.0 200.1.1.2 (8)把VLAN号分配给IP接口 Switch1#

Switch1#config t

Switch1(config)#interface fastethernet0/2 Switch1(config-if)#switchport mode access Switch1(config-if)#switchport access vlan2 Switch1(config-if)#spanning-tree portfast … … Switch1#

Switch1#config t

Switch1(config)#interface fastethernet0/13 Switch1(config-if)#switchport mode access

Switch1(config-if)#switchport access vlan3 Switch1(config-if)#spanning-tree portfast (其它同)

(9)配访问控制列表ACL禁VLAN3子网的客户机访问服务器 Switch1#

Switch1#config t

Switch1(config)#access-list 1 deny 192.168.3.0 0.0.0.255 Switch1(config)#access-list 1 permit any

Switch1(config)#interface fastethernet0/13 (此接口接服务器) Switch1(config-if)#ip access-group 1 out

(10)检查上述配置 Switch1#show vlan Switch1#show ip route

Switch1#show interface gigabitethernet0/1 switchport Switch1#show run

Switch1#show vtp status

(11)存配置

Switch1#copy running-config startup-config 二.在接入层交换机Swith2上VLAN的配置

(1)配TRUNK Switch2#

Swtich2#config t

Switch2(config)#interface gigabitethernet0/1

Switch2(config-if)#switchport trunk encapsulation isl Switch2(config-if)#switchport mode trunk

Switch2(config-if)#end

Switch2#

Swtich2#config t

Switch2(config)#interface gigabitethernet0/2

Switch2(config-if)#switchport trunk encapsulation isl Switch2(config-if)#switchport mode trunk Switch2(config-if)#end

(2)配VTP Switch2#

Switch2#config t

Switch2(config)#vtp mode client

Switch2(config)#vtp domain china_mobile Switch2(config)#end

(3)给接口分配VLAN号 Switch2#

Switch2#config t

Switch2(config)#interface fastethernet0/1 Switch2(config-if)#switchport mode access Switch2(config-if)#switchport access vlan2 Switch2(config-if)#spanning-tree portfast … …

(其它端口配置同) (4)存配置

Switch2#copy running-config startup-config (其它交换机同)

因篇幅问题不能全部显示,请点此查看更多更全内容