Cisco – Basic Hands-On Lab

 

Overview & Purpose

This configuration includes setting the hostname, enabling SSH, configuring interfaces, setting up DHCP, and ensuring internet access and inter-LAN communication.

Objectives

  1. Will understand the basic of Cisco configuration 

  2. Self-taught before production hands-on.

LAB Topology

Here is the lab topology

Step 1: Access the Router

Connect to your Cisco router via console or any other method and enter global configuration mode:


Router> enable
Router# configure terminal

Step 2: Set the Hostname

Set the router hostname to RTR-01:

Router(config)# hostname RTR-01

Step 3: Configure SSH and Secure Login

Enable SSH for secure remote access and configure the login credentials:

RTR-01(config)# ip domain-name example.com
RTR-01(config)# crypto key generate rsa
RTR-01(config)# username admin privilege 15 secret YourSecurePassword
RTR-01(config)# line vty 0 4
RTR-01(config-line)# transport input ssh
RTR-01(config-line)# login local
RTR-01(config-line)# exit
RTR-01(config)# ip ssh version 2

RTR-01(config)# enable secret MyPassword


Step 4: Configure Interfaces

Interface GigabitEthernet 0/0 (Connected to ISP)

Configure the interface to use DHCP for the ISP connection:

RTR-01(config)# interface GigabitEthernet0/0
RTR-01(config-if)# description Connected to the ISP
RTR-01(config-if)# ip address dhcp
RTR-01(config-if)# no shutdown
RTR-01(config-if)# exit


Interface GigabitEthernet 0/1 (Connected to LAN 1)

Configure the interface for the 172.16.22.0/24 network:

RTR-01(config)# interface GigabitEthernet0/1
RTR-01(config-if)# description Connected to LAN 1
RTR-01(config-if)# ip address 172.16.22.1 255.255.255.0
RTR-01(config-if)# no shutdown
RTR-01(config-if)# exit

Interface GigabitEthernet 0/2 (Connected to LAN 2)

Configure the interface for the 172.16.10.0/24 network:

RTR-01(config)# interface GigabitEthernet0/2
RTR-01(config-if)# description Connected to LAN 2
RTR-01(config-if)# ip address 172.16.10.1 255.255.255.0
RTR-01(config-if)# no shutdown
RTR-01(config-if)# exit

Step 5: Configure DHCP for Both Networks

Set up DHCP pools for both LANs:

DHCP for LAN 1 (172.16.22.0/24)

RTR-01(config)# ip dhcp pool LAN1
RTR-01(dhcp-config)# network 172.16.22.0 255.255.255.0
RTR-01(dhcp-config)# default-router 172.16.22.1
RTR-01(dhcp-config)# dns-server 8.8.8.8 8.8.4.4
RTR-01(dhcp-config)# exit

DHCP for LAN 2 (172.16.10.0/24)

RTR-01(config)# ip dhcp pool LAN2
RTR-01(dhcp-config)# network 172.16.10.0 255.255.255.0
RTR-01(dhcp-config)# default-router 172.16.10.1
RTR-01(dhcp-config)# dns-server 8.8.8.8 8.8.4.4
RTR-01(dhcp-config)# exit

Step 6: Enable NAT for Internet Access

Configure NAT to allow clients on both LANs to access the internet:

RTR-01(config)# access-list 1 permit 172.16.22.0 0.0.0.255
RTR-01(config)# access-list 1 permit 172.16.10.0 0.0.0.255
RTR-01(config)# interface GigabitEthernet0/0
RTR-01(config-if)# ip nat outside
RTR-01(config-if)# exit
RTR-01(config)# interface GigabitEthernet0/1
RTR-01(config-if)# ip nat inside
RTR-01(config-if)# exit
RTR-01(config)# interface GigabitEthernet0/2
RTR-01(config-if)# ip nat inside
RTR-01(config-if)# exit
RTR-01(config)# ip nat inside source list 1 interface GigabitEthernet0/0 overload

Step 7: Enable Inter-LAN Communication

By default, the router will allow communication between the two LANs since they are directly connected to the router. No additional configuration is required unless you want to restrict traffic (e.g., using ACLs). 

Now set both clients IP as dhcp by running the following command:

ip dhcp

The clients should fetch the IP address from the dhcp server of its own network dhcp pool server.

Step 8: Save the Configuration

Save the configuration on the router to ensure it persists after a reboot:

RTR-01(config)# end
RTR-01# write memory



Step 9: Verify the Configuration

Check Interfaces

show ip interface brief

Check NAT translation

Ensure that the client IPs already on the NAT table 

show ip nat translations

Check DHCP Leases

This will show the connected DHCP IPs of every connected user. 

show ip dhcp binding

Clear IP DHCP Leases

This will clear all DHCP binding IP addresses, so next time the client reconnects and releases the IP, it will get a new IP.

clear ip dhcp binding *


Or


clear ip dhcp 172.16.22.3

Check Routing Table

Check the routing tables, just to ensure that the client can access to the Internet

show ip route

Test Internet Access

ping 8.8.8.8 source 172.16.22.1
ping 8.8.8.8 source 172.16.10.1


Congratulations for your first lab!


Previous Post Next Post