功能测试
首页 > Cisco 认证 > 正文

CCNA中文笔记第7章:VLAN(2)

发布-admin | 查看- | 发表时间-2010-2-23

Configuring Inter-VLAN Routing
  使VLAN间互相通信,就必须使用router或者3层switch来连接.要在router的快速以太网接口支持ISL和802.1Q,要把接口划分成许多逻辑接口(非物理),1个接口对应1个VLAN.这些接口就叫子接口(subinterfaces).还有要必须知道的是,默认你不可能在1900和2950之间做trunk连接,因为1900只支持ISL路由而2950只支持802.1Q路由,2种相互不兼容。
  给连接1900的trunk端口配置,使用encapsulation isl [vlan#]命令,如下:
  2600Router(config)#int f0/0.1
  2600Router(config-subif)#encapsulation isl [vlan#]
  给连接2950的这样配置,如下:
  2600Router(config)#int f0/0.1
  2600Router(config-subif)#encapsulation dot1q [vlan#]
  Configuring VTP
  默认下,1900和2950都被配置成VTP服务器模式,配置VTP,先配置VTP域名,还有密码,是否pruning等。
  1900下,在全局配置模式下使用vtp命令,如下:
  1900(config)#vtp ?
  client VTP client
  domain Set VTP domain name
  password Set VTP password
  pruning VTP pruning
  server VTP server
  transparent VTP transparent
  trap VTP trap
  1900(config)#vtp server
  1900(config)#vtp domain noco
  1900(config)#vtp password noko
  在特权模式下使用show vtp命令验证,如下:
  1900#sh vtp
  VTP version: 1
  Configuration revision: 0
  Maximum VLANs supported locally: 1005
  Number of existing VLANs: 5
  VTP domain name: noco
  VTP password: noko
  VTP operating mode: Server
  (略)
  2950如下:
  2950(config)#vtp mode server
  2950(config)#vtp domain noco
  验证信息,如下:
  2950#sh vtp ?
  counters VTP statistics
  status VTP domain status
  2950#sh vtp status
  (略)
Configuring Switching in Our Sample Internetwork
  配置实例:
 


  先配置2950C,如下
  2950C(config)#enable secret noko
  2950C(config)#line con 0
  2950C(config-line)#login
  2950C(config-line)#password noco
  2950C(config-line)#line vty 0 15
  2950C(config-line)#login
  2950C(config-line)#password noco
  2950C(config-line)#banner motd #
  2950C
  #
  2950C(config-line)#exit
  2950C(config)#int vlan1
  2950C(config-if)#ip address 172.16.10.2 255.255.255.0
  2950C(config-if)#no shut
  2950C(config-if)#exit
  2950C(config)#up default-gateway 172.16.10.1
  2950C(config)#^Z
  2950C#copy run start
  配置2950B,如下:
  2950B(config)#enable secret noko
  2950B(config)#line con 0
  2950B(config-line)#login
  2950B(config-line)#password noco
  2950B(config-line)#line vty 0 15
  2950B(config-line)#login
  2950B(config-line)#password noco
  2950B(config-line)#banner motd #
  2950B
  #
  2950B(config-line)#exit
  2950B(config)#int vlan1
  2950B(config-if)#ip address 172.16.10.3 255.255.255.0
  2950B(config-if)#no shut
  2950B(config-if)#exit
  2950B(config)#up default-gateway 172.16.10.1
  2950B(config)#^Z
  2950B#copy run start

  配置trunk,2950B如下:
  2950B(config)#int f0/1
  2950B(config-if)#switchport mode trunk
  2950B(config-if)#int f0/4
  2950B(config-if)#switchport mode trunk
  2950B(config-if)#int f0/5
  2950B(confgi-if)#switchport mode trunk
  配置trunk,2950C如下:
  2950C(config)#int f0/4
  2950C(confgi-if)#switchport mode trunk
  2950C(config-if)#int f0/5
  2950C(config-if)#switchport mode trunk
验证trunk信息,使用show interface trunk命令.如下:
  2950B#sh int trunk
  Port Mode Encapsulation Status Native vlan
  Fa0/1 on 802.1q trunking 1
  Fa0/4 on 802.1q trunking 1
  Fa0/5 on 802.1q trunking 1
  (略)
  之前我们已经对2950B和2950C做了基本配置和trunk端口的配置,接下来应该设置VTP和创建VLAN,并且进行验证.2950C如下:
  2950C(config)#vtp mode server
  2950C(config)#vtp domain Cisco
  2950C(config)#^Z
  2950C#vlan database
  2950C(vlan)#vlan 2 name sales
  2950C(vlan)#vlan 3 name marketing
  2950C(vlan)#apply
  2950C(vlan)#^C
  2950C#sh vlan brief
  (略)
  接下来分配端口,把Fa0/2分配给VLAN2,Fa0/3分配给VLAN3,默认所有的端口都处在VLAN1下,配置如下:
  2950C(config)#int fa0/2
  2950C(config-if)#switchport access vlan2
  2950C(config)#int fa0/3
  2950C(config-if)#switchport access vlan3
  验证信息,注意VLAN1里的Ports栏,如下:
  2950C#sh vlan brief
  VLAN Name Status Ports
  ----------------------------------------------------------------------------
  1 default active Fa0/1 Fa0/5...Fa0/10
  2 sales active Fa0/2
  3 marketing active Fa0/3
  配置2950B,把它设置成客户模式,2950B从2950C接收VLAN信息,如下:
  2950B(config)#vtp mode client
  2950B(config)#vtp domain Cisco
  2950B(config)#^Z
  验证,注意2950B已经从2950C知道了VLAN的信息,如下:
  2950B#sh vlan brief
  VLAN Name Status Ports
  ----------------------------------------------------------------------------
  1 default active Fa0/1...Fa0/12
  2 sales active
  3 marketing active
  但是仍然要给2950B分配端口,如下:
  2950B(config)#int fa0/2
  2950B(config-if)#switchport access vlan2
  2950B(config)#int fa0/3
  2950B(config-if)#switchport access vlan3
  验证信息,如下:
  VLAN Name Status Ports
  ----------------------------------------------------------------------------
  1 default active Fa0/1 Fa0/5...Fa0/12
  2 sales active Fa0/2
  3 marketing active Fa0/3

或许你还对下面的文章感兴趣

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

最新文章
最近评论
Copyright 2010 killtest.com.cn Some Rights Reserved. 浙ICP备10016241号 | DESIGN BY Seanloo.cn