企业网络组建项目实训--实现多例生成树技术

       信科上海分公司各部门之间都采用了VLAN技术,为了实现公司内部网络的不间断,来保证公司网络的稳定运行,网络管理员决定采用基于VLAN的多实例生成树协议来完成这一任务。网络拓扑图如图所示。

具体操作如下:

步骤  规划交换机VLAN,分配交换机端口,配置计算机的IP地址,如表所示。 

交换机端口

计算机名称

计算机的IP地址

掩码

VLAN10

F0/1

PC0

192.168.1.10

255.255.255.0

F0/1

PC2

192.168.1.11

255.255.255.0

F0/1

PC4

192.168.1.12 

255.255.255.0

VLAN20

F0/2

PC1

192.168.2.10

255.255.255.0

F0/2

PC3

192.168.2.11

255.255.255.0

F0/2

pc5

192.168.2.12 

255.255.255.0

Trunk

G0/1-2

  

F0/10-11;F0/20-21;F0/23-24

 步骤2     层交换机switch0划分VLAN,分配端口及设置accessTrunk端口,代码如下:

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#host switch-11     //修改交换机名字
switch-11(config)#end
switch-11#
%SYS-5-CONFIG_I: Configured from console by console

switch-11#vlan database       //开启vlan数据库,创建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-11(vlan)#vlan 10
VLAN 10 added:
    Name: VLAN0010
switch-11(vlan)#vlan 20
VLAN 20 added:
    Name: VLAN0020
switch-11(vlan)#ex
APPLY completed.
Exiting....
switch-11#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
switch-11(config)#int f0/1
switch-11(config-if)#switch mode access
switch-11(config-if)#switch access vlan 10
switch-11(config-if)#ex
switch-11(config)#int f0/2
switch-11(config-if)#switch mode access
switch-11(config-if)#switch access vlan 20
switch-11(config-if)#ex
switch-11(config)#int f0/10
switch-11(config-if)#switch mode trunk

