2010年9月15日星期三

配置交换机上的VLAN

西安交通大学实验报告

课程:网络技术实验
完成时间:2010年5月21日
实验名称:配置交换机上的VLAN

实验内容

    使用Boson NetSim软件模拟出两台交换机的环境,并配置VLAN。

    使用Boson NetSim Designer软件设计一个含有两个交换机、一个PC机和一个路由器的网络环境,如图所示:


    网络规划如下:
    网络为192.168.0.0/24。
    Router1:192.168.0.1。
    PC1:192.168.0.2。
在两台1900系列交换机上配置VLAN

    将Router1连接到交换机Switch1上的端口以及PC1连接到交换机Switch2上的端口设置到VLAN2(#后为注释,下同):
#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
(config)#vlan 2 name vlan2
(config)#interface e0/1
(config-if)#vlan-membership static 2
(config-if)#exit
(config)#exit
#show vlan

VLAN Name             Status     Ports
--------------------------------------
1    default          Enabled    2-12, AUI, A, B
2    vlan2            Enabled    1
1002 fddi-default     Suspended
1003 token-ring-defau Suspended
1004 fddinet-default  Suspended
1005 trnet-default    Suspended
--------------------------------------

VLAN Type           SAID   MTU    Parent RingNo BridgeNo Stp  Trans1 Trans2
--------------------------------------------------------------
1    Ethernet       100001 1500   0      0      0        Unkn 1002   1003
2    Ethernet       100002 1500   0      1      1        Unkn 0      0
1002 FDDI           101002 1500   0      0      0        Unkn 1      1003
1003 Token-Ring     101003 1500   1005   1      0        Unkn 1      1002
1004 FDDI-Net       101004 1500   0      0      1        IEEE 0      0
1005 Token-Ring-Net 101005 1500   0      0      1        IEEE 0      0
---------------------------------------------------------------
    此时PC1无法ping通Router1,因为两台交换机没有联合子网信息。然后在两台交换机直接相连的端口上设置Trunk:
(config)#interface fe0/26
(config-if)#trunk on
(config-if)#^Z
%SYS-5-CONFIG_I: Configured from console by console

#show trunk a
DISL state: on, Trunking: on, Encapsulation type: ISL
    然后PC1与Router1联通。

在两台2950系列交换机上配置VLAN
    将Router1连接到交换机Switch1上的端口以及PC1连接到交换机Switch2上的端口设置到VLAN2:

Switch#vlan database
Switch(vlan)#vlan 2 name vlan2
VLAN 2 added:
    Name:vlan2
Switch(vlan)#exit
APPLY completed.
Exiting....
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#interface fe0/1
Switch(config-if)#switch mode access
Switch(config-if)#switchport access vlan 2
Switch(config-if)#^Z
%SYS-5-CONFIG_I: Configured from console by console

Switch#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -----
1    default                          active    Fa0/2, Fa0/3, Fa0/4, Fa0/5
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12
2    vlan2                            active    Gi0/-11
1002 fddi-default                     active
1003 token-ring-default               active
1004 fddinet-default                  active
1005 trnet-default                    active

VLAN Type  SAID       MTU   Parent RingNo BrdgNo Stp  Brdg Trans1 T2
---- ----- ---------- ----- ------ ------ ------ ---- ---- ------
1    enet  100001     1500  -      -      -      -    -    0      0
2    enet  100002     1500  -      -      -      -    -    0      0
1002 fddi  101002     1500  -      -      -      -    -    0      0
1003 tr    101003     1500  -      -      -      -    -    0      0
1004 fdnet 101004     1500  -      -      -      ieee -    0      0
1005 trnet 101005     1500  -      -      -      ibm  -    0      0
    此时PC1无法ping通Router1,因为两台交换机没有联合子网信息。然后在两台交换机直接相连的端口上设置Trunk:
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#interface fe0/2
Switch(config-if)#switchport mode trunk
Switch(config-if)#^Z
%SYS-5-CONFIG_I: Configured from console by console

Switch#show interface fe0/2 switchport
Name: Fa0/2
Switchport:     Enabled
Administrative mode: trunk
Operational mode: trunk
Administrative Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001

Protected: false

Voice vlan: none (Inactive)
Appliance trust: none
    然后PC1与Router1联通。

(完)

没有评论:

发表评论