交换机和路由器常用命大全.doc

上传人:博****1 文档编号:562954144 上传时间:2023-03-30 格式:DOC 页数:11 大小:40.83KB
返回 下载 相关 举报
交换机和路由器常用命大全.doc_第1页
第1页 / 共11页
交换机和路由器常用命大全.doc_第2页
第2页 / 共11页
交换机和路由器常用命大全.doc_第3页
第3页 / 共11页
交换机和路由器常用命大全.doc_第4页
第4页 / 共11页
交换机和路由器常用命大全.doc_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《交换机和路由器常用命大全.doc》由会员分享,可在线阅读,更多相关《交换机和路由器常用命大全.doc(11页珍藏版)》请在金锄头文库上搜索。

1、交换机和路由器配置命令Cisco 交换机的命令行模式:1、用户模式Switch2、特权模式SwitchenableSwitch#3、全局配置模式Switch#config terminalSwitch(config)#4、接口模式Switch(config)#interface fastethernet 0/1Switch(config-if)#Fastethernet表示百兆位以太网接口。Ethernet表示十兆位以太网接口。Gigabitethernet表示千兆位以太网接口。Tengigabitethernet表示万兆位以太网接口。如果从特权模式回到用户模式,需要输入disable命令,其

2、他无论在那个模式,只要输入命令exit就能回到前一个模式,在全局模式或是接口模式,只要输入命令end都能回到特权模式,或者按下ctrl+z组合键等效于命令end。(命令行帮助机制:1、“?”。 2、Tab键。)常用快捷组合键:Ctrl+A 光标移动到命令行的开始位置。Ctrl+E 光标移动到命令行的结束位置。一、常用命令介绍:1、 hostname 用于配置主机名,可简写为host. Switch(config)#host sw1 Sw1(config)#2、 show version 显示系统IOS名称以及版本信息,可简写为sh ver.3、 Show running-config 查看交换

3、机当前配置信息,可简写为sh run.4、 Show startup-config 显示已保存的配置信息,可简写为sh star.5、 Copy running-config startup-config 保存当前配置信息,可简写为copy run star。这个命令还等效于write(简写为wr)。保存当前配置如下:Switch#wr 或者switch#copy run star6、 erase nvram 删除已保存的配置信息,这命令等效于erase startup-config.(擦除)。7、 reload 重新启动。8、 设置console口永不超时命令exec-timeout 0 0

4、 (第一个0为分钟,第二个0为秒钟)。Switch(config)#line con 0Switch(config-line)#exec-timeout 0 09避免显示信息被打断可以这样输入: Switch(config)#line con 0 Switch(config-line)#logging synchronous10、 禁用DNS查找:Switch(config)#no ip domain-lookup二、给路由器配置ip地址Router(config)#interface fastethernet 0/1Router(config-if)#ip address ip_addres

5、s subner_maskRouter(config-if)#no shutdown三、给交换机配置ip地址Switch(config)#interface vlan 1Switch(config-if)#ip address ip_address subner_maskSwitch(config-if)#no shutdown四、配置接口的双工模式及速率 1、指定接口的双工模式: Switch(config-if)#duplex full | falf | auto| 2、指定接口的通讯速率 Switch(config-if)#speed 10 | 100 | 1000 | auto 3、查

6、看口德双工通讯速率 Switch#sh int f0/1ARP命令的使用:1、 arp a 查看ARP缓存表2、 arp d 清除ARP缓存表3、 arp s 绑定IP和MAC地址arp s ip-address mac-ipresscisco 设备用show arp 命令来查看: switch#show arp查看自己的ip和mac地址使用ipconfig /all命令。静态路由和浮动路由的配置命令:|1、 router(config)#ip route network mask address |interface distancenetwork:目的网络地址。Mask:子网掩码Addre

7、ss:到达目的的网络经过下一跳路由器的接口地址。Interface:到达目的网络的本地接口。Distance:管理距离,取值范围为1255.通过设置管理距离可以配置浮动静态路由。2、 配置默认路由:Router(config)#ip route 0.0.0.0 0.0.0.0 address0.0.0.0 0.0.0.0:代表任何网络,也就是说发往任何网络的包都转发到命令指定的下一个路由器接口地址。Address:到达目的网络经过的下一跳路由器的接口地址。3、 配置静态路由:Router(config)#ip route 192.168.1.0 255.255.255.0 f0/0配置默认路由

