Cisco 常用命名

来源:互联网 发布:java强引用和弱引用 编辑:程序博客网 时间:2024/05/18 03:21


一、常用命令
1. 几种模式
用户模式 //提示符为 “ >”
特权模式 //在用户模式下输入 enable 提示符为 “#”
全局配置模式 //在特权模式下输入 conf t 提示符为“(config)#”
接口配置模式 //在全局配置模式下输入 int s0 提示符为“(config-if)#”
控制台模式 // 在全局配置模式下输入 line con 0 提示符为“(config-line)#”
虚拟访问端口模式 //在配置模式下输入line vty 0 4 提示符为“ (config-line)#”
2. 进入一个路由器之后要做的几件重要的事情:
1)重启路由器(清空以前别人留下的配置,防止它影响你的配置的效果):
方法:
第一步:在全局配置模式下:config-register 2142 (使路由器重启后不读取配置)
第二步:在特权模式下输入:reload
第三步:在路由器启动之后问你是否要进行预配置的时候写:no(跳过繁琐且没有必要的预配置过程)
2)给路由器取个名字(如同人名字一样,方便别人与你交流):
方法:在配置模式下输入:hostname R1或者hostname R2 或者 hostname R3
注意事项:为了以后大家做试验的规律性,以后大家给路由器取名字的时候请一律都使用一个R和一个数字搭配!!!
3) 关掉域名解析(防止无意中敲入一些路由器不认识的字符串时被路由器当成域名来解析,这会让你白等一段时间):
方法:在配置模式下输入:no ip domain-look
4) 使输入命令同步(防止在你输入命令的时候被系统的信息打断又要重新输入):
方法:在控制台模式下输入:logging synchronous
5)设置控制台永不超时(防止一段时间不输入命令,路由器会中断你的连接)
方法: 在控制台模式下:exec-timeout 0 0
3.路由器各种密码的设置
1)控制台密码
全局配置模式:
line con 0
login
pass cisco
2)虚拟终端密码
全局配置模式:
Line vty 0 4
Login
Pass cisco
3)特权模式密码 (两种设置方法,明文的和加密的,两种都设置则加密的将会覆盖明文的)
3.1 明文密码
全局配置模式:
enable password cisco
3.2 加密密码
全局配置模式下:
Enable secret cisco
4. 如何给接口配置ip地址
enable
conf t
int s0
ip add 10.1.1.1 255.255.255.0
no shutdown //打开端口,不要忘记!
exit //退出到上一级,在这儿就是从接口配置模式退出到全局配置模式
5. 如何访问对端的设备:例如如果R2想访问R1
第一步:配置好R1和R2,使它们相互之间能ping通!
第二步:在被访问的路由器(R1)的所有vty接口上配置密码,并设置容许进入
line vty 0 4
login //容许进入
pass cisco
第三步:在R2上telnet R1连接R2的物理口的地址。
例如:如果R1是用s0口连接R2的,ip地址是10.1.12.1,那么此时在R2上可以使用:
telnet 10.1.12.1 来访问R1。
小技巧:可以使用路由器的名字来代替ip地址来访问别的路由器。例如上例中,你可以在R2上的全局配置模式下输入: ip host R1 10.1.12.1,那么你以后就可以用telnet R1来访问R1了。
6. 如何得知谁连接到你的路由器上以及如何踢掉他
得知的方法:在特权模式下输入:show users 或者 who
踢掉的方法: 在特权模式下输入:cline line 11(这个11是电路号,具体根据show出来的结果而定)
7. 如何得知你连接的其他设备以及如何断开连接
得知的方法:在特权模式下输入:show sessions 或者 where
断开的方法:在特权模式下输入:disconnect
8. 一些常用的show命令
show version //显示路由器的版本信息
show running-config //显示整个路由器的配置
show run interface serial 0 // 显示端口s0的配置
show int serial 0 // 显示端口s0的状态
show contr serial 0 // 显示端口s0是DTE还是DCE
show cdp neighbor // 显示你连接了哪些邻居
show cdp entry * // 显示你连接的路由的具体信息
show cdp interface s0 // 显示你的s0口连接的邻居
二、试验
试验一:配置ip地址
试验目的:
1.熟悉路由器基础配置(命令参见”基础命令”)
2.配置并测试直连网络
3.访问邻居路由器(使用telnet命令,用法参见”基础命令”)
R1:
enable
conf t
hostname R1
no ip domain-look
enable password cisco
line con 0
logging synchronous
line vty 0 4
password cisco
login
interface s0
ip add 10.1.12.1 255.255.255.0
no shutdown
测试连通性: ping 10.1.12.2
访问直连设备: telnet 10.1.12.2
R2:
enable
conf t
hostname R2
no ip domain-look
line con 0
logging synchronous
enable password cisco
int s0
clock rate 64000
ip add 10.1.12.2 255.255.255.0
no shutdown
int s1
clock rate 64000
ip add 10.2.23.2 255.255.255.0
no shutdown
line vty 0 4
password cisco
login
访问直连设备: telnet 10.1.12.1 or telnet 10.2.23.3
R3:
enable
conf t
hostname R3
no ip domain-look
line con 0
logging synchronous
enable password cisco
interface s0
ip add 10.2.23.3 255.255.255.0
no shutdown
line vty 0 4
password cisco
login
访问直连设备: telnet 10.2.23.2

