CCNA配置命令大全

1、 進入SETUP模式Router#setup
 
2、 時間設置 router#clock set hh:mm:ss date moth year
 
3、 router>show history

Router>terminal history size lines 
 
4、 router#show version
 
5、 router#show running-config

6、 router#show starup-config
 
7、 router(config)#hostname name 主機命名
 
8、 router(config)#banner motd # message # 開機時的固定顯示信息 
 

9、 router(config)#enable password password 特權模式明文密碼
 
10、 router(config)#no enable password

11、 router(config)#enable secret password 特權模式加密密碼

12、 router(config)#no enable secret

13、 router(config)#service password-encryption特權模式把明文密碼加密密碼,但沒     enable secret安全可以反解

14、 router(config)#line console控制檯密碼
 
15、 router(config-line)#login

16、 router(config-line)#password password

17、 router(config-line)#exec-timeout mm ss 禁止控制檯會話自動退出
 
18、 router(config-line)#logging synchronous重顯被打亂的控制檯輸入

router(config)#no ip domain-lookup 禁止域名解析
 
19、 router(config)#line vty 0 4虛擬終端密碼
 
20、 router(config-line)#login

21、 router(config-line)#password password
 
22、 router(config)#interface type number(slot/port)端口設置

23、 router(config-if)#ip address ip summast

24、 router(config-if)#clock rate 64000(時鐘頻率單位爲bps,只在DCE端設置)

25、 router(config-if)#bandwith 64(帶寬設置,單位爲KB)

26、 router(config-if)#no shutdown(shutdown)

27、 router(config-if )#media-type type(10base) 爲以太網端口選擇適當的介質類


28、 router(config-if )#ctrl+z保存退出到特權模式

29、 router#
 
30、 router>用戶模式enable進入

router#特權模式config terminal進入

router(config)#全局配置模式
 
31、

Interface  Router(config-if)#端口設置

Subinterface Router(config-subif)# 子端口設置

Controller  Router(config-controller)# 控制口設置

Line     Router(config-line)# 虛擬口設置

Router     Router(config-router)# 路由設置

IPX router Router(config-ipx-router)#IPX路由設置
 
32、 router#show interface

33、 router#show interface Ethernet 0

34、 router#show interface serial 0

35、 router#show running-config

36、 router#show starup-config

37、 router#show flash

38、 router#show controller

39、 router#show controller interface type

40、 router#show running-config

router#copy running-config starup-config

router#copy running-config tftp

router#copy starup-config tftp

router#copy flash tftp

router#copy tftp star-config

router#copy tftp flash
 
 

端口狀態
 
Serial1 is up, line protocol is up正常工作

Serial1 is up, line protocol is down連接問題

Serial1 is down, line protocol is down端口問題

Serial1 is administratively down, line protocol is down人爲關閉
 
 
配置寄存器的值

1、 關閉路由器的電源重新啓動按住ctrl+break鍵入進

  2、 >

3、 >o/r 0x2142(跳過nvarm啓動恢復密碼)

4、 >I

5、 當系統提示是否進入setup模式時,按N

6、 router>

7、 router>enable

8、 router#

