Router Basics

Router mode configuration

1. User EXEC Mode:

  • Purpose: This is the default mode when you connect to the router. It provides limited access to view system status.
  • Access: Enter the router's CLI by using a console cable or connecting via SSH/Telnet. You'll see a prompt ending with >.
  • Command to Enter: enable
shell
Router> enable Password: [Enter password if required] Router#

2. Privileged EXEC Mode:

  • Purpose: In this mode, you have access to all router commands and can view or change the configuration.
  • Access: You enter privileged EXEC mode by typing enable in user EXEC mode. You'll see a prompt ending with #.
  • Command to Enter: configure terminal or simply conf t
arduino
Router# configure terminal Router(config)#

3. Global Configuration Mode:

  • Purpose: This mode allows you to configure global settings for the router.
  • Access: From privileged EXEC mode, use the configure terminal or conf t command.
  • Example:
scss
Router(config)# hostname MyRouter MyRouter(config)#

4. Interface Configuration Mode:

  • Purpose: You can configure individual router interfaces (e.g., Ethernet, serial) in this mode.
  • Access: From global configuration mode, use the interface command followed by the interface type and number (e.g., interface GigabitEthernet0/0).
  • Example:
scss
MyRouter(config)# interface GigabitEthernet0/0 MyRouter(config-if)#

5. Subinterface Configuration Mode (for VLANs):

  • Purpose: When configuring VLANs or subinterfaces, you enter this mode.
  • Access: From global configuration mode, use the interface command followed by the subinterface type and number (e.g., interface GigabitEthernet0/0.10 for subinterface VLAN 10).
  • Example:
scss
MyRouter(config)# interface GigabitEthernet0/0.10 MyRouter(config-subif)#

6. Line Configuration Mode:

  • Purpose: You use this mode to configure specific lines (e.g., console, Telnet, SSH) for user access.
  • Access: From global configuration mode, use the line command followed by the line type and number (e.g., line console 0).
  • Example:
arduino
MyRouter(config)# line console 0 MyRouter(config-line)#

7. Router Configuration Mode (for routing protocols):

  • Purpose: When configuring routing protocols like OSPF or EIGRP, you enter this mode.
  • Access: From global configuration mode, use the appropriate routing protocol command (e.g., router ospf 1).
  • Example:
scss
MyRouter(config)# router ospf 1 MyRouter(config-router)#

8. Access Control List (ACL) Configuration Mode:

  • Purpose: This mode allows you to create and configure ACLs for traffic filtering.
  • Access: From global configuration mode, use the access-list command followed by the ACL number.
  • Example:

Configuring a router involves entering different configuration modes to set up various aspects of the router's operation. The configuration process typically involves moving through different modes, from the user EXEC mode to the privileged EXEC mode and then to specific configuration modes. Below is an overview of the common configuration modes in a Cisco router and how to access and navigate them:

1. User EXEC Mode:

  • Purpose: This is the default mode when you connect to the router. It provides limited access to view system status.
  • Access: Enter the router's CLI by using a console cable or connecting via SSH/Telnet. You'll see a prompt ending with >.
  • Command to Enter: enable
shell
Router> enable Password: [Enter password if required] Router#

2. Privileged EXEC Mode:

  • Purpose: In this mode, you have access to all router commands and can view or change the configuration.
  • Access: You enter privileged EXEC mode by typing enable in user EXEC mode. You'll see a prompt ending with #.
  • Command to Enter: configure terminal or simply conf t
arduino
Router# configure terminal Router(config)#

3. Global Configuration Mode:

  • Purpose: This mode allows you to configure global settings for the router.
  • Access: From privileged EXEC mode, use the configure terminal or conf t command.
  • Example:
scss
Router(config)# hostname MyRouter MyRouter(config)#

4. Interface Configuration Mode:

  • Purpose: You can configure individual router interfaces (e.g., Ethernet, serial) in this mode.
  • Access: From global configuration mode, use the interface command followed by the interface type and number (e.g., interface GigabitEthernet0/0).
  • Example:
scss
MyRouter(config)# interface GigabitEthernet0/0 MyRouter(config-if)#