1900:
第一步:启用vtp
全局配置模式下:
vtp server
vtp domain CCNA
校验命令:sh vtp


第二步:封装trunk
interface f0/26
trunk on
校验命令:Sh trunk a


第三步:建立vlan
全局配置模式下:
vlan 10 name VLAN_A
vlan 20 name VLAN_B
校验命令:sh vlan



第四步:加端口到vlan中
interface e0/1
vlan static 10
interface e0/2
vlan static 20
校验命令:sh vlan
2900:
第一步:启用vtp
特权模式下:
vlan database
vtp server
vtp domain CCNA
校验命令:sh vtp sta

第二步:封装trunk
interface f0/11
sw mode trunk
校验命令:sh int f0/11 sw


第三步:建立vlan
特权模式下:
vlan database
vlan 10 name VLAN_A
vlan 20 name VLAN_B
exit
校验命令:sh vlan b

第四步:加端口到vlan中
interface f0/1
sw mode access
sw access vlan 10
interface f0/2
sw mode access
sw access vlan 20
校验命令:sh vlan b
3550:
第一步:启用vtp
特权模式下:
vlan database
vtp server
vtp domain CCNA
校验命令:sh vtp st

第二步:封装trunk
interface f0/23
sw trunk encapsulation isl
sw mode trunk
校验命令:sh int trunk

第三步:建立vlan
特权模式下:
vlan database
vlan 10 name VLAN_A
vlan 20 name VLAN_B
exit
校验命令:sh vlan b

第四步:加端口到vlan中
interface f0/1
sw mode access
sw access vlan 10
interface f0/2
sw mode access
sw access vlan 20
校验命令:sh vlan b
试验二:交换机配置
3550 1900 1900 2900 1900 1900
14sw1-------14sw2 16sw1--------16sw2 23sw1---------23sw2
f0/23 f0/26 f0/26 f0/11 f0/26 f0/26
试验目的:
1. 配置vtp、trunk、vlan并验证
2. 端口加入vlan 测试同一vlan的设备的连通性

试验三:静态路由
e0 s0 s0 s1 s0 e0
|-------------R1-----------------------R2-------------------------R3---------------|
172.16.1.0/24 10.1.12.0/24 10.2.23.0/24 192.168.3.0/24
1. 把基础配置做完(即同一网段中路由器相互之间能够ping通),见试验一;
2.为了使每个路由器都能学到所有网段,每个路由器都要加静态路由;
R1:
Int loopback0
Ip add 1.1.1.1 255.255.255.0
ip route 10.2.23.0 255.255.255.0 10.1.12.2
ip route 192.168.3.0 255.255.255.0 10.1.12.2
ip route 2.2.2.0 255.255.255.0 10.1.12.2
ip route 3.3.3.0 255.255.255.0 10.1.12.2

R2:
Int loopback0
Ip add 2.2.2.2 255.255.255.0
ip route 172.16.1.0 255.255.255.0 10.1.12.1
ip route 192.168.3.0 255.255.255.0 10.2.23.3
ip route 1.1.1.0 255.255.255.0 10.1.12.1
ip route 3.3.3.0 255.255.255.0 10.2.23.3

