Using the web interface to log in and configure a router is something every network administrator knows how to do. However, sometimes for security reasons we disable web login, and at that point we can only configure the device via the command line. This article uses a Huawei router as an example to introduce how to configure a router using commands.
1. User Mode: When accessing the router via console or Telnet, the system prompts the user to enter a password. After entering the password, you enter the first level, known as User Mode. At this point, the system prompt is “>”. If the router name is huawei2611, the prompt will be “huawei2611>”. At this level, users can only view some basic router statuses and cannot make configuration changes.
2. Privileged Mode: In User Mode, first enter “enable”, then enter the corresponding password to enter the second level, Privileged Mode. The system prompt for Privileged Mode is “#”. At this level, users can use the show and debug commands for configuration checks. However, you still cannot modify the router’s configuration. To do so, you must enter the third level.
Huawei2611>enable
Password:*******
Huawei2611#
3. Configuration Mode: In this mode, users are allowed to actually modify the router’s configuration. The method to enter the third level is to enter the command “config terminal” in Privileged Mode. The corresponding prompt is “(config)#”. At this point, users can truly modify the router’s configuration, such as configuring the router’s static routing table. Detailed configuration commands need to be referenced from the router configuration documentation.
Huawei2611#config terminal
Huawei2611(config)#
4. Port Configuration Mode: First, the bootstrap program is loaded from ROM, then the IOS is loaded from FLASH ROM, and finally, the router configuration file in NVRAM is found and loaded. To configure these ports, you need to enter Port Configuration Mode. For example, to configure Ethernet port 0, you need to use the command interface ethernet0.
Huawei2611(config)#interface ethernet0
Huawei2611(config-int)#
5. Let’s illustrate with an example below.
1. Define the Router Hostname
To define the router hostname as huawei2611, use the following commands:
router>enable
password:******
router#config terminal
router(config)#hostname?huawei2611
2. Set the Privileged Mode Password
When operating the router, you need to enter the corresponding password after typing “enable”. To set the password, use the following command in Configuration Mode:
router(config)#enable secret mypassword
to change the password to mypassword.
3. Configure Ethernet Port Information
Enter the following commands in Configuration Mode:
router(config)#interface ethernet?0/0
router(config-if)#ip address 202.102.224.25?255.255.255.0
router(config-if)#ip net inside
4. Configure Synchronous Ports
router(config)#interface serial 0/0
router(config-if)#ip address 202.102.211.108 255.255.255.248
router(config-if)#ip net outside
5. Add Static Routes
In this type of Internet access method, a static routing approach is used, so a static route record needs to be added as follows:
router(config)#ip router 0.0.0.0?0.0.0.0 202.102.211.107
6. Other Configurations
router(config)#ip net inside source list 1 ethernet0/0 overload
router(config)#access-list 1 permit any
There are two main ways to configure a router. One is manual configuration, where you enter the IOS and configure the router through the command line;
the other is running the Setup program, which is an interactive configuration software provided by IOS. It is suitable for new users who are not very familiar with IOS commands. After users study the IOS configuration commands carefully, using the manual method to configure the router can greatly improve efficiency.
IOS has multiple levels of operation. At