2950交换机trunk-vlan配置实例

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

VLAN的划分与互通
实验准备工作:
按照下图所示,连接实验环境。

如果没有设备,可下载Boson NetSim局域网交换与路由模拟器。

拓扑图:
配置过程:
说明:本实验完全在Boson Netsim模拟器上完成,下面红色下划线文字均为配置过程输入的命令。

一、交换机2950B配置
1、配置交换机主机名、管理ip、默认网关
Switch>en
Switch#config t
Switch(config)#hostname 2950B
2950B(config)#int vlan 1
2950B(config-if)#ip address 172.16.10.3 255.255.255.0 //设置管理IP地址
2950B(config-if)#no shut
2950B(config-if)#exit
2950B(config)#ip default-gateway 172.16.10.1 //设置默认网关IP地址2、配置中继口(即trunk口)
2950B(config)#int f0/1
2950B(config-if)#switchport mode trunk
2950B(config-if)#exit
2950B(config)#int f0/4
2950B(config-if)#switchport mode trunk
2950B(config-if)#exit
2950B(config)#int f0/5
2950B(config-if)#switchport mode trunk
2950B(config-if)#exit
2950B(config)#
3、配置vtp,把2950B交换机设置成客户机模式,2950B从2950C接收vlan信息
2950B#vlan database
2950B(vlan)#vtp client
2950B(vlan)#vtp domain cisco
4、创建Vlan
2950B(vlan)#vlan 2 name sales // 将vlan 2设置名称为sales
2950B(vlan)#vlan 3 name marketing // 将vlan 2设置名称为marketing 2950B(vlan)#apply
2950B(vlan)#exit
5、将交换机端口分配到vlan中
2950B#config t
2950B(config)#int f0/2
2950B(conf-if)#switchport mode access // 设置二层交换端口2950B(config-if)#switchport access vlan 2
2950B(config-if)#exit
2950B(config)#int f0/3
2950B(conf-if)#switchport mode access // 设置二层交换端口2950B(config-if)#switchport access vlan 3
2950B(config-if)#exit
2950B(config)#exit
2950B#
6、保存配置
2950B#copy run start
二、交换机2950C配置
1、配置交换机主机名、管理ip、默认网关
Switch>en
Switch#config t
Switch(config)#hostname 2950C
2950C(config)#int vlan 1
2950C(config-if)#ip address 172.16.10.2 255.255.255.0
2950C(config-if)#no shut
2950C(config-if)#exit
2950B(config)#ip default-gateway 172.16.10.1
2、配置中继口(即trunk口)
2950C(config)#int f0/4
2950C(config-if)#switchport mode trunk
2950C(config-if)#exit
2950C(config)#int f0/5
2950C(config-if)#switchport mode trunk
2950C(config-if)#exit
2950C(config)#
3、配置vtp,把2950C交换机设置成服务器模式,2950B从2950C接收vlan信息
2950C#vlan database
2950C(vlan)#vtp server
2950C(vlan)#vtp domain cisco
4、创建Vlan
2950C(vlan)#vlan 2 name sales
2950C(vlan)#vlan 3 name marketing
2950C(vlan)#apply
2950C(vlan)#exit
5、将交换机端口分配到vlan中
2950C#config t
2950C(config)#int f0/2
2950C(conf-if)#switchport mode access // 设置二层交换端口2950C(config-if)#switchport access vlan 2
2950C(config-if)#exit
2950C(config)#int f0/3
2950C(conf-if)#switchport mode access // 设置二层交换端口2950C(config-if)#switchport access vlan 3
2950C(config-if)#exit
2950C(config)#exit
2950C#
6、保存配置
2950C#copy run start
三、vlan间路由器2600配置过程
1、配置路由器主机名、清除f0/0端口ip地址、启动f0/0端口
Router>en
Router#config t
Router(config)#hostname trunkrouter
Trunkrouter(config)#int f0/0
Trunkrouter(config-if)#no ip address
Trunkrouter(config-if)#no shut
2、将路由器的快速以太网端口fa0/0划分为三个子接口fa0/0.1、fa0/0.2和fa0/0.3,对每个子接口配置,并采用802.1q的数据封装。