R3:
Int loopback0
Ip add 3.3.3.3 255.255.255.0
ip route 10.1.12.0 255.255.255.0 10.2.23.2
ip route 172.16.1.0 255.255.255.0 10.2.23.2
ip route 1.1.1.0 255.255.255.0 10.2.23.2
ip route 2.2.2.0 255.255.255.0 10.2.23.2
试验四:协议配置
1. RIPv2:
R1:
全局配置模式下:
router rip
network 10.0.0.0
network 172.16.0.0
R2:
全局配置模式下:
router rip
network 10.0.0.0
R3:
全局配置模式下:
router rip
network 10.0.0.0
network 192.168.3.0
//校验命令:show ip protocol , show ip route , debug ip rip
2. IGRP:
R1:
全局配置模式下:
router igrp 100
network 10.0.0.0
network 172.16.0.0
R2:
全局配置模式下:
router igrp 100
network 10.0.0.0
R3:
全局配置模式下:
router igrp 100
network 10.0.0.0
network 192.168.3.0
//校验命令:show ip protocol , show ip route ,debug ip igrp ?
3.EIGRP:
R1:
全局配置模式下:
router eigrp 100
network 10.1.12.0 0.0.0.255
network 172.16.1.0 0.0.0.255
R2:
全局配置模式下:
router eigrp 100
network 10.1.12.0 0.0.0.255
network 10.2.23.0 0.0.0.255
R3:
全局配置模式下:
router eigrp 100
network 10.2.23.0 0.0.0.255
network 192.168.3.0 0.0.0.255
//校验命令: show ip eigrp neighbors, Show ip eigrp topology ,Show ip route eigrp
Show ip protocols, Show ip eigrp traffic, Debug ip eigrp
4. OSPF:
R1:
全局配置模式下:
Int loopback 0
Ip add 1.1.1.1 255.255.255.0
router ospf 100
router-id 1.1.1.1
network 1.1.1.1 0.0.0.0 area 0
network 10.1.12.1 0.0.0.0 area 0
network 172.16.1.1 0.0.0.0 area 0
R2:
全局配置模式下:
Int loopback 0
Ip add 2.2.2.2 255.255.255.0
router ospf 100
router-id 2.2.2.2
network 2.2.2.2 0.0.0.0 area 0
network 10.1.12.2 0.0.0.0 area 0
network 10.2.23.2 0.0.0.0 area 0
R3:
全局配置模式下:
Int loopback 0
Ip add 3.3.3.3 255.255.255.0
router ospf 100
router-id 3.3.3.3
network 3.3.3.3 0.0.0.0 area 0
network 10.2.23.3 0.0.0.0 area 0
network 192.168.3.3 0.0.0.0 area 0
//校验命令:show ip protocol , Show ip route ,Show ip ospf neighbor , Show ip ospf interface, Debug ip ospf events, Debug ip ospf packet
试验五:访问列表配置
172.16.1.0/24 10.1.12.0/24 10.2.23.0/24 192.168.3.0/24
|------------------------------R1------------------------------R2--------------------------R3-------------------|
E0 s0 s0 s1 s0 e0
配好RIP后,保证每个路由器都能ping通四个网段:
1. 标准访问列表:
R2:全局配置模式下:
access-list 1 deny 10.1.12.0 0.0.0.255
access-list 1 permit any
interface s1
ip access-group 1 out
测试:
R1: ping 192.168.3.3
U.U.U//不可达!
R2: show ip access-list
2. 扩展访问列表:
R1:
access-list 101 deny icmp 10.1.12.0 0.0.0.255 host 172.16.1.1
access-list 101 permit ip any any
interface s0
ip access-group 101 in
测试: R2#ping 172.16.1.1
U.U.U//不可达!去方向的包被R1扔掉!
R3#ping 172.16.1.1
!!!!!
R1 : show ip access-list
3. 命名访问列表:
R3:
ip access-list extended ccna
deny ip 10.1.12.0 0.0.0.255 host 192.168.3.3
permit ip any any
interface s0
ip access-group ccna in
测试: R1#ping 192.168.3.3
U.U.U //不可达!去方向的包被R3扔掉!
R2#ping 192.168.3.3
!!!!!
R3 : show ip access-list
试验六: NAT
E0 s0 s0 s1 s0 e0
|--------------------R1---------------------------------------R2-------------------------R3---------------------|
172.16.1.0/24 10.1.12.0/24 10.2.23.0/24 192.168.3.0/24
R1:
access-list 1 permit 172.16.1.0 0.0.0.255
ip ant pool ccna1 10.1.12.3 10.1.12.254 netmask 255.255.255.0
ip nat inside source list 1 pool ccna1
int e0
ip add 172.16.1.1 255.255.255.0
ip nat inside
no sh
int s0
ip add 10.1.12.1 255.255.255.0
ip nat outsie
no sh
router rip
network 10.0.0.0
network 172.16.0.0
测试:
使用扩展ping ,指定172.16.1.1为源,ping R1右边的网络
sh ip nat translations
clear ip nat trans *
R2:
access-list 1 permit 10.1.12.0 0.0.0.255
ip nat pool ccna2 10.2.23.4 10.2.23.254 netmask 255.255.255.0
ip nat inside source list 1 pool ccna2
interface serial 0
ip add 10.1.12.2 255.255.255.0
ip nat inside
exit
interface serial 1
ip add 10.2.23.2 255.255.255.0
ip nat outside
exit
router rip
net 10.0.0.0
测试:
使用扩展ping,以10.1.12.2为源,ping R2右边的网络
sh ip nat translations
clear ip nat trans *

