路由器常用命令
1.清除设备所有配置:er st
2.保存配置:wr
3.设备登录标语:banner motd !123!
4.一键加密所有密码:R1(config)#service password-encryption
5.关闭域名解析,输错命令不用等待:R1(config)#no ip domain lookup
6.端口描述:R1(config-if)#description z to 1
配置命令 | 命令功能 | 命令备注 |
---|---|---|
hostname | 配置主机名 | 命令环境为全局配置模式 |
interface XX ip addres ip addres subnetmask no shutdown | 配置路由器接口P地址 | XX可以是局域网接口、广域网接口、子接口等,路 由器接口默认被关闭 |
description mesage | 配置接口描述 | 命令环境为接口配置模式 |
enable pasword pas.swond enable secret passwond | 配置特权口令 | 同交换机基本配置 |
line console O password p passwond login | 配置 Console 口令 | 同交换机基本配置 |
line vty 0-15 pasword passwond login | 配置 VTY ロ令 | 同交换机基本配置 |
service password-encryption | ロ令加密 | 同交换机基本配置 |
banner motd # message# | 配置登录标语 | 同交换机基本配置 |
copy running-config startup-config 或 write | 保存配置 | 同交换机基本配置 |
erase startup-config | 删除配置 | 同交换机基本配置 |
7.de o 传播默认路由
文件备份、系统备份等合集
一、备份路由配置文件到TFTP服务器(也可以备份到电脑里面)
R1#copy startup-config tftp: 备份配置文件到tftp里
二、恢复路由器配置 :
Router#copy tftp startup-config //从TFTP服务器到NVRAM的备份
三、加载配置文件到闪存
Router#copy startup-config running-config
四、备份IOS到TFTP
R1#copy flash: tftp: Source filename []? 123 需要备份的系统名字 Address or name of remote host []? 10.10.10.20 备份到的地址 Destination filename [123]? 是否确定
文件备份命令 | 备份命令解释 |
---|---|
copy running-config startup-config | iable password password 把运行配置文件复制到NVRAM中保存 iable seeret password |
copy running-config flash | 把运行配置文件复制到 flash 中保存 ne console O |
copy running-config tftp | 把运行配置文件复制到 TFTP服务器中保存 1ssword password |
copy running-config ftp | 把运行配置文件复制到FTP服务器中保存 gin |
copy startup-config running-config | ne vty 0-15 把启动配置文件复制到 RAM中运行 |
copy startup-config flash | assword password 把启动配置文件复制到 flash 中保存 gin |
copy startup-config tftp | 把启动配置文件复制到 TFTP服务器中保存 ervice password-encryption |
copy startup-config fip | 把启动配置文件复制到 FTP服务器中保存 1anner motd # message# |
copy flash running-config | 把 flash中的配置文件复制到 RAM中运行 opy running-config startu |
copy flash startup-confg | 把 flash中的配置文件复制到NVRAM中保存 或write |
copy flash ttip | 把 flash中的文件复制到 TFTP服务器中 rase startup-config |
copy flash ftp | 把 flash中的文件复制到 FTP服务器中 |
copy fip running-confg | 把 FTP服务器中的配置文件复制到 RAM中 把 FTP服务器中的配置文件复制到NVRAM中 |
copy ft startup-config |
文件备份命令 | 备份命令解释 |
---|---|
copy ftp flash | 把FTP服务器中的文件复制到flash 中 |
copy tip running-config | 把 TFTP服务器中的配置文件复制到RAM中 |
copy ttp startup-config | 把 TFTP服务器中的配置文件复制到NVRAM中 |
copy tip flash | 把 TFTP服务器中文件复制到 flash中 |
TTY访问网络设备
TTY可以作为实时的输入/输出设备
在实际生活中,经常console线会给console线造成一定程度上的损坏,所以需要配置一台终端服务器来解决这个问题
一、给路由器添加八爪线端口(异步串口模块)
二、配置终端服务器
R1(config)#ena secret FWQ 给路由器加密密码 R1(config)#no ip domain-lookup 关闭域名解析,防止输错命令长时间等待 R1(config)#in l 0 进入换回口0 R1(config-if)#ip add 1.1.1.1 255.255.255.255 配置IP
三、配置TTY线路
1.在配置TTY线路之前 先看设备的TTY线是多少 R1(config)#do sh line Tty Line Typ Tx/Rx A Roty AccO AccI Uses Noise Overruns Int * 0 0 CTY - - - - 0 0 0/0 - 1 1 AUX 9600/9600 - - - - 0 0 0/0 - 0/0/0 3 TTY 9600/9600 - - - - 0 0 0/0 - 0/0/1 4 TTY 9600/9600 - - - - 0 0 0/0 - 0/0/2 5 TTY 9600/9600 - - - - 0 0 0/0 - 0/0/3 6 TTY 9600/9600 - - - - 0 0 0/0 - 0/0/4 7 TTY 9600/9600 - - - - 0 0 0/0 - 0/0/5 8 TTY 9600/9600 - - - - 0 0 0/0 - 0/0/6 9 TTY 9600/9600 - - - - 0 0 0/0 - 0/0/7 10 TTY 9600/9600 - - - - 0 0 0/0 - 132 132 VTY - - - - 0 0 0/0 - 133 133 VTY - - - - 0 0 0/0 - 134 134 VTY - - - - 0 0 0/0 - 135 135 VTY - - - - 0 0 0/0 - 136 136 VTY - - - - 0 0 0/0 - Line(s) not in async mode -or- with no hardware support: 11-131 由此可见是3-10
R1(config)#line 3 10 R1(config-line)#transport input all 通过配置线输入全部 R1(config-line)#password abc R1(config-line)#login 设置为用户登录模式 R1(config-line)#no login 也可以取消登录 方便以后的 管理 R1(config-line)#logging synchronous 开启日志输出同步,避免输入信息的时候被日志信息隔开 R1(config-line)#exec-timeout 0 0 设置抑制超时信息
四、配置VTY线路
R1(config)#line vty 0 15 R1(config-line)#no login 取消登录 方便管理 R1(config-line)#logging synchronous 日志和输出同步 R1(config-line)#exec-timeout 0 0 设置抑制超时信息
如何通过主机名登录访问设备:需要设置主机名和线路之间的映射,线路对应端口号,线路号+2000 好记
ip的名字改为(线路名+2000线路号+环回IP)
R1(config)#ip host r1 2003 1.1.1.1 配置主机名到线路的映射 R1(config)#ip host r2 2004 1.1.1.1 R1(config)#ip host r3 2005 1.1.1.1 R1(config)#ip host r4 2006 1.1.1.1 四个路由 R1(config)#ip host s1 2007 1.1.1.1 R1(config)#ip host s2 2008 1.1.1.1 R1(config)#ip host s3 2009 1.1.1.1 R1(config)#ip host s4 2010 1.1.1.1 四个交换机 R1(config)#do sho hosts 查看配置的映射信息 Default Domain is not set Name/address lookup uses domain service Name servers are 255.255.255.255 Codes: UN - unknown, EX - expired, OK - OK, ?? - revalidate temp - temporary, perm - permanent NA - Not Applicable None - Not defined Host Port Flags Age Type Address(es) r1 2003 (perm, OK) 0 IP 1.1.1.1 r2 2004 (perm, OK) 0 IP 1.1.1.1 r3 2005 (perm, OK) 0 IP 1.1.1.1 r4 2006 (perm, OK) 0 IP 1.1.1.1 s1 2007 (perm, OK) 0 IP 1.1.1.1 s2 2008 (perm, OK) 0 IP 1.1.1.1 s3 2009 (perm, OK) 0 IP 1.1.1.1 s4 2010 (perm, OK) 0 IP 1.1.1.1
五、接入终端服务器
R1#r1 Trying 1.1.1.1 ...Open Router con0 is now available Press RETURN to get started. (You have open connections) [confirm] Closing: 1.1.1.1 ! R1 con0 is now available Press RETURN to get started.