Cisco 指令 Part.1

Basic knowledge

Autocomplete

Autocomplete: <TAB>

Switch#show ru<TAB>
Switch#show running-config

List Available Commands: ?

Switch#show r?
radius          redundancy  region     registry
reload          rep         resource   rhosts
rib             rif         rmon       rom-monitor
romvar          route-map   route-tag  rpl
running-config

Interface Name and abbreviation

  • FastEthernet0/1 or Fa0/1
  • GigabitEthernet1/0/2 or Gi1/0/2
  • TenGigabitEthernet1/0/3 or Te1/0/3
  • Port-channel1 or Po1
  • Vlan543 or Vl543​

Command Line Modes

User Mode

Switch>

Privileged Mode

Switch>enable
Switch#

Configuration Mode

Switch#configure terminal
Switch(config)#exit
Switch#

Show

Show

  • show running-config : running configuration
  • show interfaces : detail of all interfaces
  • show interfaces Fa0/1 : detail of a specified interface
  • show interfaces status : interface status
  • show vlan : VLANs in VLAN database
  • show mac address-table : MAC address/port mapping
  • show arp : ARP table
  • show version : hardware/software infomation
  • show ?

Output Modifier

<command> | include <expr>   // output lines that include <expr>
<command> | exclude <expr>   // output lines without <expr>
<command> | begin <expr>     // output begins from the first line that includes <expr>
// spaces around "|" cannot be omitted!
Switch#show arp | include 140.112.30.34
Internet  140.112.30.34  102  98f2.b3ee.bb4e  ARPA  Vlan30

Save Configuration # important

Switch#copy running-config startup-config
or
Switch#write memory

Global Configurations

set hostname

Switch(config)#hostname <name>

Cancel config

Switch(config)#no <command>

configuring passwords

enable password

Cisco IOS Security Configuration Guide, Release 12.2

CiscoLab(config)#enable secret CISCO
CiscoLab#show running-config
enable secret 5 $1$mERr$NJdjwh5wX8Ia/X8aC4RIu.

connection password

分為本地端連線 (console) 和 遠端終端連線 (vty)

Switch(config)#line console 0  // 設定本地介面編號 0
or
Switch(config)#line vty 0 4    // 設定終端介面編號 0~4

Switch(config-line)#login
Switch(config-line)#password cisco

啟用 password-encryption ( 其實是 encode )

Switch(config)#service password-encryption

CiscoLab#show running-config
line vty 0 4
password 7 0822455D0A16

Interface Configurations

choose interface

Switch(config)#interface FastEthernet0/1
Switch(config-if)#

set port access VLAN

Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 543

set port as a trunk port

Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan 543,544

set switch IP on VLAN interfaces

Switch(config-if)#ip address 192.168.252.254 255.255.255.0

set channel group

Switch(config-if)#channel-group 1 mode active

reference

Leave a Reply

Your email address will not be published. Required fields are marked *