分享

CISCO路由命令大全

 jingdonghao2008 2008-10-19

Cisco 路由器常用命令

1 Exec commands:

<1-99> 恢复一个会话
bfe 手工应急模式设置
clear 复位功能
clock 管理系统时钟
configure 进入设置模式
connect 打开一个终端
copy 从tftp服务器拷贝设置文件或把设置文件拷贝到tftp服务器上
debug 调试功能
disable 退出优先命令状态
disconnect 断开一个网络连接
enable 进入优先命令状态
erase 擦除快闪内存
exit 退出exce模式
help 交互帮助系统的描述
lat 打开一个本地传输连接
lock 锁定终端
login 以一个用户名登录
logout 退出终端
mbranch 向树形下端分支跟踪多路由广播
mrbranch 向树形上端分支跟踪反向多路由广播
name-connection 给一个存在的网络连接命名
no 关闭调试功能
pad 打开X.29 PAD连接
ping 发送回显信息
ppp 开始点到点的连接协议
reload 停机并执行冷启动
resume 恢复一个活动的网络连接
rlogin 打开远程注册连接
rsh 执行一个远端命令
send 发送信息到另外的终端行
setup 运行setup命令
show 显示正在运行系统信息
slip 开始SLIP协议
start-chat 在命令行上执行对话描述
systat 显示终端行的信息
telnet 远程登录
terminal 终端行参数
test 测试子系统内存和端口
tn3270 打开一个tin3270连接
trace 跟踪路由到目的地
undebug 退出调试功能
verify 验证检查闪烁文件的总数
where 显示活动的连接
which-route 执行OSI路由表查找并显示结果
write 把正在运行的设置写入内存、网络、或终端
x3 在PAD上设置X.3参数
xremote 进入xremote模式

2 #show ?

access-expression 显示访问控制表达式
access-lists 显示访问控制表
apollo Apollo 网络信息
appletalk Apple Talk 信息
arap 显示Appletalk 远端通道统计
arp 地址解析协议表
async 访问路由接口的终端行上的信息
bridge 前向网络数据库
buffers 缓冲池统计
clns CLNS网络信息
clock 显示系统时钟
cmns 连接模式网络服务信息
compress 显示压缩状态
configuration 非易失性内存的内容
controllers 端口控制状态
debugging 调试选项状态
decnet DEC网络信息
dialer 拨号参数和统计
dnsix 显示Dnsix/DMPP信息
entry 排队终端入口
extended 扩展端口信息
flash 系统闪烁信息
flh-log 闪烁装载帮助日志缓冲区
frame-relay 帧中继信息
history 显示对话层历史命令
hosts IP域名,查找方式,名字服务,主机表
interfaces 端口状态和设置
ip IP信息
ipx Novell IPX信息
isis IS-IS路由信息
keymap 终端键盘映射
lat DEC LAT信息
line 终端行信息
llc2 IBM LLC2 环路信息
lnm IBM 局网管理
local-ack 本地认知虚环路
memory 内存统计
netbios-cache NetBios命名缓冲存贮器内存
node 显示已知LAT节点
ntp 网络时间协议
processes 活动进程统计
protocols 活动网络路由协议
queue 显示队列内容
queueing 显示队列设置
registry 功能注册信息
rhosts 远程主机文件
rif RIF存贮器入口
route-map 路由器信息
sdlle 显示sdlc-llc2转换信息
services 已知LAT服务
sessions 远程连接信息
smds SMDS信息
source-bridge 源网桥参数和统计
spanning-tree 跨越树形拓朴
stacks 进程堆栈应用
standby 热支持协议信息
stun STUN状态和设置
subsystem 显示子系统
tcp TCP连接状态
terminal 显示终端设置
tn3270 TN3270 设置
translate 协议转换信息
ttycap 终端容易表
users 显示终端行的信息
version 系统硬、软件状态
vines VINES信息
whoami 当前终端行信息
x25 X.25信息
xns XNS信息
xermote Xremote统计

3 #config ?

Memory 从非易失性内存设置
Network 从TFTP网络主机设置
Overwrite-network 从TFTP网络主机设置覆盖非易失性内存
Terminal 从终端设置