创建子接口,并定义封装类型,给子接口分配ip地址,
Trunkrouter(config-if)#int f0/0.1
Trunkrouter(config-subif)#encapsulation dot1q 1
Trunkrouter(config-subif)#ip address 172.16.10.1 255.255.255.0
Trunkrouter(config-subif)#exit
Trunkrouter(config)#int f0/0.2
Trunkrouter(config-subif)#encapsulation dot1q 1
Trunkrouter(config-subif)#ip address 172.16.20.1 255.255.255.0
Trunkrouter(config-subif)#exit
Trunkrouter(config)#int f0/0.3
Trunkrouter(config-subif)#encapsulation dot1q 1
Trunkrouter(config-subif)#ip address 172.16.30.1 255.255.255.0
Trunkrouter(config-subif)#exit
Trunkrouter(config)#exit
3、保存配置
Trunkrouter#copy run start
四、PC配置
配置B20:c:#winipcfg
配置B30:
配置C20:
配置C30
五、实验验证
在个PC上ping其他主机,验证各个主机的连通性。

各设备配置结果:
2950B#show run
!
Version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname 2950B
ip name-server 0.0.0.0
!
!
!
ip subnet-zero
!
!
!
!
!
!
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport mode trunk
backup interface
no fair-queue
!
interface FastEthernet0/2
switchport access vlan 2
backup interface
no fair-queue
!
interface FastEthernet0/3
switchport access vlan 3
backup interface
no fair-queue
!
interface FastEthernet0/4
switchport mode trunk
backup interface
no fair-queue
!
interface FastEthernet0/5
switchport mode trunk
backup interface
no fair-queue
!
interface FastEthernet0/6
backup interface
no fair-queue
!
interface FastEthernet0/7
backup interface
no fair-queue
!
interface FastEthernet0/8
backup interface
no fair-queue
!
interface FastEthernet0/9
backup interface
no fair-queue
!
interface FastEthernet0/10
backup interface
no fair-queue
!
interface FastEthernet0/11
backup interface
no fair-queue
!
interface FastEthernet0/12
backup interface
no fair-queue
!
vtp Server
vtp domain bigdomain
interface Vlan 1
ip address 172.16.10.3 255.255.255.0 no ip route-cache
no shutdown
vlan 2 name sales
vlan 3 name marketing
!
ip classless
no ip http server
!
!
!
line con 0
transport input none
line aux 0
line vty 0 15
!
no scheduler allocate
end
------------------------------------------------------------------------------- 2950C#show run
!
Version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname 2950C
ip name-server 0.0.0.0
!
!
!
ip subnet-zero
!
!
!
!
!
!
spanning-tree extend system-id
!
interface FastEthernet0/1
backup interface
no fair-queue
interface FastEthernet0/2 switchport access vlan 2 backup interface
no fair-queue
!
interface FastEthernet0/3 switchport access vlan 3 backup interface
no fair-queue
!
interface FastEthernet0/4 switchport mode trunk
backup interface
no fair-queue
!
interface FastEthernet0/5 switchport mode trunk
backup interface
no fair-queue
!
interface FastEthernet0/6 backup interface
no fair-queue
!
interface FastEthernet0/7 backup interface
no fair-queue
!
interface FastEthernet0/8 backup interface
no fair-queue
!
interface FastEthernet0/9 backup interface
no fair-queue
!
interface FastEthernet0/10 backup interface
no fair-queue
!
interface FastEthernet0/11 backup interface
no fair-queue
!
interface FastEthernet0/12
backup interface
no fair-queue
!
vtp Server
vtp domain bigdomain
interface Vlan 1
ip address 172.16.10.2 255.255.255.0 no ip route-cache
no shutdown
vlan 2 name sales
vlan 3 name marketing
!
ip classless
no ip http server
!
!
!
line con 0
transport input none
line aux 0
line vty 0 15
!
no scheduler allocate
end
路由器运行状态显示:
trunkrouter#show run
!
Version 12.1
service timestamps debug uptime service timestamps log uptime
no service password-encryption
!
hostname trunkrouter
!
!
!
ip subnet-zero
!
!
!
!
!
!
!
interface FastEthernet0/0
no ip address
no ip directed-broadcast
backup interface
no fair-queue
!
interface FastEthernet0/0.1
encapsulation dot1q 1
ip address 172.16.10.1 255.255.255.0 !
interface FastEthernet0/0.2
encapsulation dot1q 2
ip address 172.16.20.1 255.255.255.0 !
interface FastEthernet0/0.3
encapsulation dot1q 3
ip address 172.16.30.1 255.255.255.0 !
!
ip classless
no ip http server
!
!
!
line con 0
transport input none
line aux 0
line vty 0 4
!
no scheduler allocate
end。

相关文档
最新文档