首页 |缤纷校园 |心理援助 |英语世界 |公务员 |考研天地 |资格考试 |电脑认证 |免费论文 |实用文档 |求职就业 |论坛 |网络课堂 |留言版
 电脑认证首页     考试专题 考试提醒 计算机等级考试 计算机认证水平考试 IT认证 论坛
 最近更新
· [学习辅导]为交换机配置VLAN网络
· [备考指南]用好Windows操作系统的桌面…
· [备考指南]远程桌面故障疑难解惑实例
· [备考指南]在Vista中导入OutlookExpr…
· [备考指南]WindowsServer2008让虚拟化…
· [备考指南]企业无线网络上如何升级到…
· [备考指南]思科安全软件曝漏洞导致Wi…
· [备考指南]新手初用宽带路由器要注意…
· [备考指南]用showparameter直接显示O…
· [备考指南]用showparameter直接显示O…
 精品课程
· [精品课程推荐]08年投资项目管理师考…
· [精品课程推荐]08年职称日语考试辅导…
· [精品课程推荐]08年环境影响评价师辅…
· [精品课程推荐]08年质量资格考试辅导…
· [精品课程推荐]08年会计职称辅导报精…
· [精品课程推荐]08年建筑师考试辅导京…
· [精品课程推荐]08职称英语考试辅导王…
· [精品课程推荐]08年咨询工程师考试名…
· [精品课程推荐]08年监理工程师考试辅…
· [精品课程推荐]经济师考试网上辅导报…
 考试动态
· [二级考试动态]重庆:计算机等级考试考点…
· [二级考试动态]2008年计算机等级考试时间…
· [二级考试动态]上海:2008年上半年全国计…
· [二级考试动态]北京:2007年9月计算机等级…
· [二级考试动态]2007年12月全国计算机职业…
· [二级考试动态]青岛:2008年上半年计算机…
· [二级考试动态]宁夏:2007年9月计算机等级…
· [二级考试动态]北京地区计算机等级考试10…
· [二级考试动态]北京:07年下半年计算机等…
· [二级考试动态]2008年4月全国计算机等级考…
 试题下载
· [试题下载]2007年计算机等级考试二级…
· [试题下载]2007年9月计算机等级考试二…
· [试题下载]2007年9月二级VB试题答案
· [试题下载]2007年9月计算机二级VB模拟…
· [试题下载]2007年9月计算机二级VB模拟…
· [试题下载]2007年9月计算机二级VF模拟…
· [试题下载]2007年9月计算机二级VB模拟…
· [试题下载]2007年9月计算机等级考试二…
· [试题下载]VC++中利用/GS开关防止缓冲…
· [试题下载]2007年4月计算机等级考试二…
 学习辅导
· [学习辅导]系统无法自动保存设置
· [学习辅导]用C#把文件转换为XML
· [学习辅导]C#中用API实现MP3等音频文…
· [学习辅导]C#实现的18位身份证格式验…
· [学习辅导]对C#泛型中的new()约束的一…
· [学习辅导]C语言中数组和指针的互操作
· [学习辅导]C/C++数组名与指针区别深入…
· [学习辅导]如何才能修改系统表,比如…
· [学习辅导]怎样使用一个查询获得数据…
· [学习辅导]为什么打开表有时也会提示…
 

为交换机配置VLAN网络