4 Configure commads:

Access-list 增加一个访问控制域
Apollo Apollo全局设置命令
appletalk Appletalk 全局设置命令
arap Appletalk远程进出协议
arp 设置一个静态ARP入口
async-bootp 修改系统启动参数
autonomous-system 本地所拥有的特殊自治系统成员
banner 定义注册显示信息
boot 修改系统启动时参数
bridge 透明网桥
buffers 调整系统缓冲池参数
busy-message 定义当连接主机失败时显示信息
chat-s cript 定义一个调制解调器对话文本
clns 全局CLNS设置子命令
clock 设置时间时钟
config-register 定义设置寄存器
decnet 全局DEC网络设置子命令
default-value 缺省字符位值
dialer-list 创建一个拨号清单入口
dnsix-nat 为审计提供DMDM服务
enable 修改优先命令口令
end 从设置模式退出
exit 从设置模式退出
frame-relay 全局帧中继设置命令
help 交互帮助系统的描述
hostname 设置系统网络名
iterface 选择设置的端口
ip 全局地址设置子命令
ipx Novell/IPX全局设置命令
keymap 定义一个新的键盘映射
lat DEC本地传输协议
line 设置终端行
lnm IBM局网管理
locaddr-priority-list 在LU地址上建立优先队列
logging 修改注册(设备)信息
login-string 定义主机指定的注册字符串
map-class 设置静态表类
map-list 设置静态表清单
menu 定义用户接口菜单
mop 设置DEC MOP服务器
netbios NETBIOS通道控制过滤
no 否定一个命令或改为缺省设置
ntp 设置NTP
priority-list 建立特权列表
prompt 设置系统提示符
queue-list 建立常规队列列表
rcmd 远程命令设置命令
rcp-enable 打开Rep服务
rif 源路由进程
router-map 建立路由表或进入路由表命令模式
router 打开一个路由进程
rsh-enable 打开一个RSH服务
sap-priority-list 在SAP或MAC地址上建立一个优先队列
service 修改网络基本服务
snmp-server 修改SNMP参数
state-machine 定义一个TCP分配状态的机器
stun STUN全局设置命令
tacacs-server 修改TACACS队列参数
terminal-queue 终端队列命令
tftp-server 为网络装载请求提供TFTP服务
tn3270 tn3270设置命令
translate 解释全局设置命令
username 建立一个用户名及其权限
vines VINES全局设置命令
x25 X.25 的第三级
x29 X.29 命令
xns XNS 全局设置命令
xremote 设置Xremote

5 (config)#ip

Global IP configuration subcommands:
Accounting-list 选择保存IP记帐信息的主机
Accounting-threshold 设置记帐入口的最大数
accounting-transits 设置通过入口的最大数
alias TCP端口的IP地址取别名
as-path BGP自治系统路径过滤
cache-invalidate-delay 延迟IP路由存贮池的无效
classless 跟随无类前向路由规则
default-network 标志网络作为缺省网关候选
default-gateway 指定缺省网(如果没有路由IP)
domain-list 完成无资格主机的域名
domain-lookup 打开IP域名服务系统主机转换
domain-name 定义缺省域名
forward-protocol 控制前向的、物理的、直接的IP广播
host 为IP主机表增加一个入口
host-routing 打开基于主机的路由(代理ARP和再定向)
hp-host 打开HP代理探测服务
mobile-host 移动主机数据库
multicast-routing 打开前向IP
name-server 指定所用名字服务器的地址
ospf-name-lookup 把OSPF路由作为DNS名显示
pim PIM 全局命令
route 建立静态路由
routing 打开IP路由
security 指定系统安全信息
source-route 根据源路由头的选择处理包
subnet-zero 允许子网0子网
tcp 全局TCP参数

