天天看點

Cisco 常用命名

一、常用指令

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

----------------------------------------

書山有路勤為徑,學海無涯苦作舟!

[永不放棄對技術的追求]

---------------------------------------------------

繼續閱讀