switch-11(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/10, changed state to down

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

switch-11(config-if)#switch trunk allowed vlan all
switch-11(config-if)#int f0/11
switch-11(config-if)#switch mode trunk

switch-11(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/11, changed state to down

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

switch-11(config-if)#switch trunk allowed vlan all
switch-11(config-if)#

代码输入和运行截图如下:

步骤3     在二层交换机switch1划分VLAN,分配端口及设置accessTrunk端口,代码如下:

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#host switch12
switch12(config)#ex
switch12#
%SYS-5-CONFIG_I: Configured from console by console

switch12#vlan database
% 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.

switch12(vlan)#vlan 10
VLAN 10 added:
    Name: VLAN0010
switch12(vlan)#vlan 20
VLAN 20 added:
    Name: VLAN0020
switch12(vlan)#ex
APPLY completed.
Exiting....
switch12#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
switch12(config)#int f0/1
switch12(config-if)#switch mode access
switch12(config-if)#switch access vlan 10
switch12(config-if)#int f0/2
switch12(config-if)#switch mode access
switch12(config-if)#switch access vlan 20
switch12(config-if)#ex
switch12(config)#int range f0/20-21
switch12(config-if-range)#switch mode trunk


switch12(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/20, changed state to down

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

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

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

switch12(config-if-range)#switch trunk allowed vlan all
switch12(config-if-range)#

 

步骤4   在二层交换机switch2划分VLAN,分配端口及设置accessTrunk端口,代码如下:

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#host switch13
switch13(config)#ex
switch13#
%SYS-5-CONFIG_I: Configured from console by console

switch13#vlan database
% 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.

switch13(vlan)#vlan 10
VLAN 10 added:
    Name: VLAN0010
switch13(vlan)#vlan 20
VLAN 20 added:
    Name: VLAN0020
switch13(vlan)#ex
APPLY completed.
Exiting....
switch13#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
switch13(config)#int f0/1
switch13(config-if)#switch mode access
switch13(config-if)#switch access vlan 10
switch13(config-if)#int f0/2
switch13(config-if)#switch mode access
switch13(config-if)#switch access vlan 20
switch13(config-if)#int range f0/23-24
switch13(config-if-range)#switch mode trunk


switch13(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down

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

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

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

switch13(config-if-range)#switch trunk allowed vlan all
switch13(config-if-range)#ex
switch13(config)#

 

 步骤5  交换机switch0划分VLAN,分配端口及设置Trunk端口,代码如下:

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#host Mul-switch-1
Mul-switch-1(config)#ex
Mul-switch-1#
%SYS-5-CONFIG_I: Configured from console by console

Mul-switch-1#vlan database
% 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.

Mul-switch-1(vlan)#vlan 10
VLAN 10 added:
    Name: VLAN0010
Mul-switch-1(vlan)#vlan 20
VLAN 20 added:
    Name: VLAN0020
Mul-switch-1(vlan)#ex
APPLY completed.
Exiting....
Mul-switch-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Mul-switch-1(config)#int f0/10
Mul-switch-1(config-if)#switch trunk encap dot1q
Mul-switch-1(config-if)#switch mode trunk
Mul-switch-1(config-if)#switch trunk allowed vlan all
Mul-switch-1(config-if)#int f0/20
Mul-switch-1(config-if)#switch trunk encap dot1q
Mul-switch-1(config-if)#switch mode trunk
Mul-switch-1(config-if)#switch trunk allowed vlan all
Mul-switch-1(config-if)#int f0/23
Mul-switch-1(config-if)#switch trunk encap dot1q
Mul-switch-1(config-if)#switch mode trunk
Mul-switch-1(config-if)#switch trunk allowed vlan all
Mul-switch-1(config-if)#int range g0/1-2
Mul-switch-1(config-if-range)#switch trunk encap dot1q
Mul-switch-1(config-if-range)#switch mode trunk


Mul-switch-1(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down

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

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

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

Mul-switch-1(config-if-range)#switch trunk allowed vlan all
Mul-switch-1(config-if-range)#end
Mul-switch-1#
%SYS-5-CONFIG_I: Configured from console by console

 

步骤  S0配置实例1关联VLAN10、实例2关联VLAN20 :

Mul-switch-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Mul-switch-1(config)#span vlan 10 pri 4096
Mul-switch-1(config)#span vlan 20 pri 8192
Mul-switch-1(config)#end
Mul-switch-1#
%SYS-5-CONFIG_I: Configured from console by console

步骤7    在三层交换机switch1划分VLAN,分配端口及设置Trunk端口,代码如下: 

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#host Mul-switch-2
Mul-switch-2(config)#ex
Mul-switch-2#
%SYS-5-CONFIG_I: Configured from console by console

Mul-switch-2#vlan database
% 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.

Mul-switch-2(vlan)#vlan 10
VLAN 10 added:
    Name: VLAN0010
Mul-switch-2(vlan)#vlan 20
VLAN 20 added:
    Name: VLAN0020
Mul-switch-2(vlan)#ex
APPLY completed.
Exiting....
Mul-switch-2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Mul-switch-2(config)#int f0/11
Mul-switch-2(config-if)#switch trunk encap dot1q
Mul-switch-2(config-if)#switch mode trunk
Mul-switch-2(config-if)#switch trunk allowed vlan all
Mul-switch-2(config-if)#int f0/21
Mul-switch-2(config-if)#switch trunk encap dot1q
Mul-switch-2(config-if)#switch mode trunk
Mul-switch-2(config-if)#switch trunk allowed vlan all
Mul-switch-2(config-if)#int f0/24
Mul-switch-2(config-if)#switch trunk encap dot1q
Mul-switch-2(config-if)#switch mode trunk
Mul-switch-2(config-if)#switch trunk allowed vlan all
Mul-switch-2(config-if)#int range g0/1-2
Mul-switch-2(config-if-range)#switch trunk encap dot1q
Mul-switch-2(config-if-range)#switch mode trunk
Mul-switch-2(config-if-range)#switch trunk allowed vlan all
Mul-switch-2(config-if-range)#end
Mul-switch-2#
%SYS-5-CONFIG_I: Configured from console by console

步骤8  根交换机S1中配置端口在不同实例中的优先级,确保不同实例阻塞不同端口,代码如下: 

Mul-switch-2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Mul-switch-2(config)#span vlan 20 pri 4096
Mul-switch-2(config)#span vlan 10 pri 8192
Mul-switch-2(config)#end
Mul-switch-2#
%SYS-5-CONFIG_I: Configured from console by console

步骤9  使用命令“show spanning-tree”验证交换机的生成树的配置 

Mul-switch-2#show spanning-tree

指令执行后会有关于生成树的具体信息,如下图红色框框中圈出来的内容。

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值