Configure basic switch and router configurations using CLI commands.


Configuring basic switch and router settings using Command Line Interface (CLI) commands involves accessing the devices' command-line interface and entering specific commands to set up various parameters. Below, I'll provide a basic guide for configuring a switch and a router separately.

Basic Switch Configuration:

  1. Access the Switch CLI:
    • Connect to the switch using a console cable or through a network connection (SSH or Telnet).
    • Use a terminal emulation program like PuTTY or HyperTerminal.
  2. Enter Privileged EXEC Mode:bashCopy codeSwitch> enable
    Switch#

  3. Configure the Switch Hostname:bashCopy codeSwitch# configure terminal
    Switch(config)# hostname SWITCH_NAME
    SWITCH_NAME(config)#

  4. Configure Interface VLAN (SVI):bashCopy codeSWITCH_NAME(config)# interface vlan 1
    SWITCH_NAME(config-if)# ip address SWITCH_IP_ADDRESS SWITCH_SUBNET_MASK
    SWITCH_NAME(config-if)# no shutdown
    SWITCH_NAME(config-if)# exit

  5. Set a Management IP (Optional):bashCopy codeSWITCH_NAME(config)# interface vlan 1
    SWITCH_NAME(config-if)# ip address SWITCH_MANAGEMENT_IP SWITCH_MANAGEMENT_SUBNET_MASK
    SWITCH_NAME(config-if)# exit

  6. Configure Port Settings (Optional):bashCopy codeSWITCH_NAME(config)# interface range GigabitEthernet0/1 - 24
    SWITCH_NAME(config-if-range)# switchport mode access
    SWITCH_NAME(config-if-range)# switchport access vlan 1
    SWITCH_NAME(config-if-range)# exit

  7. Save Configuration:bashCopy codeSWITCH_NAME# write memory

Basic Router Configuration:

  1. Access the Router CLI:
    • Connect to the router using a console cable or through a network connection (SSH or Telnet).
    • Use a terminal emulation program like PuTTY or HyperTerminal.
  2. Enter Privileged EXEC Mode:bashCopy codeRouter> enable
    Router#

  3. Configure the Router Hostname:bashCopy codeRouter# configure terminal
    Router(config)# hostname ROUTER_NAME
    ROUTER_NAME(config)#

  4. Configure Interface IP Addresses:bashCopy codeROUTER_NAME(config)# interface GigabitEthernet0/0
    ROUTER_NAME(config-if)# ip address ROUTER_IP_ADDRESS ROUTER_SUBNET_MASK
    ROUTER_NAME(config-if)# no shutdown
    ROUTER_NAME(config-if)# exit

  5. Configure Routing (if needed):bashCopy codeROUTER_NAME(config)# ip routing
  6. Set a Default Gateway (if needed):bashCopy codeROUTER_NAME(config)# ip route 0.0.0.0 0.0.0.0 GATEWAY_IP_ADDRESS
  7. Save Configuration:bashCopy codeROUTER_NAME# write memory