路由器计算机网络中有着举足轻重的地位,是计算机网络的桥梁。通过它不仅可以连通不同的网络,还能选择数据传送的路径,并能阻隔非法的访问。
  路由器的配置对初学者来说,并不是件十分容易的事。现将路由器的一般配置和简单调试介绍给大家,供朋友们在配置路由器时参考,本文以Cisco2501为例。
  Cisco2501有一个以太网口(AUI)、一个Console口(RJ45)、一个AUX口(RJ45)和两个同步串口,支持DTE和DCE设备,支持 EIA/TIA-232、 EIA/TIA-449、 V.35 、X.25和EIA-530接口。
  一.配置
  1.配置以太网端口
  # conf t(从终端配置路由器)
  # int e0(指定E0口)
  # ip addr ABCD XXXX(ABCD 为以太网地址,XXXX为子网掩码)
  # ip addr ABCD XXXX secondary(E0口同时支持两个地址类型。如果第一个为 A类地址,则第二个为B或C类地址)
  # no shutdown(激活E0口)
  # exit
  完成以上配置后,用ping命令检查E0口是否正常。如果不正常,一般是因为没有激活该端口,初学者往往容易忽视。用no shutdown命令激活E0口即可。
  2.X.25的配置
  # conf t
  # int S0(指定S0口)
  # ip addr ABCD XXXX(ABCD 为以太网S0 的IP地址,XXXX为子网掩码)
  # encap X25-ABC(封装X.25协议。ABC指定X.25为DTE或DCE操作,缺省为DTE)
  # x25 addr ABCD(ABCD为S0的X.25端口地址,由邮电局提供)
  # x25 map ip ABCD XXXX br(映射的X.25地址。ABCD为对方路由器(如:S0)的IP 地址,XXXX为对方路由器(如:S0)的X.25端口地址)
  # x25 htc X(配置最高双向通道数。X的取值范围1-4095,要根据 邮电局实际提供的数字配置)
  # x25 nvc X(配置虚电路数,X不可超过邮电局实际提供的数否则将影响数据的正常传输)
  # exit
  S0端口配置完成后,用no shutdown命令激活E0口。如果ping S0端口正常,ping 映射的X.25 IP地址即对方路由器端口IP地址不通,则可能是以下几种情况引起的:1)本机X.25地址配置错误,重新与邮局核对(X.25地址长度为13位);2)本机映射IP地址或X.25地址配置错误,重新配置正确;3)对方IP地址或X.25地址配置错误;4)本机或对方路由配置错误。
  能够与对方通讯,但有丢包现象。出现这种情况,一般有以下几种可能:1)线路情况不好,或网卡、RJ45插头接触不良;2)x25 htc最高双向通道数X的取值范围和x25nvc 虚电路数X超出邮电局实际提供的数字。最高双向通道数和虚电路数这两个值越大越好,但绝对不能超出邮电局实际提供的数字,否则就会出现丢包现象。
  3.专线的配置
  # conf t
  # int S2(指定S2口)
  # ip addr ABCD XXXX(ABCD 为S2 的IP地址,XXXX为子网掩码)
  # exit
  专线口配置完成后,用no shutdown命令激活S2口即可。
  4.帧中继的配置
  # conf t
  # int s0
  # ip addr ABCD XXXX (ABCD 为S0 的IP地址,XXXX为子网掩码)
  # encap frante_relay (封装frante_relay 协议)
  # no nrzi_encoding (NRZI=NO)
  # frame_relay lmi_type q933a (LMI使用Q933A标准.LMI(Local management Interface) 有3种:ANSI:T1.617、CCITTY:Q933A和Cisco特有的标准)
  # fram-relay intf-typ ABC(ABC为帧中继设备类型,它们分别是DTE设备、DCE交换机或NNI(网络接点接口)支持)
  # frame_relay interface_dlci 110 br(配置DLCI(数据链路连接标识符))
  # frame-relay map ip ABCD XXXX broadcast (建立帧中继映射。ABCD为对方IP地址,XXXX为本地DLCI号,broadcast允许广播向前转发或更新路由)
  # no shutdown (激活本端口)
  # exit
  帧中继S0端口配置完成后,用ping命令检查S0口。如果不正常,通常是因为没有激活该端口,用no shutdown命令激活S0口即可。如果ping S0端口正常,ping 映射的IP地址不正常,则可能是帧中继交换机或对方配置错误,需要综合排查。
  5.配置同步/异步口(适用于2522)
  # conf t
  # int s2
  # ph asyn (配置S2为异步口)
  # ph sync (配置S2为同步口)
  6.动态路由的配置
  # conf t
  # router eigrp 20 (使用EIGRP路由协议。常用的路由协议有RIP、IGRP、IS-IS等)
  # passive-interface serial0 (若S0与X.25相连,则输入本条指令)
  # passive-interface serial1 (若S1与X.25相连,则输入本条指令)
  # network ABCD (ABCD为本机的以太网地址)
  # network XXXX (XXXX为S0的IP地址)
  # no auto-summary
  # exit
  7.静态路由的配置
  # ip router ABCD XXXX YYYY 90 (ABCD为对方路由器的以太网地址,XXXX 为子网掩码,YYYY为对方对应的广域网端口地址)
  # dialer-list 1 protocol ip permail
  二. 综合调试
  当路由器全部配置完毕后,可进行一次综合调试。
  1.首先将路由器的以太网口和所有要使用的串口都激活。方法是进入该口,执行no shutdown。
  2.将和路由器相连的主机加上缺省路由(中心路由器的以太地址)。方法是在Unix系统的超级用户下执行:router add default XXXX 1(XXXX为路由器的E0口地址)。每台主机都要加缺省路由,否则,将不能正常通讯。
  3.ping本机的路由器以太网口,若不通,可能以太网口没有激活或不在一个网段上。ping广域网口,若不通,则没有加缺省路由。ping对方广域网口,若不通,路由器配置错误。ping主机以太网口,若不通,对方主机没有加缺省路由。
  4.在专线卡X.25主机上加网关(静态路由)。方法是在Unix系统的超级用户下执行:router add X.X.X.X Y.Y.Y.Y 1(X.X.X.X为对方以太网地址,Y.Y.Y.Y为对方广域网地址)。
  5.使用Tracert对路由进行跟踪,以确定不通网段