文章录入:editor002    责任编辑:editor002   2008-5-9 11:59:17  来源:本站原创  点击数:
 
   作为网络管理员,我们在工作中会遇到各种各样的网络设备,交换机是其中最常见的一种。对于交换机来说,最实用的操作就是划分VLAN,利用VLAN技术,可以在一根传输介质上同时传送多个网络的同时又保证各个网络的相互隔离,从而使很多看似不可能完成的任务最后也能够完成了。熟练运用VLAN技术,是一个网管员必备素质。

  本篇文章我们要介绍如何通过图形化界面对交换机进行VLAN配置,拥有图形化的配置界面,是很多厂商在介绍产品时会着重强调的一个优点。

  但在实际工作中我们发现,如果一名网络工程师没有通过CLI(命令行界面)模式成功的配置过VLAN的话,即使使用图形化界面,也无法顺利的完成VLAN的配置,在网络工程师的生涯中,没有什么捷径可走。下面我们会分两部分,从使用命令行的配置VLAN入手,将相关的概念逐一介绍清楚。

  通过命令行方式在交换机上配置VLAN

  为了让这个例子更有权威性,我们摘取了CISCO网站上的一篇介绍VLAN配置文章(小提示:CISCO公司的网站技术资料极为丰富,可以系统而全面的学习到交换机配置的各个方面的知识,而且是免费的,大家在遇到交换机配置方面的问题的时侯,不妨多访问一下CISCO的网站,一定会有收获的),本例中所用到的例子网址如下:http://www.cisco.com/en/US/tech/tk389/tk815/technologies_configuration_example09186a008015f17a.shtml
  这是一个典型的上网用的配置。

    (一)CISCO3550交换机的配置

  CISCO3550交换机上联一台路由器(拥有互联网出口),下面连接一台CISCO29450交换机,在CISCO3550上还对各个VLAN作了定义,CISCO3550交换机的配置如下所示:

  Catalyst 3550 (Catalyst 3550-48 Switch)

  Cat3550#show running-config
  Building configuration...
  Current configuration : 3092 bytes
  !
  version 12.1
  no service single-slot-reload-enable
  no service pad
  service timestamps debug uptime
  service timestamps log uptime
  no service password-encryption
  !
  hostname Cat3550

  ip subnet-zero

  !--- Enable IP routing for interVLAN routing.(这一步非常重要,通过ip routing命令了实现了各个VLAN间的路由,这样各个VLAN间是可以互访的,但是由于每个VLAN都是一个独立的广播域,所以即使在一个VLAN中发生诸如ARP地址欺骗之类的病毒,也不会影响其它的VLAN)

  ip routing
  !
  spanning-tree extend system-id
  !
  interface FastEthernet0/1
  no ip address
  !
  !--- Output suppressed.
  !
  interface FastEthernet0/5
  description to SERVER_1

  !--- Configure the server port to be in the server VLAN, VLAN 3.

  switchport access vlan 3

  !--- Configure the port to be an access port to prevent trunk negotiation delays.

  switchport mode access
  no ip address

  !--- Configure PortFast for initial Spanning Tree Protocol (STP) delay. Refer to
  !--- Using PortFast and Other Commands to Fix Workstation Startup Connectivity Delays
  !--- for more information. (这里又介绍了一个非常重要的概念,即如果确认交换机下某个端口连接的是一台重要的服务器,那就可以将该端口设置为“spanning-tree portfast”状态,从而实现服务器与交换机端口的快速连接)

  spanning-tree portfast
  !

  !--- Output suppressed.
  !
  interface FastEthernet0/48
  description To Internet_Router

  !--- The port that connects to the router converts into a routed (L3) port.(fa0/48是上连到一台路由器)

  no switchport

  !--- Configure the IP address on this port. (为了实现与路由器的通讯,在端口上设置了IP地址)

  ip address 200.1.1.1 255.255.255.252
  !
  interface GigabitEthernet0/1
  description To 2950

  !--- Configure IEEE 802.1 (dot1q) trunking, with negotiation, on the L2 switch.
  !--- If there is not support for Dynamic Trunking Protocol (DTP) on the far switch,
  !--- issue the switchport mode trunk command to force the switch port to trunk mode.
  !--- Note: The default trunking mode is dynamic auto. If you establish a trunk link
  !--- with the default trunking mode, the trunk does not appear
  !--- in the configuration, even though a trunk has been established on
  !--- the interface. Use the show interfaces trunk command to verify the
  !--- establishment of the trunk.
  (G0/1下连到一台CISCO2950的交换机,其实CISCO3550交换机是支持自动设置为TRUNK模式的,即如果下连的网络端口被设置为TRUNK模式的话,3550上的对应端口就会自动的变成TRUNK模式,但是本例中为了详细说明TRUNK的设置,还是把端口封装802.1Q的命令写了出来)
  switchport trunk encapsulation dot1q
  no ip address
  !
  interface Vlan1
  no ip address
  shutdown
  !
  interface Vlan2
  description USER_VLAN

  !--- This IP address is the default gateway for users. (VLAN2是接入用户的VLAN,VLAN上设置的IP地址就作为下接用户的网关,这也是一个非常重要的概念)

  ip address 10.1.2.1 255.255.255.0
  !
  interface Vlan3
  description SERVER_VLAN

  !--- This IP address is the default gateway for servers. (VLAN3是连接服务器的)

  ip address 10.1.3.1 255.255.255.0
  !
  interface Vlan10
  description MANAGEMENT_VLAN

  !--- This IP address is the default gateway for other L2 switches. (VLAN10是管理VLAN,下面所连接交换机会以VLAN10的IP作为自己的网关,为管理专门划分一个VLAN,将管理VLAN与业务VLAN区别开了这也是非常重要的一个概念)。

  ip address 10.1.10.1 255.255.255.0
  !
  ip classless

  !--- This route statement allows the 3550 to send Internet traffic to
  !--- the default router which, in this case, is the 7200VXR (Fe 0/0 interface). (因为是上连到一台路由器,所以在这台交换机上设置了默认路由)

  ip route 0.0.0.0 0.0.0.0 200.1.1.2
  ip http server
  !
  line con 0
  line vty 5 15
  !
  end

  (二)CISCO2950交换机的配置

  Catalyst 2950 (Catalyst 2950G-48 Switch)

  Cat2950#show running-config
  Building configuration...

  Current configuration : 2883 bytes
  !
  version 12.1
  no service single-slot-reload-enable
  no service pad
  service timestamps debug uptime
  service timestamps log uptime
  no service password-encryption
  !
  hostname Cat2950
  !
  ip subnet-zero
  !
  spanning-tree extend system-id
  !
  interface FastEthernet0/1
  no ip address
  !

  !--- Output suppressed.

  interface FastEthernet0/16
  no ip address
  !
  interface FastEthernet0/17
  description SERVER_2
  switchport access vlan 3
  switchport mode access
  no ip address
  spanning-tree portfast
  ! fa0/17是连接服务器_2的端口,属于VLAN3,而且设置为“spanning-tree portfast”模式

  !--- Output suppressed.
  !
  interface FastEthernet0/33
  description HOST_1

  !--- Configure HOST_1 to be the user VLAN, VLAN 2. fa0/33端口接入了用户主机_1所以设置为VLAN2

  switchport access vlan 2
  switchport mode access
  no ip address
  spanning-tree portfast
  !
  !--- Output suppressed.

  interface GigabitEthernet0/1
  switchport trunk encapsulation dot1q
  no ip address
  ! 因为端口g0/1是上连到CISCO3550交换机的,所以设置为TRUNK模式
  interface GigabitEthernet0/2
  no ip address
  !
  interface Vlan1
  no ip address
  no ip route-cache
  shutdown
  !
  interface Vlan10
  description MANAGEMENT

  !--- This IP address manages this switch.  (VLAN10是管理VLAN)

  ip address 10.1.10.2 255.255.255.0
  no ip route-cache
  !

  !--- Configure the default gateway so that the switch is reachable from other
  !--- VLANs/subnets. The gateway points to the VLAN 10 interface on the 3550.

  ip default-gateway 10.1.10.1
  ip http server
  !
  line con 0
  line vty 5 15
  !
  End

    (三)总结VLAN配置的三大步骤

  看过了文档,我们再来总结一下VLAN配置的三个步骤:
  1、新建一个VLAN
  2、将端口划归相应的VLAN
3、将级联口设置为TRUNK模式查找更多相关信息请登陆:考资网(www.kaozi.com)

  • 上一个文章:

  • 下一个文章: 没有了
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    关于本站 - 广告服务 - 站内导航 - 网站声明 - 友情链接 - 联系我们
    Copyright©2003-2008 www.dastu.com, All Rights Reserved.

    心语心愿科技(北京)有限责任公司 版权所有

    鄂ICP备05000022号