muri 发表于 2018-7-18 13:23:33

Cisco培训从入门到精通

  一、如何登陆到路由器
  可以用终端通过console连接,也可以通过TCP/IP来连接例:
  c:\>telnet 172.16.0.1
  Password:Yourpass
  RouterName>?
  ##显示在用户模式下面所有可用的命令,回车隔行翻动、空格满屏翻动##
  RouterName>q
  ##q或exit都可以直接退出用户模式,返还到Dos界面##
  RouterName>enable
  ##从用户模式跳转到特权模式,如果有密码认证就必须输入密码才能进入##
  RouterName#
  ##q或exit都可以直接退出特权模式,返还到Dos界面,输入disable可以退回到用户模式##
  RouterName#config
  ##跳转到配置模式##
  RouterName(config)#interface fastethernet 0/0
  ##配置快速以太网接口模式##
  RouterName(config)#interface serial 0/0
  ##配置串口模式##
  RouterName(config-if)#?
  ##输入问号查看相应命令##
  RouterName(config-if)#encapsulation ?
  ##显示串口的封装类型,输入exit可退出接口或以太口配式模式##
  RouterName(config)#exit
  ##输入exit可退出配置模式,再输入exit可退出路由器##
  二、设置路由器时钟
  RouterName#cl?
  ##可以查看路由器下以CL开头的所有命令##
  RouterName#clock ?
  ##可以查看clock的所有参数##
  RouterName#clock set hh:mm:ss mouth mouth year
  RouterName#show clock
  ##查看目前系统时钟##
  三、系统编辑模式
  RouterName#terminal editing
  ##打开系统编辑模式##
  RouterName#terminal no editing
  ##关闭系统编辑模式##
  Ctrl+a
  ##移动光标到开头处##
  Ctrl+e
  ##移动光标到尾部##
  Ctrl+f
  ##向前移动光标##
  Ctrl+b
  ##向后移动光标##
  Ctrl+p
  ##翻动历史命令记录##
  RouterName#show history
  ##显示所有记录的历史命令##

  RouterName#terminal history>  ##修改缓存中最大的命令记录条数,一般最大为256条##
  RouterName#show terminal
  ##查看terminal状况##
  RouterName#show star或show run
  ##显示所有配置信息,可以使用Tab键显示出完整命令##
  ##如show startup-config或show running-config##
  四、如何储存路由器的配置
  路由器里面有两种RAM:
  1.NVRAM冷启动的存储配置引导
  2.RAM目前工作中的配置内容
  RouterName#copy running-config startup-config
  RouterName#wr
  ##拷贝RAM里面的配置到NVRAM中##
  RouterName#erase start
  ##擦除NVRAM中的配置##
  RouterName#reload
  ##重启路由器##
  五、如何设置路由器的密码
  RouterName(config)#enable ?
  RouterName(config)#enable password
  RouterName(config)#enable secret
  ##有两种密码形式1.secret加密的 2.password明文的##
  ##如果同时起用,secret与password的密码不能相同##
  ##secret优先级>password##
  RouterName(config)#no enable password
  RouterName(config)#no enable secret
  ##去掉密码设置##
  RouterName(config)#line ?
  <0-7> First line number
  Aux Auxiliary line
  Console Primary terminal line
  tty Terminal controller
  vty Virtual terminal
  ##Aux辅助密码Console密码tty终端密码vty虚拟密码##
  RouterName(config)#line con 0
  RouterName(config)#login
  RouterName(config)#password yourpassword1
  RouterName(config)#line vty 0 4
  ##定义五个虚拟端口##
  RouterName(config)#login
  RouterName(config)#password yourpassword2
  RouterName(config)#line aux 0
  RouterName(config)#login
  RouterName(config)#password yourpassword3
  ##设置console vty及Aux密码##
  RouterName(config)#line con 0
  RouterName(config)#exec-timeout 0 0
  ##设置console口登陆后在超时后不被退出##
  RouterName(config)#logging synchronous
  ##设置同步显示,输入命令时不被路由器的显示打挠##
  六、如何设置路由器的主机名、描述、IP地址和时钟频率
  RouterName(config)#hostname Yourhostname
  ##设置路由器名称##
  RouterName(config)#banner ?
  RouterName(config)#banner motd #
  Enter TEXT message. End with the character '#'.
  welcome to motd Router
  #
  RouterName(config)#banner login #
  Enter TEXT message. End with the character '#'.
  welcome to login Router
  #
  ##设置路由器banner,motd优先级>login##
  RouterName(config)#no banner motd
  RouterName(config)#no banner login
  ##删除banner##
  RouterName(config)#interface fastethernet 0/0
  RouterName(config-if)#ip address 172.16.0.1 255.255.0.0
  ##IP地址绑定到了快速以太网的接口上##
  RouterName(config-if)#no shutdown
  ##直接起用该IP,注意如果你是用telnet配置的,这时就会断线##
  RouterName(config-if)#interface serial 0/0
  RouterName(config-if)#ip address 172.16.1.1 255.255.0.0
  RouterName(config-if)#no shutdown
  ##IP地址绑定到串口上##
  ##不同接口的IP地址要保证在不同的网段上##
  RouterName(config-if)#description WAN link to BeiJing
  ##描述说明Wan link to BeiJing##
  RouterName(config-if)#bandwidth 512
  ##带宽大小##
  RouterName(config-if)#clock rate 64000
  ##时钟频率##
  RouterName(config-if)#end
  RouterName#show interface serial 0/0
  七、如何创建静态路由项
  RouterName(config)#ip route 192.168.0.0 255.255.255.0 172.16.0.2
  RouterName(config)#copy run start
  ##创建静态项,并保存##
  RouterName(config)#no ip route 192.168.0.0 255.255.255.0 172.16.0.2
  ##删除静态项##
  RouterName(config)#ping 192.168.0.1
  ##可以用ping功能测试是否成功##
  RouterName#show ip protocol
  ##显示当前协议类型##
  RouterName#show ip route
  ##显示路由配置,C表示直连 S表示静态路由项 R表示RIP I表示IGRP##
  八、使用RIP协议来配置动态路由
  RouterName(config)#no ip route 192.168.0.0 255.255.255.0 172.16.0.2
  ##在创建动态路由前,必须把静态路由全部删除##
  ##因为静态路由优先级为1>IGRP>RIP##
  RouterName(config)#router rip
  RouterName(config-router)#network 192.168.0.0
  ##这儿不需要输入掩码,因为RIP只支持默认掩码##
  RouterName(config-router)#end
  九、使用IGRP协议来配置动态路由
  RouterName(config)#router igrp ?
  RouterName(config)#router igrp 100
  ##100项可任选,如果确定,那么其它路由器也要选择100项##
  RouterName(config-router)#network 192.168.0.0
  RouterName(config-router)#end
  RouterName#traceroute 192.168.0.15
  ##可以用traceroute命令测试经过的路由##
  RouterName(config)#router igrp 100
  RouterName(config-router)#variance ?
  RouterName(config-router)#variance 1
  RouterName(config-router)#traffic-share ?
  balanced Share inversely proportional to metric
  min All traffic shared among min metric paths
  ##balanced表示可以平衡即多个包可以同时走多条路##
  ##min表示只允许走最快的一条路##
  十、Cisco交换机Vlan的划分
  SwitchA>enable
  ##进入特权模式##
  SwitchA#show vlan
  ##显示当时信息,一般默认所有Port都处于Vlan1##
  SwitchA#vlan database
  ##进入Vlan的配置模式##
  SwitchA(vlan)#?
  ##查看当前所有可用命令##
  SwitchA(vlan)#vlan ?
  SwitchA(vlan)#vlan 2
  SwitchA(vlan)#exit
  ##建立一个vlan并退出##
  SwitchA#config
  ##进入配置模式##
  SwitchA(config)#interface fastethernet0/3
  SwitchA(config-if)#switchport ?
  ##显示所有类型##
  SwitchA(config-if)#switchport access ?
  SwitchA(config-if)#switchport access vlan 2
  SwitchA(config-if)#end
  SwitchA#show vlan
  ##可以再次查看vlan情况##
  十一、如何备份路由器的IOS
  首先要在PC电脑上装载cisco TFTP服务 下载地址见下面链接
  http://www.feedom.net/Down/index.php?o=display;id=116
  保证TFTP正常运作
  Feedomnet#ping 172.16.10.5
  ##假设TFTP服务器地址为172.16.10.5##
  ##ping以确保能否与TFTP服务器正常通信##
  Feedomnet#show flash
  ##显示闪存中空间状况##
  Feedomnet#show version
  ##显示版本号,起动时间,注册码等等##
  System image file is &quot;flash:c2600-i-mz.120-7.T&quot;
  ##载取show version中的版本部分,当然也可以用show flash查看##
  Feedomnet#copy flash tftp
  Source filename []?c2600-i-mz.120-7.T
  ##要求我们输入源文件名即IOS文件名##
  ##注意这儿大小写是敏感的##
  Address or name of remote host []?172.16.10.5
  ##要求我们输入目标主机的ip##
  Destination filename ?
  ##要求我们输入目标文件名称,回车即可##
  ##开始copy,&quot;!&quot;表示成功无误,TFTP是使用UDP方式传输包##
  ##copy过程中,路由器与TFTP服务器是双向进行的##
  ##IOS文件的备份是非常重要的一个部份##
  ##完成拷贝后TFTP会提示Successful而路由器也会提示完成并自动回到特权模式##
  ##在TFTP-->View-->Option--TFTP server root可以看到IOS备份的路径##
  十二、如何更新路由器的IOS
  Feedomnet#copy tftp falsh
  Address or name of remote host []?172.16.10.5
  Source filename []?c2600-i-mz.120-7.T
  Destiantion filename ?
  ##如果目标文件名换成新的文件名##
  ##那么在路由器中将存在两个IOS文件,如果空间不成问题##
  ##如果直接回车,表示不更改文件名称,那么将复盖原来的IOS文件##
  Do you want to over write?
  ##不更改文件名,回车确认复盖##
  Erase flash:before copying?
  Erasing the flash filesystem will remove all files! continue?
  Verifying Checksum... OK (0XBDFF)
  十三、如何备份路由器的配置
  Feedomnet#copy run tftp
  Address or name of remote host []?172.16.10.5
  Destination filename ?
  ##拷贝running-config到tftp##
  Feedomnet#copy startup-config tftp
  Address or name of remote host []?172.16.10.5
  Destination filename ?2620a-startup
  ##可以随便起个名字##
  ##拷贝startup-config到tftp##
  ##可以回到tftp服务器找到该两个配置内容##
  ##可以用记事本打开查看##
  十四、如何使用CDP协议
  Feedomnet#show cdp
  Feedomnet#config
  Feedomnet(config)#cdp timer ?
  Feedomnet(config)#cdp timer 60
  Feedomnet#show cdp ?
  Feedomnet#show cdp interface
  ##显示当前路由器CDP的状态##
  Feedomnet#show cdp entry *
  ##显示所有直接连接设备的具体信息##
  Feedomnet#show cdp neighbor
  ##显示所有直接连接的邻居##
  Feedomnet#show cdp neighbor detail
  ##显示所有直接连接的邻居设备的细节##
  Feedomnet#config
  Feedomnet(config)#no cdp run
  ##禁用cdp##
  Feedomnet(config)#cdp run
  ##启用cdp##
  Feedomnet#show cdp n
  ##显示##
  十五、如何正确的使用telnet
  使用consol连上本地路由器
  Feedomnet#telnet 192.168.0.1
  ##连接到远端的路由器##
  Router1#exit
  ##退回到本机路由器##
  Feedomnet#telnet 192.168.0.2
  ##连接到远端的路由器2##
  Router2#exit
  ##退回到本机路由器##
  Feedomnet#show sessions
  ##显示历史连接记录##

  Conn Host Address Byte>  1 192.168.0.1 192.168.0.1 0 1 192.168.0.1
  * 2 192.168.0.2 192.168.0.2 0 0 192.168.0.2
  Feedomnet#1
  ##可以选择曾经连接过的路由器##
  ##按两次回车马上进入##
  ##不选择两次回车进入默认的路由器即星号的路由器##
  Feedomnet#192.168.0.1
  ##telnet到该路由器,可缺省telnet命令##
  Router1#show user
  ##显示该路由器使用的用户##
  Router1#clear line 22
  ##断开使用者的会话##
  十六、如何完成解析主机名
  Feedomnet#
  Feedomnet#config
  Feedomnet(config)#ip host RouterA 172.16.0.2
  Feedomnet(config)#ip host RouterB 172.16.0.3
  ##增加IP主机影射项##
  Feedomnet(config)#end
  Feedomnet#ping RouterA
  Feedomnet#ping RouterB
  Feedomnet#show hosts
  ##显示所有刚刚添加的主机项目##
  Feedomnet(config)#no ip host RouterA
  ##删除主机项##
  十七、如何配置IP标准的访问列表
  Feedomnet(config)#access-list ?
  ##查看所有的访问列表的类型##
  Feedomnet(config)#access-list 10 permit 172.16.10.100 ?
  Feedomnet(config)#access-list 10 permit 172.16.10.100 0.0.0.0
  Feedomnet(config)#int fast0/0
  Feedomnet(config-if)#ip access-group 10 in
  Feedomnet(config-if)#end
  Feedomnet#show access-list
  十八、如何配置IP扩展的访问列表
  ##注意在配置扩展前要把标准的列表给删除掉##
  Feedomnet(config)#access-list 110 deny ?
  Feedomnet(config)#access-list 110 deny tcp host 172.16.10.6 host 172.16.10.254 eq telnet log
  ##拒绝172.16.10.6这台电脑用telnet访问172.16.10.254路由器##
  Feedomnet(config)#access-list 110 permit ip any any
  ##允许所有的通过,以上两条命令一般都是联系起来做的##
  Feedomnet(config)#int f0/0
  Feedomnet(config-ip)#ip access-group 110 in
  ##把所配的110配置与快速以太网口联系起来##
  Feedomnet(config-ip)#end
  Feedomnet#sh run
  十九、如何配置ppp协议
  ##首先在路由器A进行配置##
  FeedomA#show int s0/0
  ##可以查看当前的封装模式##
  FeedomA#config
  FeedomA(config)#int s0/0
  FeedomA(config-if)#encapsulation ppp
  FeedomA(config-if)#exit
  FeedomA(config)#username FeedomB password cisco
  FeedomA(config)#int s0/0
  FeedomA(config-if)#ppp authintication chap
  FeedomA(config-if)#end
  FeedomA#show int s0/0
  ##再次显示当前的封装类型以确认##
  ##再到路由器B进行配置##
  FeedomB#show int s0/0
  ##可以查看当前的封装模式##
  FeedomB#config
  FeedomB(config)#int s0/0
  FeedomB(config-if)#encapsulation ppp
  FeedomB(config-if)#exit
  FeedomB(config)#username FeedomA password cisco
  ##这里注意双方密码要一致##
  FeedomB(config)#int s0/0
  FeedomB(config-if)#ppp authintication chap
  FeedomB(config-if)#end
  FeedomB#show int s0/0
  ##再次显示当前的封装类型以确认##
  FeedomB#debug ppp authen
  ##起用ppp的验证调试##
  二十、使用HDLC来配置serial口
  FeedomA(config)#int s0/0
  FeedomA(config-if)#encapsulation hdlc
  ##以下跳到另一台路由器##
  FeedomB(config)#int s0/0
  FeedomA(config-if)#encapsulation hdlc
  FeedomA(config-if)#end
  ##连接开始建立成功##
  FeedomA#show int s0/0
  ##可以看到封装已改成了hdlc,hdlc是cisco的专用协议##
页: [1]
查看完整版本: Cisco培训从入门到精通