9、進入修改後(包括密碼、寄存器的值:0x2100爲rom monitor啓動、0x2101爲setup模式啓動、0x2102爲

10、 router#copy running-config starup-config

11、 router#reload

12、 也可以在router#setup進入setup模式
 
 

靜態路由協議設置
 
router(config)#ip route network submask(要到達的網絡號掩碼)ip address(下一跳或出口ip地址)

router(config)#ip route 0.0.0.0 s0(出口端口或下一跳IP地址)
 
 
rip設置

router(config)#router rip

router(config-router)#network network-number

router#show ip protocol查看RIP信息

router#show ip route 查看路由表

router#debug ip rip查看RIP更新信息

router(config-router)#passive-interface e0(阻止發出作息)

router(config-router)#ip rip receive version 1 2接收1、2RIP版本信息
 

igrp設置
 
router(config)#router igrp as number

router(config-router)#network network number

router#show ip route 查看路由表

router#debug ip igrp events 查看IGRP路由更新大概信息

router#debug ip igrp transaction 查看IGRP路由更新詳細信息

Router(config-router)#variance multiplier 控制 IGRP load balancing

Router(config-router)#traffic-share {balanced | min}控制load-balanced traffic 的分佈
 
 
eigrp設置
 
router(config)#router eigrp as number

router(config-router)#network network number

router(config)#no auto-summry 關閉自動彙總

router(config)# auto-summry 打開自動彙總(默認是打開的)
 
router#show ip route eigrp 顯示當前的路由表裏的EIGRP條目

router#show ip protocol 顯示活動的路由協議進程的參數和當前的狀態

router#show ip eigrp neighbors 顯示被EIGRP發現的鄰居

router#show ip eigrp traffic 顯示發出和收到的IP EIGRP 包的數量

router#show ip eigrp topology 顯示IP EIGRP的拓撲表

   Router#debug ip eigrp
 
 
ospf設置
 
1. Router(config)#router ospf process-id

Router(config-router)#network address(可以是網絡號也可以是Ip地址 mask(通配掩碼 )area area-id

Router(config-if)# ip ospf priority numbe 配置OSPF的優先級
 
Router#show ip protocols 驗證OSPF的配置

Router#show ip route 顯示路由器學到的所有路由

Router#show ip ospf interface type number 顯示 area-ID 和鄰接信息

Router#show ip ospf neighbor 基於每接口顯示OSPF鄰居信息

Router#debug ip ospf events

Router#debug ip ospf packet
 
2. Router(config)# interface loopback number(lookback迴路配置)

Router(config-if)# ip address ip-address subnet-mask
 
Router(config-if)# ip ospf cost cost-numbe 修改OSPF 的Cost數值

Router(config-if)# ip ospf authentication-key key 配置明文口令

Router(config-if)# ip ospf messge-digest-key keyid md5 key 配置MD5口令

(keyid和key必須配對一致,兩鄰居纔可以通信)

Router(config-route)# area area-id authentication [message-digest]

message-digest爲可選 項,使用後路由器只傳送口令消息的摘要(或散列) 配置OSPF區域的驗證:
 
3. Router(config-if)# ip ospf hello-interval seconds 配置hello間隔:

Router(config-if)# ip ospf dead-interval seconds配置down機判斷間隔
 
 
訪問列表
 
1.標準訪問列表(standard access lists):只使用源IP地址來做過濾決定 

  
 
Router(config)#access-list 10 deny 172.16.40.0 0.0.0.255

  Router(config)#access-list 10 permit any

Router(config)#int e1

  Router(config-if)#ip access-group 10 out
 
  使用IP標準ACL來控制VTY線路的訪問.

Router(config)#access-list 50 permit 172.16.10.3

  Router(config)#line vty 0 4

  Router(config-line)#access-class 50 in

刪除IP標準ACL

Router(config-line)#no ip access-class 50 in

Router(config)#no access-list 50
 
2.擴展訪問列表(extended access lists):它比較源IP地址和目標IP地址,層3的協議字段,層4端口號 來做過濾決定

  Router(config)#access-list 110 deny tcp any host 172.16.30.5 eq 21

  Router(config)#access-list 110 deny tcp any host 172.16.30.5 eq 23

  Router(config)#access-list 110 permit ip any any

  Router(config)#int e1

  Router(config-if)#ip access-group 110 out
 
3.虛擬通道訪問

  router(config)#access-list 12 permit 192.89.55.0 0.0.0.255

router(config)#line vty 0 4

outer(config-line)#access-class 12 in
 

  3.show ip interface:只顯示IP訪問列表信息

  4.show ip interface:顯示所有接口的信息和配置的ACL信息

  5.show ip interface [接口號]:顯示具體某個接口的信息和配置的ACL信息

  6.show running-config:顯示DRAM信息和ACL信息,以及接口對ACL的應用信息.
 

交換機配置

 

交換機上設置登陸口令

Switch(config)# enable password level level password 

Switch(config)# no enable password level level password

hostname

1900/2900(config)#hostname hostname
 
IP Address

1900(config)#ip address {ip address} {mask}

1900(config)#ip address 10.5.5.11 255.255.255.0
 
2950(config#interface vlan 1

2950(config-if)#ip address {ip_address} {mask}

2950(config)#interface vlan 1

2950(config-if)#ip address 10.5.5.11 255.255.255.0
 
default gateway

1900/2950(config)#ip default-gateway {ip address}

1900/2950(config)#ip default-gateway 172.20.137.1
 
查看交換機的IP地址

1900#show ip

IP address: 10.5.5.11

Subnet mask: 255.255.255.0

Default gateway: 10.5.5.3

Management VLAN: 1

2950#show interface vlan 1

Vlan1 is up, line protocol is up

Hardware is Cat5k Virtual Ethernet, address is 0010.f6a9.9800 (bia 0010.f6a9.9800)

Internet address is 172.16.80.79/24

Broadcast address is 255.255.255.255
 
設置雙工選項

1900(config)#interface e0/1

1900(config-if)#duplex {auto | full |full-flow-control | half}

2950(config)#interface fe0/1

2950(config-if)#duplex {auto | full | half}
 
設置端口速度:switch(config-if)# speed {10|100|auto}
 
查勘雙工選項

Switch#show interfaces fastethernet0/3
 
查看MAC地址表

1900/2950#show mac-address-table
 
配置永久MAC地址

1900(config)#mac-address-table permanent {mac-address type module/port}

1900(config)#mac-address-table permanent 2222.2222.2222 ethernet 0/3

1900#show mac-address-table

2950(config)#mac-address-table static mac_addr {vlan vlan_id} [interface int1 [int2 ... int15]]
 
配置受限靜態MAC地址

1900(config)#mac-address-table restricted static {mac-address type module/port src-if-list}

1900(config)#mac-address-table restricted static 1111.1111.1111 e0/4 e0/1

1900#show mac-address-table

2950(config)#mac-address-table secure mac-addr interface [vlan vlan-id]

2950(config)#mac-address-table secure 0003.3333.3333 fa 0/1 vlan 1

2950#show mac-address-table
 
配置端口安全性

1900(config-if)#port secure max-mac-count count

1900(config)#interface e0/4

1900(config-if)#port secure

1900(config-if)#port secure max-mac-count 1

1900(config)#address-violation {suspend | disable | ignore

1900# show mac-address-table security
 
2950(config-if)#port security max-mac-count count

2950(config)#interface fa0/1

2950(config-if)#port security

2950(config-if)#port security max-mac-count 10

2950(config-if)#port security action {shutdown | trap}

2950#show mac-address-table secure

2950#show port-security
 
管理配置文件
 
1900#copy nvram tftp://host/dst_file

1900#copy tftp://host/src_file nvram

1950#copy nvram tftp://10.1.1.1/wgswd.cfg

2950#copy startup-config tftp://host/dst_file
 
清除 NVRAM

1900#delete nvram

2950#erase startup-config
 
 
vlan配置

  

1900 VLAN建立

  1900下,使用vlan [vlan#] name [name] [vlan#]命令, 如下:

  >en

  #config t

  (config)#hostname 1900

  1900(config)#vlan 2 name sales

  1900(config)#vlan 3 name marketing

  1900(config)#vlan 4 name mis

  1900(config)#exit

  

端口分配

  1900(config)#int e0/2

  1900(config-if)#vlan-membership static 2

  1900(config)#int e0/4

  1900(config-if)#vlan-membership static 3

  1900(config)#int e0/5

  1900(config-if)#vlan-membership static 4

  1900(config-if)#exit

  1900(config)#exit

  

VLAN驗證

1900#sh vlan
 
2900 VLAN建立

在2950下創建VLAN,在特權模式下使用vlan database命令

  2950#vlan database

  2950(vlan)#vlan 2 name Marketing

   VLAN 2 modified:

   Name: Marketing

  2950(vlan)#vlan 3 name Accounting

   VLAN 3 added:

   Name: Accounting

  2950(vlan)#apply

   APPLY complete

  2950(vlan)#Ctrl+C

  2950#
 
  

端口分配

2950下的端口配置,使用switchport access vlan [vlan#]命令,

  2950(config-if)#int f0/2

  2950(config-if)#switchport access vlan 2

  2950(config-if)#int f0/3

  2950(config-if)#switchport access vlan 3

  2950(config-if)#int f0/4

  2950(config-if)#switchport access vlan 4

  2950(config-if)#exit

  2950(config)#exit

  

  驗證配置信息,如下:

  2950#sh vlan

  或

  2950#sh vlan brief
 
trunk配置

1900 trunk配置

  1900(config)#int f0/26

  1900(config-if)#trunk on
 
  2950下在接口配置模式,使用switchport命令,如下:

  2950(config)#int f0/12

  2950(config-if)#switchport mode trunk

2950(config-if)# switchport trunk encapsulation {isl|dot1q}

  2950(config-if)#^Z

將某VLAN從中繼中刪除

2950(config-if)# switchport trunk allowed vlan remove vlan-list

添加某個VLAN到中繼線路

2950(config-if)# switchport trunk allowed vlan add vlan-list

  
 

Configuring Inter-VLAN Routing

  

  給連接1900的trunk端口配置,使用encapsulation isl [vlan#]命令,如下:

  2600Router(config)#int f0/0.1

  2600Router(config-subif)#encapsulation isl [vlan#]

2600Router(config-subif)#ip add ip add submask

  

給連接2950的這樣配置,如下:

  2600Router(config)#int f0/0.1

  2600Router(config-subif)#encapsulation dot1q [vlan#]

2600Router(config-subif)#ip add ip add submask
 
 
VTP配置

 

  1900(config)#vtp server

  1900(config)#vtp domain noco

  1900(config)#vtp password noko
 
  在特權模式下使用show vtp命令驗證,如下:

  1900#sh vtp

   VTP version: 1

   Configuration revision: 0

   Maximum VLANs supported locally: 1005

   Number of existing VLANs: 5

   VTP domain name: noco

   VTP password: noko

   VTP operating mode: Server
 
   2950如下:

   2950(config)#vtp mode server

   2950(config)#vtp domain noco

   驗證信息,如下:

   2950#sh vtp ?

   counters VTP statistics

    status VTP domain status

  2950#sh vtp status
 

NAT配置

   

 配置靜態轉換

Router(config)#ip nat inside source static local-ip global-ip

  Router(config-if)#ip nat inside

Router(config-if)#ip nat outside

 配置動態地址轉換

  Router(config)#ip nat pool name start-ip end-ip {netmask netmask | prefix-length prefix-length}

Router(config)#access-list access-list-number permit source [source-wildcard]

Router(config)#ip nat inside source list

access-list-number pool name

配置Overloading

Router(config)#access-list access-list-number permit

source source-wildcard

Router(config)#ip nat inside source list

access-list-number interface interface overload

清除NAT Translation Table

Router#clear ip nat translation * 清除所有的動態地址轉換條目

Router#clear ip nat translation inside global-ip

local-ip [outside local-ip global-ip] 清除一個簡單的動態地址轉換條目( 內、外)

Router#clear ip nat translation outside

local-ip global-ip清除一個簡單的動態地址轉換( 外)

Router#clear ip nat translation protocol inside global-ip

global-port local-ip local-port [outside local-ip

local-port global-ip global-port] 清除一個擴展動態地址 轉換條目

Show命令輸出信息

Router#show ip nat translations
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章