5. Subinterface Configuration Mode (for VLANs):

  • Purpose: When configuring VLANs or subinterfaces, you enter this mode.
  • Access: From global configuration mode, use the interface command followed by the subinterface type and number (e.g., interface GigabitEthernet0/0.10 for subinterface VLAN 10).
  • Example:
scss
MyRouter(config)# interface GigabitEthernet0/0.10 MyRouter(config-subif)#

6. Line Configuration Mode:

  • Purpose: You use this mode to configure specific lines (e.g., console, Telnet, SSH) for user access.
  • Access: From global configuration mode, use the line command followed by the line type and number (e.g., line console 0).
  • Example:
arduino
MyRouter(config)# line console 0 MyRouter(config-line)#

7. Router Configuration Mode (for routing protocols):

  • Purpose: When configuring routing protocols like OSPF or EIGRP, you enter this mode.
  • Access: From global configuration mode, use the appropriate routing protocol command (e.g., router ospf 1).
  • Example:
scss
MyRouter(config)# router ospf 1 MyRouter(config-router)#

8. Access Control List (ACL) Configuration Mode:

  • Purpose: This mode allows you to create and configure ACLs for traffic filtering.
  • Access: From global configuration mode, use the access-list command followed by the ACL number.
  • Example:
arduino
MyRouter(config)# access-list 101 permit tcp any host 192.168.1.2 eq 80 MyRouter(config)# interface GigabitEthernet0/0 MyRouter(config-if)# ip access-group 101 in

========================================================