show version

show processes

show protocols

show mem

show ip route

show startup-config

show running-config

show flash

show interfaces

二、 基本路由配置命令
进入:config terminal/memory/network
配置网络时常采用的命令:copy和load

1. 标识:hostname 标识名

2. 启动标识:banner 启动标识

3. 接口:interface 端口号

4. 密码:line 0 6

login

passwd 口令

enable password/secret 口令

5. 接口:

1)配置端口

interface 端口号

clock rate 时钟速率(64000)/* 在串口中配置 */&n! bsp;

bandwidth 带宽(缺省56) /* 在串口中配置 */

media-type 介质类型 /* 在以太网口上 */

early-token release /* 在令牌环网口上 */

ring-speed 16 /* 在令牌环网口上 */

no shutdown

write memory

2)检验端口

show interfaces

show controllers

6. 配置环境

1) 引导方式

boot system flash IOS-filename

boot system tftp IOS-filename tftp-address

boot system rom

2) 配置Register值

config-register 0x2102

7. 查看邻居路由

show cdp interface

show cdp neighbors [detail]

show cdp entry routerA !

8. IP Address 配置

Ip ad dress 网络地址 掩码

Ip host 主机名 address

Ip name-server 服务器地址1 服务器地址2 。。。

Ip domain-lookup nsap

Show hosts

Ping 主机名/IP地址

Trace 主机名/IP地址
三、 IP 路由

1. 静态路由

ip routing

ip route 目标网络号 掩码 端口号 [permanent]

2. 缺省路由

ip default-network 网络号

3. 动态路由

1) RIP配置

Router rip

Network 网络号

Show ip route

Show ip protocol

Debug ip

2) OSPF 配置

Router ospf 进程号

Redistribute 其它路由协议

Network ! 端口网络 反掩码 area 区域号

Area 区域号 range 网络号 掩码

Area 区域号 default-cost 花销值

Ip ospf priority number

Ip ospf cost 花销值

Show ip ospf database

3) BGP 配置

Router bgp 自治域号

Redistribute 其它路由协议

Network 网络号 /* 自治域内 */

Aggregate-address 网络号 掩码 summary-only 汇总网络

Neighbor 相邻网络号 remote-as 自治域号 /* 自治域间的网络 */
四、 流量控制