R3:
access-list 1 permit 192.168.3.0 0.0.0.255
ip ant pool ccna3 10.2.23.4 10.2.23..254 netmask 255.255.255.0
ip nat inside source list 1 pool ccna3
interface serial 0
ip add 10.2.23.3 255.255.255.0
ip nat outside
no sh
interface e0
ip add 192.168.3.3 255.255.255.0
ip nat inside
no sh
router rip
net 192.168.3.0
net 10.0.0.0
测试:
使用扩展ping,指定192.168.3.3 为源,ping R3 左边的网络
sh ip nat translations
clear ip nat trans *
试验七:PPP封装
R1:
enable
conf t
hostname R1
username R2 password cisco
interface Serial0
ip address 10.1.12.1 255.255.255.0
encapsulation ppp
ppp authentication chap
no shutdown
校验命令:ping 10.1.12.2 , debug ppp authentication
R2:
enable
conf term
hostname R2
username R1 password cisco
username R3 password cisco
interface Serial 0
cl ra 64000
ip address 10.1.12.2 255.255.255.0
encapsulation ppp
ppp authentication chap
no shutdown
Interface serial 1
cl ra 64000
ip address 10.2.23.2 255.255.255.0
encapsulation ppp
ppp authentication chap
no shutdown
校验命令:ping 10.1.12.1 , ping 10.2.23.3 , debug ppp authentication
R3:
enable
conf t
hostname R3
username R2 password cisco
interface Seria0
ip address 10.2.23.3 255.255.255.0
encapsulation ppp
ppp authentication chap
no shutdown
校验命令:ping 10.2.23.2 , debug ppp authentication
试验八:帧中继
E0 s0 s0(DCE) s1(DCE) s0 e0
|-------------------------R1-------------------------------------R2----------------------------R3----------------|
103 301
10.1.13.1/24 FR-SW 10.1.13.3/24
R1:
int s0
encapsulation frame-relay
ip add 10.1.13.1 255.255.255.0
frame-relay map ip 10.1.13.3 103 broadcast
no shutdown
R2:
frame-relay switching
int s0
encapsulation frame-relay
clockrate 64000
frame-relay intf-type dce
frame-relay route 103 interface Serial 1 301
no shutdown
int s1
encapsulation frame-relay
clockrate 64000
frame-relay intf-type dce
frame-relay route 301 interface Serial 0 103
no shutdown
R3:
int s0
ip add 10.1.13.3 255.255.255.0
encapsulation frame-relay
frame-relay map ip 10.1.13.1 301 broadcast
no shutdown
校验命令:
show frame-relay traffic
show interfaces s0
show frame-relay lmi
show frame-relay map
show frame-relay pvc 103 或者 show frame-relay pvc 301
注意:
Sh frame-relay map 验证三种状态:
Active , inactive, delete
ISDN试验:
bri0 192.168.35.0/24 bri0
.3 .5
|-------------------R3---------------------------------------------------------------------R5----------------------|

Rack15r1,Rack06r3,Rack05r3: Rack15r2,Rack06r5或Rack05r5:


Rack15r1,Rack06r3或Rack05r3:
1. 路由器基础配置:
conf t
hostname R3
no ip domain-lookup
line con 0
logging synchronous
exit
2. isdn基础配置:
isdn switch-type basic-net3 //设定交换机类型
dialer-list 1 protocol ip permit //定义能触发isdn拨号的敏感流量
interface bri0
ip address 192.168.35.3 255.255.255.0
dialer-group 1 //关联上面定义的触发拨号的敏感流量
dialer idle-timeout 60 //定义isdn起来后,没有敏感流量经过的情况下能持续的时间,默认120秒.
dialer map ip 192.168.35.5 name R5 broadcast 9002/5002/6002 //静态映射(指的是对方的ip,对方的路由器名,对方的isdn号码)
end
3. isdn认证配置:
username R5 pass cisco
int b0
en ppp //封装ppp
ppp au chap // 定义认证类型是md5加密的chap认证方式

Rack15r2,Rack06r5或Rack05r5:
1.路由器基础配置:
hostname R5
no ip domain-lookup
line con 0
logging synchronous
exit
2. isdn基础配置:
isdn switch-type basic-net3
dialer-list 1 protocol ip permit
interface bri0
ip address 192.168.35.5 255.255.255.0
dialer idle-timeout 60
dialer map ip 192.168.35.3 name R3 broadcast 9001/5001/6001
dialer-group 1
3.isdn认证配置:
username R3 pass cisco
int b0
en ppp
ppp au chap

测试命令:
ping 192.168.35.3 或者 ping 192.168.35.5
show isdn active
show dialer
show isdn status
----------------------------------------
书山有路勤为径,学海无涯苦作舟!
[永不放弃对技术的追求]
---------------------------------------------------
 
原创粉丝点击