In this tutorial, we’ll guide you through the step-by-step process of configuring a Cisco router and switch to enable internet access for LAN users. We'll assign public IP addresses to the router’s WAN and LAN interfaces, configure DHCP on the switch for LAN users.
This setup ensures all LAN users can connect to the internet, with IP assignments handled automatically through DHCP. Let’s dive in!
Network Layout:
Router:WAN IP POOL: 203.0.113.0/30
WAN IP: 203.0.113.2 255.255.255.252
LAN IP POOL: 198.51.100.0/28
LAN IP: 198.51.100.1 255.255.255.240
Default route: 203.0.113.1
Switch: Switch Management IP: 198.51.100.2
DHCP Range for LAN Devices: 198.51.100.3 - 198.51.100.14
Cisco Router Configuration:
To set up the Cisco router, we’ll configure the WAN and LAN ports, set a default route, and assign IP addresses.
WAN Port Configuration:
- Objective: Configure the WAN interface to connect to the ISP.
- IP Address: 203.0.113.2
- Subnet Mask: 255.255.255.252
- ISP Gateway IP: 203.0.113.1
Router> enable Router# configure terminal Router(config)# interface GigabitEthernet0/0 Router(config-if)# ip address 203.0.113.2 255.255.255.252 Router(config-if)# no shutdown
- Objective: Set up the LAN interface to connect the router with the internal network.
- IP Address: 198.51.100.1
- Subnet Mask: 255.255.255.240
Router(config)# interface GigabitEthernet0/1 Router(config-if)# ip address 198.51.100.1 255.255.255.240 Router(config-if)# no shutdown
Default Route
- Objective: Forward all internet-bound traffic to the ISP gateway.
- Gateway IP: 203.0.113.1
Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1
Cisco Switch Configuration:
With the router configured, we’ll move on to the switch to enable DHCP and assign IPs to LAN devices within the same /28 subnet.
Configure Interface VLAN
- Objective: Assign an IP address to the management VLAN for switch administration.
- VLAN IP Address: 198.51.100.2
- Subnet Mask: 255.255.255.240
Switch> enable Switch# configure terminal Switch(config)# interface vlan 1 Switch(config-if)# ip address 198.51.100.2 255.255.255.240 Switch(config-if)# no shutdown
Default-Gateway
- Objective: Set the router as the default gateway for the switch.
- Gateway IP: 198.51.100.1 (Router LAN IP)
Switch(config)# ip default-gateway 198.51.100.1
Connect Route to Switch:
Here, the router's LAN cable is connected to the switch at GigabitEthernet0/24Switch(config)# int gig 0/24 Switch(config-if)#switchport mode access Switch(config-if)#switchport access vlan 1 Switch(config-if)#end
DHCP Configuration
- Objective: Configure DHCP on the switch to assign IP addresses to LAN devices.
- DHCP Range: 198.51.100.3 - 198.51.100.14
- Default Router: 198.51.100.1 (Router LAN IP)
- DNS Servers: 8.8.8.8 and 8.8.4.4
Switch(config)# ip dhcp pool LAN-CLIENTS Switch(dhcp-config)# network 198.51.100.0 255.255.255.240 Switch(dhcp-config)# default-router 198.51.100.1 Switch(dhcp-config)# dns-server 8.8.8.8 8.8.4.4
Testing the Configuration
- Connect LAN Devices: Ensure that LAN devices receive IPs from the 51.100.3 - 198.51.100.14 range.
- Ping External IPs: Verify internet connectivity by pinging a public IP (e.g., 8.8.8).
- DNS Resolution Test: Confirm DNS by pinging a domain (e.g., com).
Conclusion
Configuring Cisco routers and switches for internet access involves setting up WAN and LAN ports, a default route, and DHCP services for seamless connectivity. This configuration enables automatic IP allocation, reliable internet access, and efficient network management for connected devices. By following these steps, you can establish a well-structured network foundation suitable for various small to medium-sized environments