资源描述
交换机的常用操作项
1、 更改主机名 switch(config)#hostname sw1
2、 设置进入特权模式的密码
switch(config)#enable password 1234
switch(config)#enable secret cisco
3、 设置console口密码
switch(config)#line console 0
switch(config-line)#password 123
switch(config-line)#login
4、 查看mac地址列表 switch#show mac-address-table
5、 查看mac地址列表刷新时间 switch#show mac-address-table aging-time
6、 更改mac地址列表刷新时间 switch(config)#mac-address-table aging-time 200
7、 查看当前配置(RAM) switch#show running-config
8、 查看交换机的配置(NVRAM) switch#show startup-config
9、 保存配置
switch#copy running-config startup-config
switch#write
10、 恢复出厂默认设置
switch#erase startup-config
switch#reload
11、 查看cdp的全局信息 switch#show cdp
12、 查看接口的cdp配置信息 switch#show cdp interface f0/2
13、 查看有关cdp包的统计信息 switch#show cdp traffic
14、 查看邻居信息 switch#show cdp neighbors
15、 查看所有入口项的详细信息
switch#show cdp neighbors detail
switch#show cdp entry *
16、 添加接口的描述信息 switch(config-if)# description connection to routerA
17、 设置交换机的网关 switch(config)#ip default-gateway 192.168.1.1
18、 关掉DNS解析 switch(config)# no ip domain-lookup
19、 实现交换机的远程管理
switch(config)#enable secret cisco
switch(config)#intface valn 1
switch(config-if)#ip address 192.168.1.100 255.255.255.0
switch(config-if)#no shutdown
switch(config)#line vty 0 4
switch(config-line)#password 123
switch(config-line)#login
c:\>telnet 192.168.1.100
20、 交换机的密码恢复
1、将交换机的电源拔下
2、按mode键将电源插上,当出现switch:时将手松开
3、switch:flash_init //加载到flash中
4、switch:dir flash: //查看flash中的文件
5、rename flash:config.text flash:config.old //更改文件名
6、boot //重新启动交换机
7、rename flash:config.old flash:config.text //将文件名改回
8、copy flash:config.text running-config
9、enable password cisco //重新设置密码
10、write //保存
21、 创建vlan方法一
switch#vlan database
switch(vlan)#vlan 10 name sc
switch(vlan)#exit
22、 创建vlan方法二
switch(config)#vlan 10
switch(config-vlan)#name sc
23、 删除vlan方法一
switch(vlan)#no vlan 10
switch(vlan)#exit
24、 删除vlan方法二 switch(config)#no vlan 10
25、 删除vlan方法三 switch#delete vlan.dat
26、 将端口加入到vlan中 switch(config-if)#switchport access vlan 10
27、 将一组连续的端口加入到vlan中
switch(config)# interface range f0/1 – 5
switch(config-if-range)#switchport access vlan 10
28、 将端口从vlan中删除
switch(config-if)#no switchport access vlan 10
switch(config-if)#switchport access vlan 1
switch(config-if-range)#no switchport access vlan 10
switch(config-if-range)#switchport access vlan 1
29、 查看所有vlan的摘要信息 switch#show vlan brief
30、 查看指定vlan的信息
switch#show vlan id 10
31、 Cisco 2600路由器的基本操作
从用户模式进入特权模式
router>enable
router#
从特权模式进入全局配置模式
router#config terminal
router(config)#
为路由器配置主机名
router(config)#hostname teacher
teacher(config)#
进入路由器的以太口配置模式
teacher(config)#interface fastethernet 0/0
teacher(config_if)#
32、 查看Cisco 2600路由器的串口状态
router#show interface serial 0/0
serial 0/0 is up ,line protocol is up
可操作状态………serial 0/0 is up ,line protocol is up
连接问题…………serial 0/0 is up ,line protocol is down
接口问题…………serial 0/0 is down ,line protocol is down
禁用状态…………serial 0/0 is administratively down ,line protocol is down
192.168.1.1
192.168.2.2
192.168.2.1
192.168.3.1
192.168.1.10
192.168.3.10
33、 静态路由的实现
router(config)#hostname A
A(config)#interface f0/0
A(config-if)#ip address 192.168.1.1 255.255.255.0
A(config-if)#no shutdown
A(config)#interface f0/1
A(config-if)#ip address 192.168.2.1 255.255.255.0
A(config-if)#no shutdown
A(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
B(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
34、 配置默认路由 route(config)#ip route 0.0.0.0 0.0.0.0 下一跳地址
35、 查看路由表
router#show ip route
其中C代表直连的网络,S代表静态的路由,S*代表默认的路由
36、 为Cisco 2600路由器配置密码
配置控制台密码
router (config)#line console 0
router (config-line)#login
router (config-line)#password cisco
37、 配置特权模式密码 router (config)#enable password cisco
38、 配置安全的加密密码 router (config)#enable secret 1234
39、 配置路由器标识 router(config)#banner motd $This is Aptech company’s Router! Please don’t change the configuration whithout permissions$
40、 对所有密码进行加密 router (config)#service password-encryption
41、 配置超时 router(config)#line console 0
router(config-line)#exec-timeout 0 0 //第一个0代表分钟,第二个0代表秒
42、 显示同步 router(config)#line console 0
router(config-line)#logging synchronous
43、 配置禁用DNS router(config)#no ip domain-lookup
44、 利用三台路由器实现静态路由和默认路由
45、 路由器密码恢复
重启路由器按Ctrl+Break键进入ROM Monitor 模式
rommon 1>confreg 0x2142
rommon 2>reset
重启后选择no
router>enable
router#copy startup-config running-config
router#config terminal
router(config)#enable password cisco
router(config)#config-register 0x2102
router#copy running-config startup-config
router#reload
46、 单臂路由——实现不同vlan之间的通信
VLAN 1
VLAN 2
VLAN 3
f0/0
Trunk
1、划分vlan
switch#vlan database
switch(vlan)#vlan 2
switch(vlan)#vlan 3
2、将端口加入vlan
switch(config)#interface range f0/6 -8
switch(config-if-range)#switchport access vlan 2
switch(config-if-range)# interface range f0/9 -11
switch(config-if-range)#switchport access vlan 3
3、配置trunk switch(config)#interface f0/12
switch(config-if)#switchport mode trunk
4、配置路由器的子接口封装dot1q,并设置IP地址
router(config)#interface f0/0.1
router(config-subif)#encapsulation dot1q 1
router(config-subif)#ip address 192.168.0.1 255.255.255.0
router(config-subif)#no shut
router(config)#interface f0/0.2
router(config-subif)#encapsulation dot1q 2
router(config-subif)#ip address 192.168.1.1 255.255.255.0
router(config-subif)#no shut
router(config)#interface f0/0.3
router(config-subif)#encapsulation dot1q 3
router(config-subif)#ip address 192.168.2.1 255.255.255.0
router(config-subif)#no shut
router(config)#interface f0/0
router(config-if)#no shut
5、设置pc的IP地址和默认网关
47、 0RIP版本V1和V2 的区别
RIP v1
发送路由更新时不携带子网掩码,属于有类路由协议
发送路由更新时,目标地址为广播地址:255.255.255.255
RIP v2
发送路由更新时携带子网掩码,属于无类路由协议
发送路由更新时,目标地址为组播地址:224.0.0.9
A
B
C
10.0.0.0/8
20.0.0.0/8
192.168.2.0/24
f0/0
f0/1
f0/0
f0/1
f0/0
f0/1
.1
.1
.1
.2
.2
.2
192.168.1.0/24
48、 RIP V1的配置
配置步骤:.1
1、配置路由器接口IP地址
routerA(config)#interface f0/0
routerA(config-if)#ip address 192.168.1.1 255.255.255.0
routerA(config-if)#no shutdown
routerA(config-if)#interface f0/1
routerA(config-if)# ip address 10.0.0.2 255.0.0.0
routerA(config-if)#no shutdown
routerB(config)#interface f0/0
routerB(config-if)#ip address 10.0.0.1 255.0.0.0
routerB(config-if)#no shutdown
routerB(config)#interface f0/1
routerB(config-if)#ip address 20.0.0.2 255.0.0.0
routerB(config-if)#no shutdown
routerC(config)#interface f0/0
routerC(config-if)#ip address 20.0.0.1 255.0.0.0
routerC(config-if)#no shutdown
routerC(config)#interface f0/1
routerC(config-if)#ip address 192.168.2.2 255.255.255.0
routerC(config-if)#no shutdown
2、在路由器上启动RIP进程,并宣告网络号:
routerA(config)#router rip
routerA(config-router)#network 10.0.0.0
routerA(config-router)#network 192.168.1.0
routerB(config)#router rip
routerB(config-router)#network 10.0.0.0
routerB(config-router)#network 20.0.0.0
routerC(config)#router rip
routerC(config-router)#network 20.0.0.0
routerC(config-router)#network 192.168.2.0
3、验证配置是否正确
1)查看路由表
router#show ip route
2)查看路由协议配置
router#show ip protocol
3)打开RIP协议调试命令
router#debug ip rip
4、在PC上设置IP地址、子网掩码、默认网关,用ping命令测试连通性
A
B
C
10.1.1.0/24
192.168.1.0/24
10.1.2.0/24
192.168.2.0/24
.1
.1
.1
.1
.2
.3
10.1.1.2/24
10.1.2.2/24
192.168.2.2/24
f0/0
f0/0
f0/0
f0/1
f0/1
f0/1
49.RIP V2的配置
配置步骤:
1、配置各路由器接口IP地址
routerA(config)#interface f0/0
routerA(config-if)#ip address 10.1.1.1 255.255.255.0
routerA(config-if)#no shutdown
routerA(config-if)#interface f0/1
routerA(config-if)# ip address 192.168.1.1 255.255.255.0
routerA(config-if)#no shutdown
routerB(config)#interface f0/0
routerB(config-if)#ip address 10.1.2.1 255.255.255.0
routerB(config-if)#no shutdown
routerB(config)#interface f0/1
routerB(config-if)#ip address 192.168.1.2 255.255.255.0
routerB(config-if)#no shutdown
routerC(config)#interface f0/0
routerC(config-if)#ip address 192.168.1.3 255.255.255.0
routerC(config-if)#no shutdown
routerC(config)#interface f0/1
routerC(config-if)#ip address 192.168.2.1 255.255.255.0
routerC(config-if)#no shutdown
2、在路由器上配置RIP V2 路由协议
routerA(config)#router rip
routerA(config-router)#version 2
routerA(config-router)#no auto-summary
routerA(config-router)#network 10.0.0.0
routerA(config-router)#network 192.168.1.0
routerB(config)#router rip
routerB(config-router)#version 2
routerB(config-router)# no auto-summary
routerB(config-router)#network 10.0.0.0
routerB(config-router)#network 192.168.1.0
routerC(config)#router rip
routerC(config-router)# version 2
routerC(config-router)# no auto-summary
routerC(config-router)#network192.168.1.0
routerC(config-router)#network 192.168.2.0
3、验证配置是否正确
1)查看路由表
router#show ip route
2)查看路由协议配置
router#show ip protocol
3)打开RIP协议调试命令
router#debug ip rip
4、在PC上设置IP地址、子网掩码、默认网关,用ping命令测试连通性
49、 上传路由器上的IOS
router#show flash //查看IOS文件名
router#copy flash tftp
Source filename []? c2600-ik8o3s-mz.122-11.T.bin
Address or name of remote host []? 192.168.1.11
Destination filename [c2600-ik8o3s-mz.122-11.T.bin]?
下载IOS到路由器
router#copy tftp flash
上传路由器上配置文件
router#copy nvram:startup-config tftp:
Address or name of remote host []? 192.168.1.11
Destination filename [router-config]? startup-config
下载配置文件到路由器
router#copy tftp:startup-config nvram
C2600路由器IOS被删除的恢复方法:
1、ctrl+break
rommon 1>IP_ADDRESS=192.168.0.100 //路由器接口地址
rommon 2>IP_SUBNET_MASK=255.255.255.0
rommon 3>DEFAULT_GATEWAY=192.168.0.100
rommon 4>TFTP_SERVER=192.168.0.254
rommon 5>TFTP_FILE=c2600-ik8o3s-mz.122-11.T.bin
rommon 6>tftpdnld
展开阅读全文