路由器交換機命令總結

特權模式:enable (en)

全局配置模式:config terminal (conf t)

接口模式:interface fastethernet 模塊號/端口號 int f0/1

同時進入多個接口 int range f0/0 – 4

終止域名解析:ctrl+shift+6

退出到特權模式:crtl+z  end

退出到上一層:exit

ctrl+A 光標到命令行開始位置

ctrl+E 光標到命令行結束位置

 

特權模式下命令

show version  顯示系統ios名稱及版本信息

查看當前配置信息: show running-config  (sh run)

查看以保存的配置信息: show startup-config  (shstar)

保存當前配置信息:copy running-config startup-config (copy run star ) = write

刪除已保存的配置信息:erase nvram  erasestartup-config

tracert 192.168.1.1  查看到192.168.1.1的過程

重啓:reload

查看vlanshow vlan brief

 

全局模式下命令:

host xx 修改主機名爲xx

還原接口爲默認配置:default interface f0/1

配置雙工模式:deplex full|half|auto

配置接口速率:speed 10|100|100

永不超時:

line con 0 

exec-timeout 0 0

信息同步:

line con 0

logging synchronous (logg syn)

禁用DNS查詢:no ip domain-lookup

 

交換機:

查看mac地址表:show mac-address-table 

查看f0/1信息(包括雙工模式和速率):show int f0/1 

在三層交換機上啓用路由功能:ip routing

查看接口模式狀態: show interface interface-id switchport

 

創建vlan :

1.vlan database

vlan vlan-id [name vlan-name]

exit

2.conf t

vlan vlan-id

name vlan-name

exit

將端口f0/1分配到vlan 2:

conf t

int f0/1

switchport mode access

switchport access vlan 2

exit

 

給交換機虛接口配置ip:

int vlan 1

ip add 192.168.1.1 255.255.255.0

no sh

配置默認網關: ip default-gateway 192.168.1.254

 

配置交換機console口密碼:

全局模式:

line console 0

password cisco

login

配置特權模式密碼:

全局模式下:

enable password cisco (明文) / enablesecret cisco (密文)

加密明文密碼:service password-encryption

 

配置vty密碼;

line vty 0 4

password cisco

login

設置好vty密碼和enable密碼,可以通過telnet遠程管理交換機。遠程管理不同網段的交換機時,需要給交換機配置默認網關

 

trunk配置:

int f0/1

switchport trunk encapsulation dot1q

switchport mode trunk

 

禁止trunk傳送某個vlan的數據,刪除這個vlan: switchport trunk allowed vlan remove vlan-id

允許trunk傳送某個vlan的數據,添加這個vlan: switchport trunk allowed vlan add vlan-id

 

配置以太網通道:

interface range f0/1 – 2

channel-group 1 mode on

查看以太網通道配置: show etherchannel 1 summary

VTP配置:

創建vtp域:Switch(config)# vtp domain domain-name

配置交換機的vtp模式:Switch(config)# vtp mode {server|client|transparent}

配置vtp口令:Switch(config)# vtp password password

配置vtp修剪: Switch(config)# vtp pruning

配置vtp版本:Switch(config)# vtp version 2 (默認運行版本1)

查看vtp配置信息:Switch# show vtp status

查看vtp口令:Switch# show vtp password

交換機密碼恢復:

1.開機按mode

   2.初始化flash flash_init

   3.config.text修改爲config.old

     rename flashconfig.text  flashconfig.old

   4.重啓:boot

   5.把配置文件名改回

     rename flashconfig.old  flashconfig.text

   6.手動加載配置文件

     copy flashconfig.text  systemrunning-config

   7.查看配置並修改

8.保存:wr

 

路由器:

查看arp緩存表:show arp

清除arp緩存表:clear arp-cache

查看所有接口ip: sh ip int brief

查看路由表:show ip route (c-直連路由,s-靜態路由,s*-默認路由)

配置靜態路由: ip route 目的網段子網掩碼 address(到達目的網絡經過的下一跳路由器的接口地址)

配置默認路由: ip route 0.0.0.0 0.0.0.0 address(下一跳地址)

no ip routing : 把路由器路由功能關了,模擬交換機

 

配置ip:

int f0/0

ip add 10.0.0.10 255.255.255.0

no shut down

 

配置單臂路由:需要配置子接口的封裝結構,vlanip

int f0/0.1

encapsulatation dot1q 10vlan-id

ip add 10.0.0.1 255.255.255.0

int f0/0.2

配置DHCP

定義ip地址池:Router(config)#  ip dhcp pool pool-name

動態分配ip地址段: Router(dhcp-config)# network 網段掩碼

設定網關地址:Router(dhcp-config)# default-router 網關地址

爲客戶端配置DNS地址:Router(dhcp-config)# dns-server  dns-ip

設定地址租期:Router(dhcp-config)# lease days

預留靜態分配的ip地址: Router(dhcp-config)# ip dhcp excluded-address low-address[high-address]

路由器密碼恢復:

1.中斷開機:ctrl+break

    2.修改寄存器的值:confreg0x2142

    3.重啓:reset

   4.手動加載配置文件:copy startup-confg running-config

   5.查看配置並修改

   6.恢復寄存器的值:config-register 0x2102

   7.保存配置:copy run star

 


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