1) 被动端口

passive interface 端口号

2) 缺省路由

ip default 网络号/端口网络

3) 静态路由

ip route 目标网? 绾?nbsp;掩码 端口号

4)ACL过滤表

( 全局上) access-list 访问号1 {permit|deny} 反掩码号 [ established]

access-list 访问号2 {permit|deny} IP/TCP协议 源网络 目的网络
操作符 参数

(端口上)access-group 访问号 in|out

distribute-list 访问号 in|out 端口号

4) Null 0 interface

Ip route address mask null 0

五、 广义网配置

1) PPP

Ppp pap sent-usename 封装

Ppp chap hostname

Ppp chap password

2)X.25

encapsulation x25 [dce]

x25 address

x25 map 协议地址 /*SVC */

x25 pvc pvc号 ip地址 x25地址 /*PVC */

ip switching

x25 ro! ute x.121地址 接口 x.121映射地址

2) FrameRelay

Frame-relay local-dlci IP网络号

Frame-relay map 协议地址

Frame-relay lmi-type ansi


路由器命令
router>         用户模式
1:进入特权模式  enable
router > enable
router #

2:进入全局配置模式  configure terminal
router > enable
router #c onfigure terminal
router (conf)#

3:交换机命名 hostname routera    以routerA为例
router > enable
router #c onfigure terminal
router(conf)#hostname routerA
routera (conf)#

4:配置使能口令  enable password cisco    以cisco为例
router > enable
router #c onfigure terminal
router(conf)#hostname routerA
routerA (conf)# enable password cisco

5:配置使能密码  enable secret ciscolab    以cicsolab为例
router > enable
router #c onfigure terminal
router(conf)#hostname routerA
routerA (conf)# enable secret ciscolab

6:进入路由器某一端口 interface fastehernet 0/17           以17端口为例
router > enable
router #c onfigure terminal
router(conf)#hostname routerA
routerA (conf)# interface fastehernet 0/17
routerA (conf-if)#
进入路由器的某一子端口 interface fastethernet 0/17.1       以17端口的1子端口为例
router > enable
router #c onfigure terminal
router(conf)#hostname routerA
routerA (conf)# interface fastehernet 0/17.1

7:设置端口ip地址信息
router > enable
router #c onfigure terminal
router(conf)#hostname routerA
routerA(conf)# interface fastehernet  0/17                以17端口为例
routerA (conf-if)#ip address 192.168.1.1 255.255.255.0      配置交换机端口ip和子网掩码
routerA (conf-if)#no shut                              是配置处于运行中
routerA (conf-if)#exit

8:查看命令  show
router > enable
router # show version  察看系统中的所有版本信息
show interface vlan 1  查看交换机有关ip 协议的配置信息
show running-configure 查看交换机当前起作用的配置信息
show interface fastethernet 0/1  察看交换机1接口具体配置和统计信息
show mac-address-table        查看mac地址表
show mac-address-table aging-time  查看mac地址表自动老化时间
       show controllers serial + 编号    查看串口类型
       show ip router      查看路由器的路由表

9:cdp相关命令
router > enable
router # show cdp    查看设备的cdp全局配置信息
show cdp interface fastethernet 0/17    查看17端口的cdp配置信息
show cdp traffic     查看有关cdp包的统计信息
show cdp nerghbors  列出与设备相连的cisco设备

10:csico2600的密码恢复
重新启动路由器,在启动过程中按下win+break键,使路由器进入rom monitor
在提示符下输入命令修改配置寄存器的值,然后重新启动路由器
remmon1>confreg 0x2142
remmon2>reset
重新启动路由器后进入setup模式,选择“no”,退回到exec模式,此时路由器原有的配置仍然保存在startup-config中,为使路由器恢复密码后配置不变把startup-config中配置保存到running-config中,然后重新设置enable密码,并把配置寄存器改回0x2102:
router>enable
router#copy startup-config running-config
router#c onfigure terminal
router(conf)#enable password cisco
router(conf)#c onfig-register 0x2102
保存当前配置到startup-config , 重新启动路由器。
router #copy running-config startup-config
router #reload