Change Host Name

  1. Access Privileged EXEC Mode: If you are not already in privileged EXEC mode, start by accessing it. You should see a router prompt ending with #. You can enter this mode by typing enable and providing the required password if necessary.

    shell
    Router> enable Password: [Enter password if required] Router#
  2. Change the Hostname: In privileged EXEC mode, use the configure terminal or conf t command to enter global configuration mode. Then, use the hostname command followed by the new hostname you want to set.

    arduino
    Router# configure terminal Router(config)# hostname NewHostname

    Replace NewHostname with the desired hostname for your router.

  3. Exit Configuration Mode: After changing the hostname, you can exit the configuration mode and return to privileged EXEC mode by typing exit or pressing Ctrl-Z.

    shell
    Router(config)# exit Router#
  4. Save the Configuration: To ensure that the new hostname persists across reboots, save the configuration to the router's startup-config. Use the write memory command or the copy running-config startup-config command.

    arduino
    Router# write memory

  1. Access Privileged EXEC Mode: If you are not already in privileged EXEC mode, start by accessing it. You should see a router prompt ending with #. You can enter this mode by typing enable and providing the required password if necessary.

    shell
    Router> enable Password: [Enter password if required] Router#
  2. Change the Hostname: In privileged EXEC mode, use the configure terminal or conf t command to enter global configuration mode. Then, use the hostname command followed by the new hostname you want to set.

    arduino
    Router# configure terminal Router(config)# hostname NewHostname

    Replace NewHostname with the desired hostname for your router.

  3. Exit Configuration Mode: After changing the hostname, you can exit the configuration mode and return to privileged EXEC mode by typing exit or pressing Ctrl-Z.

    shell
    Router(config)# exit Router#
  4. Save the Configuration: To ensure that the new hostname persists across reboots, save the configuration to the router's startup-config. Use the write memory command or the copy running-config startup-config command.

    arduino
    Router# write memory
  1. Access Privileged EXEC Mode: If you are not already in privileged EXEC mode, start by accessing it. You should see a router prompt ending with #. You can enter this mode by typing enable and providing the required password if necessary.

    shell
    Router> enable Password: [Enter password if required] Router#
  2. Change the Hostname: In privileged EXEC mode, use the configure terminal or conf t command to enter global configuration mode. Then, use the hostname command followed by the new hostname you want to set.

    arduino
    Router# configure terminal Router(config)# hostname NewHostname

    Replace NewHostname with the desired hostname for your router.

  3. Exit Configuration Mode: After changing the hostname, you can exit the configuration mode and return to privileged EXEC mode by typing exit or pressing Ctrl-Z.

    shell
    Router(config)# exit Router#
  4. Save the Configuration: To ensure that the new hostname persists across reboots, save the configuration to the router's startup-config. Use the write memory command or the copy running-config startup-config command.

    arduino
    Router# write memory
  5. ===========================================

  6. Router Change Password

  7. 1. Access Privileged EXEC Mode:

    • If you are not already in privileged EXEC mode, access it by typing enable in user EXEC mode and providing the current enable password if required.
    bash
    Router> enable Password: [Enter current enable password if required] Router#

    2. Enter Global Configuration Mode:

    • In privileged EXEC mode, use the configure terminal or conf t command to enter global configuration mode.
    arduino
    Router# configure terminal Router(config)#

    3. Change the Enable Password:

    • Use the enable secret command followed by the new password to change the enable password. This command sets an encrypted password.
    arduino
    Router(config)# enable secret NewPassword

    Replace NewPassword with your desired new password.

    4. Optionally, Change the Enable Password (Legacy Method):

    • If you prefer to use the older method to set the enable password, you can use the enable password command. Note that this method stores the password in clear text, which is less secure.
    arduino
    Router(config)# enable password NewPassword

    Replace NewPassword with your desired new password.

    5. Exit Configuration Mode:

    • After changing the password, exit the configuration mode and return to privileged EXEC mode.
    shell
    Router(config)# exit Router#

    6. Save the Configuration:

    • To save the configuration with the new password, use the write memory command or the copy running-config startup-config command.
    arduino
    Router# write memory

    ==========================================

  8. Router Password Encrpytion

  9. In Cisco routers, two main types of password encryption are used:

    1. Type 7 Password Encryption:

      • Cisco routers use a weak encryption algorithm known as "Type 7" to encrypt passwords. This type of encryption is considered weak because it can be relatively easily reversed by attackers who have access to the encrypted password. Therefore, it is not recommended for securing critical passwords.

      • To configure a Type 7 encrypted password, you can use a command like this:

        arduino
        Router(config)# enable secret 7 <encrypted-password>
      • The <encrypted-password> is the result of running the original password through the Type 7 encryption algorithm. For example, if you wanted to set the enable secret password to "mypassword," you would need to first obtain its Type 7 encrypted form:

        arduino
        Router(config)# enable secret 7 070C285F4D4A1A1A
      • Note that to view the Type 7 encrypted password, you can use the show running-config command or the show enable secret command. However, it's important to understand that Type 7 encryption is not secure for critical passwords.

    2. Type 5 Password Encryption (MD5):

      • To enhance security, it is recommended to use Type 5 password encryption, which employs the MD5 (Message Digest 5) hashing algorithm. MD5 is significantly more secure than Type 7 encryption.

      • To configure a Type 5 encrypted password, you can use a command like this:

        arduino
        Router(config)# enable secret <plaintext-password>
      • The <plaintext-password> is the actual password in plain text, and the router will automatically hash it using MD5 for storage. For example:

        arduino
        Router(config)# enable secret mysecurepassword
      • The password will be stored securely in its hashed format in the router's configuration.

      • ==========================================================

      • Router Simple Interface Configuration

      • 1. Access the Router's CLI:

        • Connect to the router using a console cable or via SSH/Telnet. Access the router's command-line interface (CLI). You should start in user EXEC mode, which is indicated by a prompt ending with >. You can enter privileged EXEC mode using the enable command and providing the required password if prompted.
        shell
        Router> enable Password: [Enter password if required] Router#

        2. Enter Global Configuration Mode:

        • In privileged EXEC mode, use the configure terminal or conf t command to enter global configuration mode. This mode allows you to configure various router settings, including interfaces.
        arduino
        Router# configure terminal Router(config)#

        3. Select the Interface:

        • Use the interface command followed by the interface type and number to select the specific interface you want to configure. For example, to configure GigabitEthernet interface 0/0:
        scss
        Router(config)# interface GigabitEthernet0/0 Router(config-if)#

        4. Configure IP Address and Subnet Mask:

        • Assign an IP address and subnet mask to the interface using the ip address command. For example:
        arduino
        Router(config-if)# ip address 192.168.1.1 255.255.255.0
        • Replace 192.168.1.1 with the desired IP address for the interface and 255.255.255.0 with the appropriate subnet mask.

        5. Enable the Interface:

        • Use the no shutdown command to enable the interface.
        arduino
        Router(config-if)# no shutdown

        6. Exit Configuration Mode:

        • After configuring the interface, exit the configuration mode to return to privileged EXEC mode.
        scss
        Router(config-if)# exit Router(config)#

        7. Save the Configuration:

        • To ensure that your configuration persists across reboots, save the configuration to the router's startup-config file using the write memory command.
        arduino
        Router(config)# end Router# write memory

        Your router's Ethernet interface (in this example, GigabitEthernet0/0) is now configured with the specified IP address and subnet mask.

      • =====================================================

      • Router Banner Configuration

      • Here's how to configure a few common banners on a Cisco router using Cisco IOS commands:

        1. MOTD (Message of the Day) Banner:

        The MOTD banner is typically displayed to users when they log in to the router. It's often used to provide a welcome message or legal disclaimer.

        bash
        Router(config)# banner motd # Enter TEXT message. End with the character '#'. This is the MOTD banner. Unauthorized access is prohibited. #

        In the above example, the # character is used as a delimiter to start and end the banner message. You can use any character that is not part of your banner message.

        2. Login Banner:

        The login banner is displayed before the username and password prompts when a user logs in to the router. It's often used to warn unauthorized users about access restrictions.

        bash
        Router(config)# banner login # Enter TEXT message. End with the character '#'. Unauthorized access is strictly prohibited. #

        3. Exec Banner (Exec-Timeout Banner):

        The exec banner is displayed to users after a period of inactivity (exec-timeout) when they are logged in to the router. It can be used to remind users to log out after use.

        bash
        Router(config)# line console 0 Router(config-line)# exec-timeout 15 0 Router(config-line)# login Router(config-line)# exit Router(config)# banner exec # Enter TEXT message. End with the character '#'. Session will be terminated due to inactivity. #

        In the above example, we set an exec-timeout of 15 minutes with no seconds, which means the session will not automatically time out due to inactivity. However, when the user reaches 15 minutes of inactivity and tries to execute a command, they will see the exec banner.

        4. Configuring a Message-of-the-Day Banner for SSH:

        If you want to display a banner to users connecting via SSH, you can configure an SSH banner as follows:

        bash
        Router(config)# banner login # Enter TEXT message. End with the character '#'. Welcome to the secure SSH access. Unauthorized access is prohibited. # Router(config)# line vty 0 15 Router(config-line)# login local Router(config-line)# transport input ssh Router(config-line)# exit

        In this example, we've configured a login banner and ensured that SSH access is enabled on the VTY lines (0 to 15).

      • ===================================

      • Router Clock Configuration

      • 1. Access the Router's CLI:

        • Connect to the router using a console cable, SSH, or Telnet, and access the router's command-line interface (CLI). You should start in user EXEC mode, which is indicated by a prompt ending with >. You can enter privileged EXEC mode using the enable command and providing the required password if prompted.
        bash
        Router> enable Password: [Enter password if required] Router#

        2. Configure the Time Zone:

        • Before setting the clock, you should configure the router's time zone. The time zone is specified in hours and minutes ahead or behind Coordinated Universal Time (UTC). You can use the clock timezone command to set the time zone.
        bash
        Router(config)# clock timezone GMT 0

        In the above example, we set the time zone to GMT (UTC) with an offset of 0 hours. Adjust the offset according to your time zone.

        3. Set the Clock Manually:

        • You can manually set the router's clock using the clock set command. Specify the current time and date in the format hh:mm:ss month day year. For example:
        bash
        Router(config)# clock set 15:30:00 Sep 15 2023

        This sets the router's clock to 3:30 PM on September 15, 2023.

        4. Save the Configuration:

        • To ensure that the configured time persists across router reboots, save the configuration to the router's startup-config file using the write memory command.
        bash
        Router(config)# end Router# write memory

        5. Verify the Clock Configuration:

        • You can verify the clock configuration by checking the router's current time and date using the show clock command.
        bash
        Router# show clock

        The router should display the configured time and date.

        6. Optional: Configure NTP (Network Time Protocol):

        • For more accurate and automatic time synchronization, consider configuring the router to use NTP to synchronize its clock with an NTP server. NTP is especially useful in larger networks.

        Here's a basic example of how to configure NTP:

        bash
        Router(config)# ntp server <ntp-server-ip-address>

        Replace <ntp-server-ip-address> with the IP address of an NTP server. You can find publicly available NTP servers on the internet or use your organization's internal NTP server if available.

      • ==========================================================

      • Router Mapping a Local Hostname to Remote IP Address

      • 1. Access the Router's CLI:

        • Connect to the router using a console cable, SSH, or Telnet, and access the router's command-line interface (CLI) in privileged EXEC mode.

        2. Configure DNS Resolution (Option 1 - Using a DNS Server):

        • If you have a DNS server in your network, you can configure the router to use it for DNS resolution. This is the most common method for mapping hostnames to IP addresses.
        bash
        Router(config)# ip name-server <DNS-server-IP>

        Replace <DNS-server-IP> with the IP address of your DNS server. You can specify multiple DNS servers if needed.

        3. Configure DNS Resolution (Option 2 - Using Embedded DNS Server):

        • Some Cisco routers have an embedded DNS server that can be configured to resolve hostnames. You can enable it and add static mappings.
        bash
        Router(config)# ip dns server Router(config)# ip host <hostname> <IP-address>

        Replace <hostname> with the desired hostname and <IP-address> with the remote IP address to which you want to map the hostname.

        4. Verify DNS Configuration:

        • To verify your DNS configuration, you can use the show ip name-server command to see the configured DNS servers, or use show hosts to see the configured hostname-to-IP mappings.
        bash
        Router# show ip name-server Router# show hosts

        5. Test DNS Resolution:

        • You can now test the DNS resolution by trying to resolve the hostname to an IP address. For example:
        bash
        Router# ping <hostname>

        If DNS resolution is configured correctly, you should see the IP address associated with the hostname.

        6. Save the Configuration:

        • To ensure that your DNS configuration persists across router reboots, save the configuration to the router's startup-config file using the write memory command.
        bash
        Router# write memory

        This configuration allows you to map a local hostname to remote IP addresses using DNS resolution. Users in your network can then use the hostname to access remote devices without needing to remember the IP addresses.

      • =========================

      • Saving and Erasing Router Configuration

      • Saving the Configuration:

        1. Access the Router's CLI:

          • Connect to the router using a console cable, SSH, or Telnet, and access the router's command-line interface (CLI). You should start in user EXEC mode, which is indicated by a prompt ending with >. You can enter privileged EXEC mode using the enable command and providing the required password if prompted.
          bash
          Router> enable Password: [Enter password if required] Router#
        2. Save the Configuration:

          • To save the running configuration to the router's startup configuration file, use the write memory or copy running-config startup-config command.
          bash
          Router# write memory

          or

          bash
          Router# copy running-config startup-config

          Both commands accomplish the same task: they save the current running configuration to the NVRAM (Non-Volatile RAM), which is where the startup configuration is stored. The router will now boot up with the saved configuration the next time it is restarted.

        Erasing the Configuration:

        Erasing the configuration should be done with caution, as it resets the router to its factory default settings. If you need to erase the configuration, follow these steps:

        1. Access the Router's CLI:

          • Connect to the router's CLI as explained in the previous section.
        2. Enter Global Configuration Mode:

          • Use the configure terminal or conf t command to enter global configuration mode.
          bash
          Router# configure terminal Router(config)#
        3. Erase the Configuration:

          • To erase the entire configuration, including all settings and passwords, use the erase startup-config or write erase command. You will be prompted to confirm this action.
          bash
          Router(config)# erase startup-config

          or

          bash
          Router(config)# write erase
        4. Reload the Router:

          • After erasing the configuration, you should reload (reboot) the router for the changes to take effect.
          bash
          Router(config)# exit Router# reload

          The router will now boot up with its factory default settings. You'll need to reconfigure it from scratch.

        5. ===============================

        6. Router show Commands

      • Here are some commonly used show commands on a router, along with their descriptions:

        1. show running-config:

          • Description: This command displays the router's current running configuration, which includes all the settings and configurations currently in use. It shows how the router is currently configured.
        2. show startup-config:

          • Description: This command displays the contents of the router's startup configuration, which is the configuration that will be used upon the next reboot. It can be used to compare the current running configuration with the saved startup configuration.
        3. show interfaces:

          • Description: This command provides detailed information about all the router's interfaces, including their status (up or down), IP addresses, MAC addresses, and statistics like input and output errors.
        4. show ip route:

          • Description: This command displays the router's IP routing table. It shows the routes the router knows about, including directly connected networks and routes learned from routing protocols.
        5. show version:

          • Description: This command provides information about the router's hardware, software version, uptime, and configuration register settings. It's useful for identifying the router model and software version.
        6. show arp:

          • Description: This command displays the router's ARP (Address Resolution Protocol) table. It shows the mappings between IP addresses and MAC addresses of devices in the local network.
        7. show access-lists:

          • Description: This command displays the router's configured access control lists (ACLs). It shows the rules for filtering traffic based on source and destination addresses, ports, and protocols.
        8. show cdp neighbors:

          • Description: If CDP (Cisco Discovery Protocol) is enabled, this command shows information about neighboring Cisco devices connected to the router's interfaces. It includes details like the device's hostname and interface.
        9. show ip interface brief:

          • Description: This command provides a brief overview of the router's IP interfaces, including their IP addresses, status, and protocol (e.g., up/up, down/down).
        10. show logging:

          • Description: This command displays the router's system log messages. It can be used to check for any system events, errors, or warnings that have been logged.
        11. show running-config | section <keyword>:

          • Description: This command allows you to filter the running configuration and display only the sections that contain the specified keyword. It's helpful for quickly finding relevant configuration sections.
        12. show clock:

          • Description: This command displays the router's current date and time, as configured on the router. It's useful for verifying the router's time settings.
        13. ==========================================================Router Exec Timeout
        14. 1. Access the Router's CLI:

          • Connect to the router using a console cable, SSH, or Telnet, and access the router's command-line interface (CLI). You should start in user EXEC mode, which is indicated by a prompt ending with >. You can enter privileged EXEC mode using the enable command and providing the required password if prompted.
          bash
          Router> enable Password: [Enter password if required] Router#

          2. Enter Line Configuration Mode:

          • To configure the execution timeout for a specific line (e.g., console, VTY), enter line configuration mode. For example, to configure the console line:
          bash
          Router# configure terminal Router(config)# Router(config)# line console 0 Router(config-line)#

          3. Configure the Execution Timeout:

          • Use the exec-timeout command followed by the timeout values to set the execution timeout. The command has two timeout values: the first specifies the timeout for user EXEC mode, and the second specifies the timeout for privileged EXEC mode.
          bash
          Router(config-line)# exec-timeout <minutes> <seconds>

          Replace <minutes> with the desired number of minutes and <seconds> with the desired number of seconds. For example, to set an execution timeout of 15 minutes and 0 seconds:

          bash
          Router(config-line)# exec-timeout 15 0

          This configuration means that if a user's session remains idle for 15 minutes, the session will be automatically disconnected.

          4. Exit Configuration Mode:

          • After configuring the execution timeout, exit the line configuration mode and return to global configuration mode.
          bash
          Router(config-line)# exit Router(config)#

          5. Save the Configuration:

          • To ensure that your configuration persists across router reboots, save the configuration to the router's startup-config file using the write memory command.
          bash
          Router(config)# end Router# write memory

          With the execution timeout configured, users who are inactive for the specified duration will be automatically logged out of their CLI session

        15. ============================================

        16. Prashant Shrivastava

Comments

Popular posts from this blog

CCNA Router and Catalyst Switch IOS Command Reference

Network Technologies

About myself