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

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

一、Cisco 2950交换机基本配置

  1. switch> 
  2.  
  3. switch>enable  
  4.  
  5. switch#  
  6.  
  7. switch#vlan database(进入vlan维护模式)  
  8.  
  9. switch(vlan)#vlan 2 name vlan2(给vlan 2命名为vlan2)  
  10.  
  11. switch(vlan)#vlan 4 name vlan4(给vlan 4命名为vlan4)  
  12.  
  13. switch(vlan)#exit(这里要注意一下,要打入exit退出才有效,不能用ctrl+z或end直接退出,因为这么不能使配置生效!)  
  14.  
  15. switch#show vlan(查看vlan的配置,默认有vlan1)  
  16.  
  17. switch#configure terminal(进入全局配置模式)  
  18.  
  19. switch(config)#interface f0/1(进入fastethernet0/1接口配置模式)  
  20.  
  21. switch(config-if)#switchport mode access(这步可以省略)  
  22.  
  23. switch(config-if)#switchport access vlan 2(把该接口划分到vlan2,记得vlan2之间有空格)  
  24.  
  25. switch(config-if)#no shutdown(激活端口)  
  26.  
  27. switch(config-if)#exit  
  28.  
  29. switch(config)#interface f0/2  
  30.  
  31. switch(config-if)#switchport mode access  
  32.  
  33. switch(config-if)#switchport access vlan 4  
  34.  
  35. switch(config-if)#no shutdown  
  36.  
  37. switch(config-if)#exit  
  38.  
  39. switch(config)#interface f0/3  
  40.  
  41. switch(config-if)#switchport mode trunk(设置此口为中继模式)  
  42.  
  43. switch(config-if)#no shutdown  
  44.  
  45. witch(config-if)#exit(这里可以直接用ctrl+z或end直接退出到特权模式) 

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

  1. router#configure terminal  
  2.  
  3. router(config)#interface f0/0.1(进入子接口模式)  
  4.  
  5. router(config-subif)#encapsulation dot1q 2(设置封装类型为dot1q,它是思科特有的。此外还有isl封装,要看该设备支不支持。数字2是vlan号)  
  6.  
  7. router(config-subif)#ip address 192.168.1.1 255.255.255.0  
  8.  
  9. router(config-subif)#exit  
  10.  
  11. router(config)#interface f0/0.2  
  12.  
  13. router(config-subif)#encapsulation dot1q 4  
  14.  
  15. router(config-subif)#ip address 192.168.3.1 255.255.255.0  
  16.  
  17. router(config-subif)#exit  
  18.  
  19. router(config)#interface f0/0  
  20.  
  21. router(config-if)#no shutdown  
  22.  
  23. router(config-if)#^z  
  24.  
  25. router#show running-config  
  26.  
  27. 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版本

  1. Switch(config)#snmp-server group qycx123 v1  
  2.  
  3. Switch(config)#snmp-server group qycx 123 v2c  
  4.  
  5. Switch(config)#snmp-server group qycx123 v3 noauth 

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

  1. Switch(config)#snmp-server community qycx123 ro  
  2.  
  3. Switch(config)#snmp-server community qycx123 rw 

4、保存交换机配置

Switch#copy run start

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

责任编辑:佚名 来源: 博客转载
相关推荐

2011-07-21 13:46:09

Cisco ACE

2011-03-31 09:09:00

2009-11-26 09:56:39

Cisco路由器配置命交换机配置命令

2013-05-20 14:10:13

Cisco路由器交换机

2010-01-27 17:31:28

交换机和路由器

2009-11-27 09:44:21

Cisco路由器交换机

2010-01-05 14:45:57

交换机与路由器

2010-01-11 15:31:54

Cisco交换机

2012-11-26 13:46:17

路由器交换机

2009-12-18 13:41:07

2009-11-27 10:22:13

交换机和路由器

2010-08-04 13:27:07

路由器配置

2012-12-10 10:01:07

Cisco路由器交换机

2010-01-25 11:31:16

三层交换机路由器

2011-08-16 11:37:22

帧中继

2009-12-11 13:31:25

CISCO路由交换机策略路由

2017-06-01 14:33:04

交换机路由器网络设备

2011-03-24 14:05:14

Nagios监控

2009-12-11 15:41:16

路由交换机配置

2010-01-12 09:03:39

华为路由器交换机
点赞
收藏

51CTO技术栈公众号