11:路由器telnet远程登录设置:
router>en
router #c onfigure terminal
router (conf)#hostname routerA
routerA (conf)#enable password cisco          以cisco为特权模式密码
routerA (conf)#interface fastethernet 0/1        以17端口为telnet远程登录端口
routerA (conf-if)#ip address 192.168.1.1 255.255.255.0
routerA (conf-if)#no shut
routerA (conf-if)#exit
routerA (conf)line vty 0 4                   设置0-4 个用户可以telnet远程登陆
routerA (conf-line)#login
routerA (conf-line)#password edge            以edge为远程登录的用户密码
主机设置:
ip         192.168.1.2               主机的ip必须和交换机端口的地址在同一网络段
netmask    255.255.255.0
gate-way   192.168.1.1               网关地址是交换机端口地址
运行:
telnet 192.168.1.1
进入telnet远程登录界面
password : edge               
routera>en
password: cisco
routera#

12:配置路由器的标识   banner $……………$
在全局配置的模式下利用“banner”命令可以配置路由器的提示信息,所有连接到路由器的终端都会收到。
router>en
router #c onfigure terminal
router (conf)#hostname routerA
routerA(conf)#banner motd $This is aptech company’  router ! Please don’t change the configuration without permission!$

13:配置接口标识     description ………
接口标识用于区分路由器的各个接口。
router>en
router #c onfigure terminal
router (conf)#hostname routerA
routerA(conf)#interface fastethernet 0/1      以0/1 接口为例
routerA(conf-if)# description this is a fast Ethernet port used to connecting the company’s intranet!        

14:配置超时  
超时适用于设置在多长时间没有对console进行配置,自动返回exec会话时间。默认为10分钟。
router>en
router #c onfigure terminal
router (conf)#hostname routerA
routerA(conf)#line console 0
routerA(conf-if)#e xec-timeout 0 0             第一个“0”代表分钟,第二个“0”代表秒

15:配置串口参数  
两台路由器通过串口连接需要一个做为DTE,一个做为DCE。DCE设备要向DTE设备提供时钟频率和带宽。
DCE配置:
router>en
router #c onfigure terminal
router (conf)#hostname routerA
routerA(conf)#interface serial 0/0
routerA(conf_if)#clock rate 64000           提供时钟频率为64000
routerA(conf_if)#bandwidth 64             提供带宽为64
DTE配置:路由器串口配置ip地址
router>en
router #c onfigure terminal
router (conf)#hostname routerB
routerB(conf)#interface serial 0/0
routerB(conf_if)#ip address 192.168.1.1 255.255.255.0

16:静态路由的配置
配置路由器A的主机名和接口参数
router>enable
router#c onfigure terminal
router(conf)#hostname routerA
routerA(conf)#interface fastethernet 0/1           路由器A的1端口为两路由器的连接端口
routerA(conf-if)#ip address 192.168.2.1 255.255.255.0
routerA(conf-if)#no shutdown
routerA(conf-if)#exit
routerA(conf)# interface fastethernet 0/0          路由器A的0端口为与主机的连接端口
routerA(conf-if)#ip address 192.168.1.2 255.255.255.0
routerA(conf-if)#no shutdown
主机A的ip地址为 192.168.1.1
255.255.255.0
192.168.1.2
配置路由器B的主机名和接口参数
router>enable
router#c onfigure terminal
router(conf)#hostname routerB
routerB(conf)#interface fastethernet 0/0           路由器B的0端口为两路由器的连接端口
routerB(conf-if)#ip address 192.168.2.2 255.255.255.0
routerB(conf-if)#no shutdown
routerB (conf-if)#exit
routerB(conf)# interface fastethernet 0/1           路由器B的1端口为与主机的连接端口
routerB(conf-if)#ip address 192.168.3.1 255.255.255.0
主机B的ip地址为 192.168.3.2
255.255.255.0
192.168.3.1

配置路由器A的静态路由表
routerA(conf)#ip router 192.168.3.0  255.255.255.0  192.168.2.2
配置路由器B的静态路由表
routerA(conf)#ip router 192.168.1.0  255.255.255.0  192.168.2.1

