1、
路由器模式的转换:
用户模式: router> 权限低,只能查看,输入“enable ”命令进入到特权模式
特权模式: router#
权限高,输入
“configure terminal” 命令进入到全局模式
全局模式(通配模式):router(config)#
具体配置模式:router(config-if)#
2、查看的命令: show ******
router# show interface查看端口
router# show interface Ethernet 0查看具体端口
3、在路由器里有两种配置文件:
1) running-config:当前运行的配置文件 2) startup-config:启动配置文件
查看配置文件:show running-config
show startup-config
copy running-config startup-config
4、改路由器的名字:在 全局模式下
router(config)# hostname 路由器的名字
5、设置路由器的登陆消息:在全局模式下
router(config)# banner motd #
回车 在此输入消息的内容 #
6、命令:
Router(config)# ip addre
例如:配置以太网口
//以Router1为例 命令:
R1# config t
R1(config)#interface Ethernet 0
R1(config-if)# ip addre 192.168.1.1 255.255.255.0 //配置以太网口 R1(config-if)# no shutdown
// 启用该以太网口
7、CDP协议:
1) R1#show cdp interface
//查看cdp接口
2) R1#show cdp neighbors (details) //查看cdp邻居 3) R1(config)#cdp run
//激活cdp 4) R1(config)#no cdp run
//禁用cdp 5) R1(config)#int e0
//进入到接口
6) R1(config-if)#cdp enable
//激活 e0 的 cdp 7) R1(config-if)#no cdp enable
//禁用 e0 的cdp
8、TFTP服务器的配置
配置路由器: R1#config t R1(config)#int e0
//配置路由器的接口地址 R1(config-if)#ip addre 192.168.0.1 255.255.255.0 R1(config-if)#no shutdown R1#ping 192.168.0.1 配置PC:
IP地址:192.168.0.2 网关:192.168.0.1 测试:ping 192.168.0.1 继续配置路由器:
R1#copy running-config startup-config R1#copy startup-config tftp R1#erase startup-config R1# copy tftp startup-config R1#show startup-config
9、路由器口令的设置:
1)控制台口令: R1#config terminal R1(config)#line con 0 R1(config-line)#login R1(config-line)#paword 密码
2)enable 口令 R1#config terminal R1(config)#enable paword 密码
3)远程登陆口令 R1#config terminal R1(config)#line vty 0 4 R1(config-line)#login R1(config-line)#paword 密码
10、远程登陆:从一台计算机登陆到远端的另一台计算机,使用另一台计算机就像使用自己的计算机一样。
命令:telnet
11、注:配置路由器的串口要区分是DCE口还是 DTE口。例如观察s0哪种接口,可以在特权模式下输入命令:show controller s0
12、时钟频率的配置:
R1(config)#int s0
//进入到DCE端
R1(config-if)#clock rate 56000 //配置时钟频率,启动了串行线上的串行协议
13、查看路由器的路由表
R1#show ip route
//查看路由表
14、静态路由的配置
在全局模式下:
ip route network
mask
命令
目标网络
子网掩码
下一跳 对R1来说:
Router1(config)# ip route 192.168.4.0 255.255.255.0 192.168.2.1 Router1(config)# ip route 192.168.5.0 255.255.255.0 192.168.2.1 Router1(config)# ip route 192.168.3.0 255.255.255.0 192.168.2.1 对R2来说:
Router2(config)# ip route 192.168.5.0 255.255.255.0 192.168.4.2 Router2(config)# ip route 192.168.1.0 255.255.255.0 192.168.2.2 对R3来说:
Router3(config)# ip route 192.168.1.0 255.255.255.0 192.168.4.1 Router3(config)# ip route 192.168.2.0 255.255.255.0 192.168.4.1 Router3(config)# ip route 192.168.3.0 255.255.255.0 192.168.4.1
Router3(config)#ip host 路由器的名字
路由器的IP地址(e0)
15、动态路由的配置*(RIP) r1(config)#router rip r1(config-router)#network 邻居的网络号
16、动态路由的配置*(IGRP) r1(config)#router igrp AS号
r1(config-router)#network 邻居的网络号
17、查看路由协议和路由表
router#show ip protocol
//查看路由协议 router#show ip route
//查看路由表
18、VLAN的配置
1、在1900上的配置
Switch_A#show vlan-membership
//查看VLAN信息
在交换机中默认存在一个VLAN 号码为1,叫VLAN 1,不能删除, 并且所有的端口都默认在这个VLAN中。 Switch_A#show vlan 号码 产生VLAN的命令
Switch_A#config terminal
//进入到全局模式 Switch_A(config)#vlan 号码 name 名字 把端口分配VLAN:
Switch_A(config)#interface 某端口
Switch_A(config-if)#vlan-membership static 号码 Switch_A(config)#interface fa0/26
Switch_A(config-if)#trunk on
//默认使用ISL封装写
2、在2900上的配置 Switch_A#vlan database Switch_A(vlan)#vlan 号码 name 名字 Switch_A(config)#interface某端口
Switch_A(config-if)#switchport mode acce Switch_A(config-if)# switchport acce vlan 号码 配置TRUNK Switch_A(config)#interface fastethernet Switch_A(config-if)# switchport mode trunk Switch_A(config-if)# switchport trunk encapsulation dot1q
3、ROUTER上的配置 Router(config)#int fa0/0 Router(config-if)#no shut Router(config-if)#int fa0/0.1 Router(config-subif)#ip add 192.168.1.1 255.255.255.0 Router(config-subif)#encapsulation isl 10 Router(config-if)#int fa0/0.2 Router(config-subif)#ip add 192.168.2.1 255.255.255.0 Router(config-subif)#encapsulation isl 20