思科设备配置命令:

    同样存在模式的区分 - 

    用户模式 - 用户试图

特权模式 - 系统试图

            全局配置模式

    接口配置模式

   interface gi0/0

  no shutdown 

  ip address 192.168.1.1 255.255.255.0

  

线路配置模式(等同于华为中的 user-interface vty )

   line vty 0 4

   password  nihao

 

协议配置模式

------------------------------------------------------------------


设备初始化配置命令:


Router>                  //刚开始进入设备,处于用户模式

Router>enable            //通过该命令进入到“特权模式”;

Router# 


Router#config terminal //进入到设备的“全局配置模式”

Router(config)#


Router(config)#hostname R1  //更改设备主机名;

R1(config)#


R1(config)# no ip domain-lookup  // 关闭设备的域名查询功能;


R1(config)# exit  // 退出到上一个模式;

R1#


R1(config)# end   // 无论在什么模式,直接回退到“特权模式”

R1#


R1#show ip interface brief //查看当前设备上的接口的状态信息;

interface   ip-address  ok? method     status        protocol 

 gi0/0         un        yes  unset   admin down       down 


R1#config terminal      //进入全局配置模式;

R1(config)# interface gi0/0 // 进入接口 gi0/0 的配置模式;

R1(config-if)# no shutdown   // 打开该端口;

R1(config-if)# ip address 192.168.1.1 255.255.255.0 //配置IP地址;

R1(config-if)# end    //返回到特权模式,为了验证接口的配置命令;


R1#show ip interface brief // 验证之前的配置命令是否成功;


R1#show running-config //查看设备当前的运行配置文件(位于RAM中)


R1#write  //保持设备的配置内容到“启动配置文件”(位于NVRAM中)


R1#show startup-config // 查看启动配置文件内容;


============================================================


设备管理方式:

    本地管理

   -通过console口进行管理,使用console 线;

-默认情况下,是不需要密码的;

-为了安全,配置密码:

    1、确定当前的设备管理方式 :show user 

2、在 console 口下配置密码;

       line console 0 

  password nihao

3、在 console 口下启用认证功能;

       line console 0 

   login

4、验证与测试

       show running-config 

   退出设备,再次登录,应该是需要密码的;

远程管理

   -通过网络进行管理,使用的是 vty 线路;

-默认情况下,是需要远方访问密码的;

-同时,以远程方式访问时,必须配置“特权密码”;

-配置命令如下:

    line vty 0 4       //进入 vty 线路模式,配置远程密码

  password cisco

 

enable secret ccnaccnp //配置特权密码;

-------------------------------------------------------------

   特权密码配置:

       -默认情况下,用户模式进入特权模式,是不需要密码的;

  -为了安全考虑,配置特权密码:

         R1(config)#

                 1、enable password nihao ,该方式配置的密码是明文;

2、enable secret wobuhao ,配置的密码以密文方式存储;

 

  -enable secret 优先级高于 enable password;

  

       -删除“特权密码”:

            R1(config)# no enable password |  no enable secret   


注意:

  为了设备中的所有的密码,都能够以加密的方式存在内存中:

  我们为设备开启“密码加密服务”:(默认该服务没有开启)

  

       R1(config)# service password-encrytion

   当开启该服务以后,line console 和 vty 下面的密码都以加密

的形式存在于 running-config 中。

---------------------------------------------------------------


密码破解:

    -针对路由器

  #核心:配置寄存器

     默认值为 0x2102,表示在设备启动过程中,是需要查找和加载

                   启动配置文件 - startup-config ;

 为了实现密码破解,需要更改寄存器的值为 0x2142,目的是为

 了:在启动过程中,跳过“查找并加载配置文件”的步骤;

 

  #配置命令:

       R1(config)#config-register 0x2142 // 重启之后,才会生效

  #验证命令:

       show version //查看设备的配置寄存器;

reload // 设备重启命令;

  #破解步骤:

      0、设备加电,并一直按下组合键: ctrl+break

      此时设备会进入到 romm 模式(类似于PC的安全模式)

           1、修改配置寄存器值为 0x2142 ,并重启设备;

         romm1> confreg 0x2142 //修改配置寄存器;

 romm2> o/r 0x2142 //修改配置寄存器;

 romm3> ?   //在 romm模式下依然支持帮助命令 - ?

 romm4> reset // 在 romm模式下重启设备;

 设备重启以后进入到“系统对话框配置”模式,

 进行选择 - no ;

 虽然后进入到“用户模式”;

 

           2、在特权模式下,将启动配置文件 copy 到内存中: 

              copy startup-configrunning-config

           3、修改配置文件中的密码;

           4、将配置寄存器修改为默认值: 0x2102

  5、保存配置:write;

           6、将设备重启:reload   


注意:

    启动配置文件(startup-config)是存在于 nvram中,

查看网络设备上存储的文件的命令:

     dir  all-filesystem 

删除文件:

   delete  flash:\xxxxxxx.bin // 删除特定路径下的特定文件;

    删除启动配置文件时,一般使用:

   erase nvram:    // 将 nvram 中的文件全部擦除掉;


    在 cisco packet tracert :

     dir nvram:              //查看NVRAM中是否存在startup-config 

 erase startup-config    // 擦除 nvram 中的 startup-config ;


----------------------------------------------------------------


交换机密码破解:

     -本质:让交换机在启动过程中查找配置文件的名字的时候,

       找不到对应文件名的文件(该文件是:config.text)

-破解步骤: 

      1、设备加电,并一直不停的按mode 键,设备进入到switch:

     模式 ;

  2、在 switch: 模式下输入 flash_init 命令;

  3、查找、更改并验证配置文件名字已经修改为其他名字;

       switch:dir 

switch:rename {source-file}  {destination-file}

  比如:

      rename flash:config.text  flash:111

switch: dir //验证文件名字是否更改成功;

  4、重启设备 : switch : boot //在交换机的romm模式重启设备

  5、进入到设备的“特权模式”,确定并修改配置文件名字为 

      config.text 

          Switch# dir 

  Switch# rename flash:111  flash:config.text 

  Switch# dir 

  6、将启动配置文件 复制到 内存中:

          Switch# copy  startup-config  running-config 

  7、修改交换机的密码;

  8、保存配置;


-------------------------------------------------------------

案例2:

    1、配置 PC 

      ip -      192.168.1.2

  mask -    255.255.255.0

  gateway - 192.168.1.1

2、配置网关

      interface gi0/0  // PC的网关端口IP地址;

    no shutdown 

ip address 192.168.1.1 255.255.255.0 

  interface gi0/1   // 交换机SW1的网关端口IP地址;

    no shutdown 

ip address 10.0.0.1 255.255.255.0

3、配置交换机

      #配置管理IP地址;

      interface vlan 1 

    no shutdown 

ip address 10.0.0.2 255.255.255.0

  #配置交换机的默认网关;

      ip default-gateway 10.0.0.1

4、配置远程访问所需要的相关参数;

      #配置 VTY 密码; 

      line vty 0 4

     password  nihao

  #配置 特权密码;

      enable password / secret  cisco 

5、验证与测试

       PC - 接口IP地址; 

网关 - show ip interface brief 

switch - show ip interface brief / show running-config 

PC:

  telnet 10.0.0.2 

    password : nihao 




    erase nvram:删除启动配置文件;

erase flash:删除 IOS ; 

-----------------------------------------------------

    思科设备安装IOS:

  1、console线 --- xmodem ,速度极慢;

  2、tftp : 在设备无法正常启动IOS时,也会进入到 romm 模式,    

             该模式下,是支持 TFTP功能的;