在routerA和routerB上配置默认路由
routerA(conf)#ip route 0.0.0.0 0.0.0.0 192.168.2.2
routerA(conf)#ip classless
routerB(conf)#ip route 0.0.0.0 0.0.0.0 192.168.2.1
routerB(conf)#ip classless

在routerA和routerB上配置动态路由(RIP)
routerA(conf)#router rip
routerA(conf)#network 192.168.1.0
routerA(conf)#network 192.168.2.0
routerB(conf)# router rip
routerB(conf)#network 192.168.2.0
routerB(conf)#network 192.168.3.0



2. 路由器支持的命令:
路由器显示命令:
router#show run ;显示配置信息
router#show interface ;显示接口信息
router#show ip route ;显示路由信息
router#show cdp nei ;显示邻居信息
router#reload ;重新起动
路由器口令设置:
router>enable ;进入特权模式
router#config terminal ;进入全局配置模式
router(config)#hostname ;设置交换机的主机名
router(config)#enable secret xxx ;设置特权加密口令
router(config)#enable password xxb ;设置特权非密口令
router(config)#line console 0 ;进入控制台口
router(config-line)#line vty 0 4 ;进入虚拟终端
router(config-line)#login ;要求口令验证
router(config-line)#password xx ;设置登录口令xx
router(config)#(Ctrl+z) ;
返回特权模式
router#exit ;返回命令
路由器配置:
router(config)#int s0/0 ;进入Serail接口
router(config-if)#no shutdown ;激活当前接口
router(config-if)#clock rate 64000 ;设置同步时钟
router(config-if)#ip address ;设置IP地址
router(config-if)#ip address second ;设置第二个IP
router(config-if)#int f0/0.1 ;进入子接口
router(config-subif.1)#ip address ;设置子接口IP
router(config-subif.1)#encapsulation dot1q ;绑定vlan中继协议
router(config)#config-register 0x2142 ;跳过配置文件
router(config)#config-register 0x2102 ;正常使用配置文件
router#reload ;重新引导
路由器文件操作:
router#copy running-config startup-config ;保存配置
router#copy running-config tftp ;保存配置到tftp
router#copy startup-config tftp ;开机配置存到tftp
router#copy tftp flash: ;下传文件到flash
router#copy tftp startup-config ;下载配置文件

ROM状态:
Ctrl+Break ;进入ROM监控状态
rommon>confreg 0x2142 ;跳过配置文件
rommon>confreg 0x2102 ;恢复配置文件
rommon>reset ;重新引导
rommon>copy xmodem: flash: ;从console传输文件

rommon>IP_ADDRESS=10.65.1.2 ;设置路由器IP
rommon>IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码
rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服务器IP
rommon>TFTP_FILE=c2600.bin ;指定下载的文件
rommon>tftpdnld ;从tftp下载
rommon>dir flash: ;查看闪存内容
rommon>boot ;引导IOS

静态路由:
ip route ;命令格式
router(config)#ip route 2.0.0.0 255.0.0.0 1.1.1.2 ;静态路由举例
router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 ;默认路由举例
动态路由:
router(config)#ip routing ;启动路由转发
router(config)#router rip ;启动RIP路由协议。
router(config-router)#network ;设置发布路由
router(config-router)#negihbor ;点对点帧中继用。
帧中继命令:
router(config)#frame-relay switching ;使能帧中继交换
router(config-s0)#encapsulation frame-relay ;使能帧中继
router(config-s0)#fram-relay lmi-type cisco ;设置管理类型
router(config-s0)#frame-relay intf-type DCE ;设置为DCE
router(config-s0)#frame-relay dlci 16 ;
router(config-s0)#frame-relay local-dlci 20 ;设置虚电路号
router(config-s0)#frame-relay interface-dlci 16 ;
router(config)#log-adjacency-changes ;记录邻接变化
router(config)#int s0/0.1 point-to-point ;设置子接口点对点
router#show frame pvc ;显示永久虚电路
router#show frame map ;显示映射
基本访问控制列表:
router(config)#access-list permit|deny
router(config)#interface ;default:deny any
router(config-if)#ip access-group in|out ;defaultut

