Basic commands for switches and routers (Cisco)

Basic commands for switches and routers (Cisco) (2)


This part no longer annotates the working mode of the command in language, but includes the identity mode identification before the command in the command.

1, Function of device command line

1. Usage

Type the beginning of the command followed by a "?" , the system will give an instruction prompt starting with this part, such as:

Router>e?
enable  exit

2. Command support shorthand

For the instruction without ambiguity, it only needs to type the beginning part to realize the function. Such as:

Router>en
Router#

3. Command can complete Tab key

For the instruction without ambiguity, press "TAB" at the beginning to complete the instruction automatically. Such as:

Router>en
Router>enable

4. Command history memory function, up and down to call

Like other consoles, it supports up and down keys to directly call out the previously entered instructions.

5. How to delete a configuration?

Method:
1) First of all, the deletion instruction is executed in what mode
2) no space before the original command! Note: if there are custom parameters in the original command, you do not need to add parameters when deleting, such as:

sw1(config)# no enable password                #Delete privileged password

6. Use of do

The command in privilege mode can be used forcibly in global or interface mode. You need to add a do space before the command, such as:

Router(config)# do sh run             #Enforce view configuration instructions in privileged mode in global configuration mode

2, Common basic commands

1. Set device name

Switch(config)# hostname device name

Effect:

Switch(config)# hostname  bj-sw-1-1
bj-sw-1-1(config)#

2. Set user password

sw1(config)#line co 0                              #Enter console 0, i.e. console mode
sw1(config-line)#password  Password                    #Recommended password is at least 6 digits
sw1(config-line)#login                            #login function makes user password effective!

This password is required to enter the console, that is, the first layer password.

3. Set privilege password

sw1(config)# enable password Password      # Privileged password in clear text
sw1(config)# enable secret Password        # Privileged password of ciphertext, configured at the same time with plaintext, plaintext invalid

This password is the password used when user mode enters privileged mode.

4. Encrypt all passwords

R2(config)# service  password-encryption

5. View interface list

sw1>show ip int b                            #Available in user mode
sw1#show ip int b                            #Available in privileged mode
show ip interface brief                      #Complete instruction

The status of the current port is displayed, including port name, IP address, port status, etc.

6. View MAC address table

sw1>show mac-address-table                    #Available in user mode
sw1#show mac-address-table                    #Available in privileged mode

Effect:

sw1>show mac-address-table
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----

   1    0090.2b1d.7e02    DYNAMIC     Fa0/3

7. Open port manually

R2(config)# int f0/1               #Access port
R2(config-if)# no shutdown         #Open port

8. Manually close the port

R2(config)#int f0/1                #Access port 
R2(config-if)# shutdown            #Close port

9. View all configurations

Router# sh run
Router# show running-config                       #Complete instruction

Note: under sh run, the privilege password of plaintext can be viewed, and the password of ciphertext will display the scrambled code after encryption.

10. Save device configuration

Router# cop ru s
Router# copy running-config startup-config            #Complete instruction

or

Router# write

11. Restart the device

Router# reload

If you restart without saving the device configuration, the configuration will be lost.
Generally, the network equipment only has restart instruction, no shutdown instruction, and can only use physical method to shutdown.

12. Configure IP address for router (port)

(layer 2 switch port cannot be configured; each port of router has independent ip)

Router(config)# int f0/0                              # Access port
Router(config-if)# ip add IP Address subnet mask              # Configure ip  
Router(config-if)# no shutdown                        # Enable port

13. Configure virtual interface IP for switches

Function: set an IP for the switch to facilitate remote management.

sw1(config)# int vlan 1                     # Enter this non-existent built-in port
sw1(config-if)# ip add IP Address subnet mask        # Set IP
sw1(config-if)# no shutdown                 # Open port

14. Turn on telnet service for router (switch)

Router(config)# line vty 0 2                     # 2 can also be changed to 1 or 3 and so on. Represents the number of simultaneous remote
Router(config-line)# password Password                # Set remote telnet password
Router(config-line)# login                       # Application configuration
Router(config-line)# exit                        # Return to privileged mode
Router(config)# enable password Password              # The privileged password must be set, otherwise the remote cannot enter the privileged mode

15. telnet connection with different identities

Router(config)# line vty 0 2                     # 2 can also be changed to 1 or 3 and so on. Represents the number of simultaneous remote
Router(config-line)# login local                 # Enable user name and password login (local database takes over login comparison)
Router(config-line)# exit                        # Return to global configuration mode
Router(config)# username User name password Password      # Set user name and password to create multiple entries
Router(config)# enable password Password              # The privileged password must be set, otherwise the remote cannot enter the privileged mode

After this setting is completed, the user name and password are required to enter the console for remote telnet connection.

Published 4 original articles, won praise 2, visited 163
Private letter follow

Keywords: Mac network Database

Added by anupamsaha on Wed, 26 Feb 2020 13:42:02 +0200