您现在的位置: 中国IT实验室 >> Cisco >> 解决方案 >> 组网方案 >> 正文

交换机路由器配置:Cisco组网实例

  本文讲述了Cisco 2950交换机基本配置和路由Cisco 2611上单臂路由的配置以及IP地址划分这几个知识点,这两个设备是组网时经常用到的,所以本文专门为大家总结一下。

  一、Cisco 2950交换机基本配置

  switch>

  switch>enable

  switch#

  switch#vlan database(进入vlan维护模式)

  switch(vlan)#vlan 2 name vlan2(给vlan 2命名为vlan2)

  switch(vlan)#vlan 4 name vlan4(给vlan 4命名为vlan4)

  switch(vlan)#exit(这里要注意一下,要打入exit退出才有效,不能用ctrl+z或end直接退出,因为这么不能使配置生效!)

  switch#show vlan(查看vlan的配置,默认有vlan1)

  switch#configure terminal(进入全局配置模式)

  switch(config)#interface f0/1(进入fastethernet0/1接口配置模式)

  switch(config-if)#switchport mode access(这步可以省略)

  switch(config-if)#switchport access vlan 2(把该接口划分到vlan2,记得vlan2之间有空格)

  switch(config-if)#no shutdown(激活端口)

  switch(config-if)#exit

  switch(config)#interface f0/2

  switch(config-if)#switchport mode access

  switch(config-if)#switchport access vlan 4

  switch(config-if)#no shutdown

  switch(config-if)#exit

  switch(config)#interface f0/3

  switch(config-if)#switchport mode trunk(设置此口为中继模式)

  switch(config-if)#no shutdown

  witch(config-if)#exit(这里可以直接用ctrl+z或end直接退出到特权模式)

  二。在路由器Cisco 2611上的配置(单臂路由)

  router#configure terminal

  router(config)#interface f0/0.1(进入子接口模式)

  router(config-subif)#encapsulation dot1q 2(设置封装类型为dot1q,它是思科特有的。此外还有isl封装,要看该设备支不支持。数字2是vlan号)

  router(config-subif)#ip address 192.168.1.1 255.255.255.0

  router(config-subif)#exit

  router(config)#interface f0/0.2

  router(config-subif)#encapsulation dot1q 4

  router(config-subif)#ip address 192.168.3.1 255.255.255.0

  router(config-subif)#exit

  router(config)#interface f0/0

  router(config-if)#no shutdown

  router(config-if)#^z

  router#show running-config

  router#copy running-config startup-config

  三。给PC1,PC2设置好IP地址,然后用ping命名令测试

  1、配置IP地址

  交换机要能够被网管,必须给它标识一个管理IP地址,默认情况下CISCO交换机的VLAN 1为管理VLAN,为该VLAN配上IP 地址,交换机就可以被网管了。命令如下:

  a、进入全局模式: Switch#configure terminal

  b、进入VLAN 1接口模式:Switch(config)#interface vlan 1

  c、配置管理IP地址:Switch(config-if) # ip address [A.B.C.D] [mask]

  如果当前VLAN 不是管理VLAN ,只需要将上面第b处命令的vlan的号码换成管理VLAN的号码即可。

  2、打开SNMP协议

  a、进入全局模式: Switch#configure terminal

  b、配置只读的Community,产品默认的只读Community名为public

  Switch(config)#snmp-server community public ro

  c、配置可写的Community,产品默认的可写Community名为private

  Switch(config)#snmp-server community private rw

  3、更改SNMP的Community密码

  a、将设备分组,并使能支持的各种SNMP版本

  Switch(config)#snmp-server group qycx123 v1

  Switch(config)#snmp-server group qycx 123 v2c

  Switch(config)#snmp-server group qycx123 v3 noauth

  b、分别配置只读和可写community 如:

  Switch(config)#snmp-server community qycx123 ro

  Switch(config)#snmp-server community qycx123 rw

  4、保存交换机配置

  Switch#copy run start

  交换机配置的常用命令读者如果不明白可以阅读:思科交换机常用命令总结

【责编:eric】
相关资源
文章评论
 友情推荐精华
 专题推荐

 ·TCP/IP 协议专题
 ·详谈 IPV6 & IPV4
 ·看思科认证发展未来
 ·职业规划从高考专业选择开始
 ·从菜鸟到专家 cisco认证系列问答
 ·循序渐进认识WEB服务器
 ·如何走出高考的失意园
 ·邮件系统--从原理到应用
 ·无名英雄--组播的世界
 ·如何做一个合格的Oracle DBA?
 今日更新
 认证培训
 频道精选
 思科频道导航