1、CISCO交换机和路由器基本配置一 CISCO交换机和路由器基本配置交换机的配置1 用户模式switch 2 进入特权模式switch enable3 进入全局配置模式,全局模式的配置对整个交换机生效.switch # config terminalswitch (config)#4 进入接口模式,配置只对当前的接口生效switch(config) # interface f0/1switch(config-if) #进入line 模式,这个模式主要用来对控制台做相应的配置5 switch(config) # line console 0 switch(config-line)6 配置主机名s
2、witch(config) #hostname 主机名7 配置使能口令switch(config) # enable password 密码8 配置加密使能口令switch(config) # enable secret 密码9 配置ip地址switch(config) # interface vlan 1switch(config) # ip add ip地址 子网掩码switch(config) # no shutdown10 配置交换机的网关switch(config) # ip default-gateway ip地址11 保存配置switch # copy runing-config
3、 startup-configswitch # write12 清空配置switch # erase startup-config13 清空接口配置switch (config) # interface f0/1switch (config-if) # default interface f0/114 清空交换机密码(1) 关闭电源.(2) 开启电源, 并且按住交换机的mode键,当交换机进入. flash_init load_helper bootswitch:(3) 在switch 后执行 flash_init命令switch: flash-init(4) 在查看flash中的文件swit
4、ch: dir flash:/(5) 把config.text文件后缀名改了就可以,并且重新启动.(交换机重启后不会在读取配置文件了)switch:rename flash:config.text config.oldswitch:boot(6) 启动后进入特权模式查看flash里面的文件,并且把config.text文件改回来.并且把flash里面的文件复制到内存中switch # rename flash:config.old flash:config.textswitch # copy startup-config running-config15 创建vlan 2switch (con
5、fig) # vlan 216 删除vlan 2switch (config) # no vlan 217 把端口 f0/5到10 添加到vlan 2switch (config) # interface range f0/5 - 10switch (config) # switchport access vlan 218 将f0/1设置成中 trunkswitch (config) # interface f0/1switch (config) # switchport mode trunk19 将f0/1 设置成期望型或自动型switch (config) # switchport dyn
6、amic desirable / auto20 如果不需要trunk 传送vlan 2的数据,可以将vlan 2 从trunk中删除.switch (config) # interface f*/* (trunk接口)switch (cofnig-if) # switchprot trunk allowed vlan remove vlan 2 21 也可以添加vlan 2switch (config) # interface f*/* (trunk接口)switch (config) # switchprot trunk allowed vlan add vlan 2二 交换机的查看命令sw
7、itch # show mac-address-table 查看本机的mac地址表switch # show cdp neighbors 列出与本设备相连的cisco设备switch # show running-config 查看交换机的配置switch # show vlan brief 查看vlan的详细信息switch # show Internet trunk 可以查看生成树协议三 路由器配置命令1 配置默认路由route (config) # ip route 0.0.0.0 0.0.0.0 下一跳2 配置静态路由route (config) # ip route 目的ip 子网掩
8、码 下一跳3 对所有密码进行加密route (config) # enable password-encryption4 如果要使enable密码也以加密的形式保存在running-config中,中需运行route (config) # service password-encryption5 接口route (config-if) # speed 10/100/auto (配置速率)route (config-if) # duplex auto/full/half (工作模式,自动/半双工/全双工)route (config-if) # description 文本 (接口模式为当前接口列
9、出希望跟踪的信息文本)6 对接口进行标识route (config) # interface f0/1route (config) # description 内容7 配置超时route (route) # line console 0route (route_line) #exec-timeout 0 0 (第一个0代表分钟,第二个0代表秒)8 配置telnetroute (route) # line vty 05 (配置同时登陆的个数)route (route) # password 密码 (配置telnet密码)route (route) # login 9 配置sshroute (ro
10、ute) # line vty 05route (route-line) # transport ipput telnet ssh (同时接受telnet和ssh登陆) route (route) # username 用户名 password 密码 (配置用户名和密码)route (route) # ip domain-name 域名 (配置一个dns域名)route (route) # crypto key generate RSA (配置交换机生成一对匹配的公钥和私钥,以及一个共享的加密密钥) route # show crypto key mypubkey rsa (查看ssh密钥的副
11、本)route # show running-config | begin line vty (查看当前运行的配置,从包含第一个line bty开始)10显示同步route (config) # line ocnsole 0route (config_line) # logging synchronous11 配置禁用dnsroute (config) # no ip domain-lookup12 路由器的密码恢复(1) 重新启动路由器,在启动的60 s内按下ctrl + break 使路由器进入rom monitor模式(2) 在提示符下输入命令修改配置寄存器的值,然后程序启动rommon
12、 1confreg 0x2142rommon 2resetroute enableroute #copy startup-config running-config (然后修改密码在保存)route #config-register 0x2102 (上系统在启动时读取配置文件)route # write13 路由器和交换机的单臂路由route (config) # interface 接口类型 槽位/接口序号.子接口route (config-subif) # ip add ip地址 子网掩码route (config-subif) # encapsolation dot1q vlan-id1
13、4 rip路由协议的配置rip v2的配置route (config) # route riproute (config-route) # version 2route (config-route) # no uato -summaryroute (config-route) # network 主网络 宣告主网络号四 路由器查看命令route # show interface 接口 查看接口的状态route # show ip int b 查看接口起用状态route # show ip route 查看路由表route # show version 查看路由器的版本信息route # sho
14、w clock 查看路由器当前的时间route # show ip protocol 查看路由协议配置route # show protocols 显示配置的协议route # show debug ip rip 开启调试命令route # Trace ip地址 跟踪ip 路由五 备份los和上传losroute # copy startup-config tftp 备份losroute # copy tftp startup-config 上传losroute # copy running-config tftp 备份配置文件route # copy tftp running-config 下载配置文件六 组合键ctrl + shift + 6 中止解析ctrl + z 取消上一次操作七 vtp协议1 vtp 协议慨述vtp 是vlan.中继协议,vtp协议是cisco的专用协议,做作用如下:(1) 保持vlan配置的一致性(2) 提供从一个交换机在正规管理域增加虚拟局域网的方法2 vtp的工作原理要使用vtp,就必须为每台交换机指定vtp域名一台交换机只能属于一个vtp域,不同域中的交换机不能共享vtp信息.vtp服务器上进行了vlan配置变更后,所做的vtp域内的所有交换机上.vtp消息通过所有的中继连接进行传播.域内的交换机都必须使用相同的vtp域
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1