思科模拟器命令
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1.计算机命令:
PCA logi n: root password: linux # shutdow n -h now # logout # logi n # ifconfig
;显示IP 地址
# ifconfig eth0 <ip address> netmask <netmask> ; 设置 IP 地址 # ifconfig eht0 <ip address> netmask <netmask> down ; 删除 IP 地址 # route add 0.0.0.0 gw <ip> # route del 0.0.0.0 gw <ip> # route add default gw <ip> # route del default gw <ip> # route
# pi ng <ip> # telnet <ip>
;使用root 用户 ;口令是 linux ;同init 0关机 ;设置网关 ;删除网关
显示网关
2.交换机支持的命令: 交换机基本状态: switch: rommon> 态
host name> host name#
host name(c on fig)# host name(c on fig-if)# ;交换机的ROM 状态 ;路由器的ROM 状
;用户模式 ;特权模式 ;全局配置模式
接口状态
交换机口令设置:
switch>e nable
switch#c onfig termi nal switch(c on fig)#host name <host name> switch(config)#enable secret xxx switch(config)#enable password xxa switch(c on fig)#li ne con sole 0 switch(c on fig-li ne)#li ne vty 0 4
switch(c on fig-li ne)#logi n switch(c on fig-li ne)#password xx switch#exit
进入特权模式
;进入全局配置模式 设置交换机的主机名 ;设置特权加密口令 ;设置特权非密口令 ;进入控制台口
进入虚拟终端 ;允许登录
设置登录口令xx ;返回命令
交换机VLAN 设置: switch#vla n
database switch(vla ;进入VLAN 设置 ;建 VLAN 2
3.路由器支持的命令: 路由器显示命令:
router#show run router#show in terface router#show ip route router#show cdp nei router#reload 路由器口令设置: router>e nable router#c onfig termi nal router(co nfig)#host name <host name> router(c on fig)#e nable secret xxx router(co nfig)#e nable password xxb router(co nfig)#li ne con sole 0 router(config-line)#line vty 0 4 router(co nfig-li ne)#log in router(config-line)#password xx switch(vla n)#no via n 2 switch(co nfig)#i nt fO/1 switch(c on fig-if)#switchport access via n 2 switch(con fig-if)#switchport mode trunk
switch(config-if)#switchport trunk allowed vlan 1,2 switch(c on fig-if)#switchport trunk en cap dot1q switch(config)#vtp domain <name> switch(c on fig)#vtp password <word> switch(c on fig)#vtp mode server switch(c on fig)#vtp mode clie nt
;删 vlan 2 ;进入端口 1
当前端口加入vlan 2 ;设置为干线
;设置允许的vlan ;设置vlan 中继
设置发vtp 域名 设
置发vtp 密码
;设置发vtp 模式 ;设置发vtp 模式
交换机设置IP 地址:
switch(c on fig)#i nterface vla n 1 switch(c on fig-if)#ip address <IP> <mask> ;进入vlan 1 ;设置IP 地址
;设置默认网关 switch#dir flash: ;查看闪存
交换机显示命令: switch#write switch#show vtp switch#show run switch#show vla n switch#show in
terface switch#show int f0/0
;保存配置信息 查看vtp 配置信息
;查看当前配置信息 查看vlan 配置信息 ;查看端口信息
查看指定端口信息
显示配置信息
;显示接口信息 显
示路由信息 显示邻居信息 重新起动 进入特权模式 ;进入全局配置模式 设置交换机的主机名
;设置特权加密口令 ;设置特权非密口令 ;进入控制台口
进入虚拟终端 ;要求口令验证 设置登录口令xx
router(config)#(Ctrl+z) router#exit ;返回特权模式;返回命令
路由器配置:
router(config)#int s0/0
router(config-if)#no shutdown router(config-
if)#clock rate 64000 router(config-if)#ip address <ip> <netmask> ;进入Serail 接口
;激活当前接口;设置时钟频率;设置IP 地址
router(config-if)#ip address <ip> <netmask> second ;设置第二个IP router(config-if)#int f0/0.1 ;进入子接口router(config-subif.1)#ip address <ip> <netmask> ;设置子接口IP
router(config-subif.1)#encapsulation dot1q <n> router(config)#config-register 0x2142
router(config)#config-register 0x2102
router#reload ;绑定vlan 中继协议;跳过配置文件
;正常使用配置文件
;重新引导
路由器文件操作:
router#copy running-config startup-config router#copy running-config tftp
router#copy startup-config tftp router#copy tftp flash:
;保存配置
;保存配置到tftp ;开机配置存到
tftp
;下传文件到flash
router#copy tftp startup-config ;下载配置文件ROM 状态:
Ctrl+Break rommon>confreg 0x2142 rommon>confreg 0x2102 rommon>reset ;进入ROM 监控状态;跳过配置文件;恢复配置文件;重新引导
rommon> copy xmodem:<s name> flash:<d name> ;从con sole 传输文件
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
rommon>dir flash:
;指定下载的文件;从tftp 下载
;查看闪存容
rommon>boot ;引导IOS
静态路由:
ip route <ip-address> <subnet-mask> <gateway> ;命令格式
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 router(config-router)#network <netid> router(config-router)#negihbor <ip>
帧中继命令: 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 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 <number> permit|deny
<source_ip> <wild|any> router(config)#interface <interface> ;default:deny any router(config-if)#ip access-group <number> in|out ;defaultut
例 1 : router(config)#access-list 1 deny host 10.65.1.1 router(config)#access-list 1 permit any router(config)#int f0/0 router(config-if)#ip access-group 4 in
例 2 : 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/1 router(config-if)#ip access-group 4 in
扩展访问控制列表: access-list <number> permit|deny icmp <S_IP wild> <D_IP wild>[type] access-list <number> permit|deny tcp <S_IP wild> <D_IP wild>[port] 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
例 2 : 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
;启动路由转发
;启动 RIP 路由协议。
;设置发布路由 ;点对点帧中继用。
;使能帧中继交换 ;使能帧中继 ;设置管理类型 ;设置为 DCE ;设置虚电路号 ;记录邻接变化
;设置子接口点对点
;显示永久虚电路
;显示映射
outside ;当前接口指定为外部接口Router(c on fig)#ip nat in side source static [p] <私有IP> < 公网IP> [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 <RouterB> password <word> RouterA(config)#int s0 RouterA(config-if)#ppp authentication {chap|pap} 4.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
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 全局地址
1. switch 配置命令 (1)模式转换命令
用户模式 特权模式 ,使用命令 "enable" 特权模式 - 全局配置模式 ,使用命令 "config t"
全局配置模式 接口模式 ,使用命令 "interface+ 接口类型 +接口号 " 全局配置模式一线控模式,使用命令"line+接口类型+接口号" 注: 用户模式 :查看初始化的信息 .
特权模式 :查看所有信息、调试、保存配置信息 全局模式:配置所有信息、针对整个路由器或交换机的所有接口 接口模式:针对某一个接口的配置 线控模式:对路由器进行控制的接口配置 (2)配置命令
show running config 显示所有的配置 show versin 显示版本号和寄存器值
shut down 关闭接口 no shutdown 打开接口
ip add +ip 地址 配置 IP 地址
sec on dary+IP 地址为接口配置第二个IP 地址 show interface+接 口类型+接口号 查看接口管理性 show controllers interface 查看接口是否有 DCE 电缆 show history 查
;定义公网 IP 区间 ;例句 ;例句
;去掉设置
看历史记录show terminal 查看终端记录大小
hostname+主机名配置路由器或交换机的标识config memory 修改保存在NVRAM 中的启动配置exec timeout 0 0 设置控制台会话超时为0 service password-encryptin 手工加密所有密码enable password +密码配置明文密码ena sec +密码配置密文密码line vty 0 4/15 进入telnet 接口password +密码配置tel net密码line aux 0 进入AUX 接口password +密码配置密码line con 0 进入CON 接口password +密码配置密码
bandwidth+数字配置带宽no ip address 删除已配置的IP 地址show startup config 查看NVRAM 中的配置信息copy run-config startup config 保存信息到NVRAM write 保存信息到NVRAM erase startup-config 清除NVRAM 中的配置信息show ip interface brief 查看接口的谪要信息banner motd # +信息+ # 配置路由器或交换机的描素信息description+信息配置接口听描素信息vlan database 进入VLAN 数据库模式vlan +vlan 号+ 名称创建VLAN switchport access vian +vlan号为VLAN 为配接口interface vlan +vlan 号进入VLAN 接口模式ip add +ip 地址为VLAN 配置管理IP 地址vtp+service/tracsparent/client 配置SW 的VTP 工作模式vtp +domain+域名配置SW的VTP域名vtp +password +密码配置SW 的密码switchport mode trunk 启用中继no vlan +vlan 号删除VLAN show spamming-tree vlan +vlan 号查看VLA 怕生成树议
2. 路由器配置命令ip route+非直连网段+子网掩码+下一跳地址配置静态/默认路由show ip route 查看路由表show protocols 显示出所有的被动路由协议和接口上哪些协议被设置show ip protocols 显示了被配置在路由器上的路由选择协议,同时给出了在路由
选择协议中使用
的定时器
等信息
router rip 激活RIP 协议
network +直连网段发布直连网段
interface lookback 0 激活逻辑接口passive-interface +接口类型+接口号配置接口为被动模式debug ip +协议动态查看路由更新信息undebug all 关闭所有DEBUG 信息
router eigrp +as号激活EIGRP路由协议
network +网段+子网掩码发布直连网段
show ip eigrp neighbors 查看邻居表show ip eigrp topology 查看拓扑表show ip eigrp traffic 查看发送包数量router ospf+process-ID 激活OSPF 协议network+直连网段+area+区域号发布直连网段show ip ospf 显示OSPF 的进程号和ROUTER-ID encapsulation+封装格式更改圭寸装格式no ip admain-lookup 关闭路由器的域名查找ip routing 在三层交换机上启用路由功能show user 查看SW 的在线用户clear line +线路号清除线路
3. 三层交换机配置命令配置一组二层端口configure terminal 进入配置状态nterface range {port-range} 进入组配置状态配置三层端口
configure terminal 进入配置状态
interface {{fastethernet | gigabitethernet} interface-id} | {vlan vlan-id} | {portchannel port-channel-number} 进入端口配置状态no switchport 把物理端口变成三层口
ip address ip_address subnet_mas配置IP 地址和掩码
no shutdown 激活端口例:
Switch(config)# interface gigabitethernet0/2 Switch(config-if)# no switchport
Switch(config-if)# ip address 192.20.135.21 255.255.255.0
Switch(config-if)# no shutdown
配置VLAN
configure terminal 进入配置状态
vlan vlan-id 输入一个VLAN 号, 然后进入vlan 配态,可以输入一个新的VLAN 号或旧的来进行修改。
name vlan-name 可选)输入一个VLAN 名,如果没有配置VLAN 名,缺省的名字是VLAN 号前面用0 填满
的 4 位数,如VLAN0004 是VLAN4 的缺省名字mtu mtu-size (可选) 改变MTU 大小
例
Switch# configure terminal Switch(config)# vlan 20 Switch(config-vlan)# name test20 Switch(config-vlan)# end 或
Switch# vlan database
Switch(vlan)# vlan 20 name test20
Switch(vlan)# exit 将端口分配给一个VLAN configure terminal 进入配置状态interface interface-id 进入要分配的端口switchport mode access 定义二层口switchport access vlan vlan-id 把端口分配给某一VLAN
例
Switch# configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)# interface fastethernet0/1 Switch(config-if)#
switchport mode access Switch(config-if)# switchport access vlan 2
Switch(config-if)# end Switch# 配置VLAN trunk configure terminal 进入配置状态interface interface-Id 进入端口配置状态switchport trunk encapsulation {isl | dotlq | negotiate}酉己置trunk 圭寸装ISL 或802.1Q 或自动协商switchport mode {dynamic {auto | desirable} | trunk} 配置二层trunk 模式。
dynamic auto—自动协商是否成为trunk
dynamic desirable—把端口设置为trunk 女口果对方端口是trunk, desirable,配置Native VLAN
( 802.1q)
或自动模式,trunk—设置端口为强制的trunk方式,而不理会对方端口是否为trunk switchport access vlan vlan-id 可选) 指定一个缺省VLAN, 如果此端口不再是trunk switchport trunk native vlan vlan-id 指定802.1Q native VLAN 号
例:
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# interface fastethernet0/4
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)# end 定义 TRUNK 允许的 VLAN configure terminal 子 进入配置状态 interface interface-id 进入端口配置 switchport mode trunk 配置二层口为 trunk switchport trunk allowed vlan {add | all | except | remove} vlan-list 可选 ) 配置 trunk 允
许的 VLAN.使用 add, all, except, remove 关健字 no switchport trunk allowed vlan 允许所有 VLAN 通过
例
Switch(config)# interface fastethernet0/1
Switch(config-if)# switchport trunk allowed vlan remove 2 Switch(config-if)# end 配置 Native VLAN (802.1q ) configure terminal 进入配置状态
interface interface-id 进入配置成 802.1qtrunk 的端口 switchport trunk native vlan vlan-Id 配置 native VLAN 号
no switchport trunk native vlan 端口配置命令回到缺省的状态 配置基于端口权值的负载均衡
configure terminal 进入 Switch 1 配置状态 vtp domain domain-name 配置 VTP 域
vtp mode server 将 Switch 1 配置成 VTP server. show vtp status 验证 VTP 的配置 show vlan 验证 VLAN
configure terminal 进入配置状态 interface fastethernet 0/1 进入 F0/1 端口
switchport trunk encapsulation {isl | dotlq | negotiate}配置 trunk 圭寸装 switchport mode trunk 配置成 trunk
show in terfaces fastethernetO/1 switchport 验证 VLAN 配置 按以上步骤对想要负载均衡的接口进行配置 在另一个交换机上进行此配置
show vlan 当 trunk 已经起来,在 switch2 上验证已经学到相的 vlan 配置 configure terminal 在 Switch 1 上进入配置状态
interface fastethernetO/1 进入要配置的端口
spanning-tree vlan 8 port-priority 1O 将端口权值 1O 赋与 VLAN 8. spanning-tree vlan 9 port-priority 1O 将端口权值 1O 赋与 VLAN 9. spanning-tree vlan 10 port-priority 10 将端口权值 10 赋与 VLAN 10. interface fastethernetO/2 进入 FO/2 spanning-tree vlan 3 port-priority 10 将端口权值
spanning-tree vlan 4 port-priority 10 将端口权值 10 赋与 VLAN 4
spanning-tree vlan 5 port-priority 10 将端口权值 10 赋与 VLAN 5 spanning-tree vlan 6 port-priority 10 将端口权值 end 退出 show running-config 验证配置
copy running-config startup-config 保存配置
10 赋与 VLAN 3. 10 赋与 VLAN 10
配置STP 路径值的负载均衡
Trunkl 走VLAN8 —10, Trunk2 走VLAN2 —4
configure terminal 进入Switch 1 配置状态interface fastethernet 0/1 进入F0/1 switchport trunk en capsulati on {isl | dotlq | n egotiate}!己置圭寸装
switchport mode trunk 配置Trunk,缺省是ISL 圭寸装
exit 退回
在F0/2 口上重复2— 4 步骤
exit 退回
show running-config 验证配置
show vlan 验证switch1 已经学到Vlan configure terminal 进入配置状态interface fastethernet 0/1 进入F0/1 spanning-tree vlan 2 cost 30 设置Vlan2 生成树路径值为30 spanning-tree vlan 3 cost 30 设置Vlan3 生成树路径值为30 spanning-tree vlan 4 cost 30 设置Vlan4 生成树路径值为30 end 退出
在switch1的FO/2上重复9—11步骤设置VLAN8,9 , 10生成树路径值为30 end
退出
show running-config 验证配置
copy running-config startup-config 保存配置
补充:CISCO命令集——路由选择协议及排障
*ip route 命令
Router(config)# ip route <目录网络或子网号> [子网掩码] <下一路由器IP 地址| 从本地出口
的地址> [ 管理距离0~255,默认为1]
(注:静态地址配置)
*ip default-network 命令
Router(config)# ip default-network <目标网络号> (注:配合路由协使用,用其中的一个动态路由号作默认路由配置)
Router(c on fig)# ip route 0.0.0.0 0.0.0.0 <下一路由器IP 地址| 从本地出口的地址> (注:只有一个公网地址时,在出口路由器上的配置)
*部路由选择协议
*使用router 和network 命令
Router(c on fig)# router < 路由协议rip | igrp | eigrp | ospf | is-is 等> [自主系统号] Router(config-router)# network <直接相连的要用此路由协议的网络号>
Router(config-router)# network <直接相连的要用此路由协议的网络号> *路由信息协议RIP
Router(config)# router rip
Router(config-router)# network <直接相连的要用rip 协议的有类别网络号> Router# show ip protocols
Router# show ip route
Router# debug ip rip
* 部网关路由协议IGRP
Router(config)# router igrp <自主系统号>
Router(config-router)# network <直接相连的要用igrp 协议的有类别网络号> Router# show ip interface
Router# show ip protocols
Router# show ip route
Router# debug ip rip
*排除网络故障排除网络故障的一个总体模型
Router# ping <有故障的主机| 有故障的IP 地址>
Router# show ip route
Router# show interface <有故障的接口>
Router# show run
*IP 的故故障排除检查可用的路由
Router# show ip route <有故障的IP 地址>
27.4.4 跟踪路由(Tracing the Route)
SUN-A> traceroute <有故障的主机| 有故障的IP 地址>
C:\windows\> winipcfg
C:\windows\> ipconfig
C:\windows\> ipconfig / all
C:\windows\> tracert <有故障的主机| 有故障的IP 地址>
使用扩展的ping 来跟踪连接性
Router# ping
*其它可能的故障
一个地址解析(ARP)的故障
Router# show arp
Router# show interface <有故障的接口>
C:\windows\> arp -a
SUN-A> arp —
验证终端系统的路由表
C:\wi ndows\> n etstat -n
C:\windows\> route - add 0.0.0.0 mask 0.0.0.0 需要添加入的网关地址>
C:\windows\> route [ -] [[print | add | delete | change] [destination] [mask netmask] [gateway]]
C:\windows\> route add mask <网络掩码> <网关ip 地址>
C:\windows\> route delete mask <网络掩码> <网关ip 地址>
C:\windows\> nbtstat <相应的参数>
SUN-A> netstat -rn 路由器。