8、:Router(config)#ip route 0.0.0.0 0.0.0.0 f0/0默认路由只是用于末梢网络。查看路由表命令:Router# show ip route直连路由用C来标识,默认路由用S*来标识。Shutdown :是关闭。No shutdown: 是开启。密码配置:1、 配置console口密码Switch(config)#line console 0Switch(config-line)#password ciscoSwitch(config-line)#login2、 配置特权模式密码明密码配置:Switch(config)#enable password cisco

9、0 加密密码配置:Switch(config)#enable secret cisco3、 加密明文密码:Switch(config)#service password-encryption(给console口、enable password、vty密码的加密)密码恢复:1、 重启路由器,并同时按下Ctrl+Breack键中断IOS的加载,路由器将进入ROMMonitor模式。2、 将配置寄存器的值改为0x2142表示在启动时忽略startup-config的配置:Rommonconfreg 0x2142Rommonreset3、 路由器将再次重启,由于更改了配置寄存器的值,路由器将无法加载配

10、置文件,因此也就不会再有登陆密码。4、 进入到配置模式后,将配置文件手动加载回来。Router#copy startup-config running-config5、 通过show run 命令查看路由器配置了哪些密码,逐一更改。6、 修改配置寄存器的值,并保存。Router(config)#config-register 0x2102Router(config)#exitRouter#copy running-config startup-config交换机的密码恢复:1、 拔掉交换机的插头。(交换机没有开关)2、 重新插好电源后,立刻按住交换机上的mode键,当看到配置界面显示“swit

11、ch:”命令提示,便可松开“mode”键。3、 使用上面提示的命令“flash init”初始化flash.Switch:flash_init4、 将config.text文件名改成config.old.Switch:rename flash:config.text flash:config.old5、 重启交换机。Switch:boot .6、 把配置文件的名字改回来。Switch#rename flash:config.old flash:config.text7、 手工加载配置文件Switch#copy flash:config.text system:running-config8、

12、配置文件加载完成以后,需要进入配置模式修改密码,最后保存配置,完成密码恢复。配置远程管理:1、 配置管理IP:Switch(config)#interface vlan1Switch(config)#ip address 192.168.1.10 255.255.255.0Switch(config-if)#no shutdown2、 配置vty密码:Switch(config)#line vty 0 4Switch(config-line)#password cisco Switch(config-line)#login3、 配置默认网关:Switch(config)#ip default-

13、gateway 192.168.2.254在路由器上配置DHCP服务:1、 定义IP地址池Router(config)#ip dhcp pool pool-name(pool-name表示地址池的名称)2、 动态分配IP地址段Router(dhcp-config)#network network-number mask(Router-number mask 可用于动态分配给客户端主机的IP地址范围)3、 设定网关地址Router(dhcp-config)#default-router gateway-ip(gateway-ip:为客户端主机指定网关地址)4、 为客户端配置DNS地址Router

14、(dhcp-config)#dns-server dns-ip(dns-ip:为客户端主机指定的DNS服务器地址,该命令后可以跟多个备用的DNS地址)5、 设定地址的租期Router(dhcp-config)#lease days(days:表示地址租用期)6、 预留静态分配的IP地址Router(config)#ip dhcp excluded-address low-address high-address命令后斜体部分表示预留的地址范围,low-address为地址范围中的首地址,high-address为地址范围中的尾地址,如果需要预留多个不连续的地址,可以多次执行命令。配置DNS实例

15、:Router(config)#ip dhcp pool benetRouter(dhcp-config)#network 192.168.1.0 255.255.255.0Router(dhcp-config)#default-router 192.168.1.1Router(dhcp-config)#dns-server 202.106.0.20 202.106.148.1Router(dhcp-config)#lease 2Router(config)#ip dhcp excluded-address 192.168.1.100Router(config)#ip dhcp excluded-address 192.168.1.33PAT(端口地址转换):实现外接口地址的复用及IP地址的动态转换:1、 定义访问控制列表 Cisco2811(config)#access-list 1 permit 19

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号