例1:
router(config)#access-list 4 permit 10.8.1.1
router(config)#access-list 4 deny 10.8.1.0 0.0.0.255
router(config)#access-list 4 permit 10.8.0.0 0.0.255.255
router(config)#access-list 4 deny 10.0.0.0 0.255.255.255
router(config)#access-list 4 permit any
router(config)#int f0/0
router(config-if)#ip access-group 4 in

扩展访问控制列表:
access-list permit|deny icmp [type]
access-list permit|deny tcp [port]
例3:
router(config)#access-list 101 deny icmp any 10.64.0.2 0.0.0.0 echo
router(config)#access-list 101 permit ip any any
router(config)#int s0/0
router(config-if)#ip access-group 101 in
例3:
router(config)#access-list 102 deny tcp any 10.65.0.2 0.0.0.0 eq 80
router(config)#access-list 102 permit ip any any
router(config)#interface s0/1
router(config-if)#ip access-group 102 out

删除访问控制例表:
router(config)#no access-list 102
router(config-if)#no ip access-group 101 in

路由器的nat配置
Router(config-if)#ip nat inside ;当前接口指定为内部接口
Router(config-if)#ip nat outside ;当前接口指定为外部接口
Router(config)#ip nat inside source static [p] [port]
Router(config)#ip nat inside source static 10.65.1.2 60.1.1.1
Router(config)#ip nat inside source static tcp 10.65.1.3 80 60.1.1.1 80
Router(config)#ip nat pool p1 60.1.1.1 60.1.1.20 255.255.255.0
Router(config)#ip nat inside source list 1 pool p1
Router(config)#ip nat inside destination list 2 pool p2
Router(config)#ip nat inside source list 2 interface s0/0 overload
Router(config)#ip nat pool p2 10.65.1.2 10.65.1.4 255.255.255.0 type rotary
Router#show ip nat translation
rotary 参数是轮流的意思,地址池中的IP轮流与NAT分配的地址匹配。
overload参数用于PAT 将内部IP映射到一个公网IP不同的端口上。
外部网关协议配置
routerA(config)#router bgp 100
routerA(config-router)#network 19.0.0.0
routerA(config-router)#neighbor 8.1.1.2 remote-as 200

配置PPP验证:
RouterA(config)#username password
RouterA(config)#int s0
RouterA(config-if)#ppp authentication {chap|pap}


3.PIX防火墙命令
Pix525(config)#nameif ethernet0 outside security0 ;命名接口和级别
Pix525(config)#interface ethernet0 auto ;设置接口方式
Pix525(config)#interface ethernet1 100full ;设置接口方式
Pix525(config)#interface ethernet1 100full shutdown
Pix525(config)#ip address inside 192.168.0.1 255.255.255.0
Pix525(config)#ip address outside 133.0.0.1 255.255.255.252

Pix525(config)#global (if_name) natid ip-ip ;定义公网IP区间
Pix525(config)#global (outside) 1 7.0.0.1-7.0.0.15 ;例句
Pix525(config)#global (outside) 1 133.0.0.1 ;例句
Pix525(config)#no global (outside) 1 133.0.0.1 ;去掉设置

Pix525(config)#nat (if_name) nat_id local_ip [netmark]
Pix525(config)#nat (inside) 1 0 0
内网所有主机(0代表0.0.0.0)可以访问global 1指定的外网。
Pix525(config)#nat (inside) 1 172.16.5.0 255.255.0.0
内网172.16.5.0/16网段的主机可以访问global 1指定的外网。

Pix525(config)#route if_name 0 0 gateway_ip [metric] ;命令格式
Pix525(config)#route outside 0 0 133.0.0.1 1 ;例句
Pix525(config)#route inside 10.1.0.0 255.255.0.0 10.8.0.1 1 ;例句

Pix525(config)#static (inside, outside) 133.0.0.1 192.168.0.8
表示内部ip地址192.168.0.8,访问外部时被翻译成133.0.0.1全局地址。

Pix525(config)#static (dmz, outside) 133.0.0.1 172.16.0.8
中间区域ip地址172.16.0.8,访问外部时被翻译成133.0.0.1全局地址。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多