Connecting Two LANs Using a Router
Experiment: Connecting Two LANs Using a Router
1. Aim
To design and configure two separate LANs connected through a router using Cisco Packet Tracer, assign appropriate IP addresses to the PCs and router interfaces, configure default gateways, and verify communication between the two LANs using the ping command.
2. Objectives
After completing this experiment, students should be able to:
- Create two separate LANs using switches.
- Connect two LANs using a router.
- Understand the need for a router when communicating between different IP networks.
- Configure IPv4 addresses on PCs.
- Configure IP addresses on router interfaces.
-
Enable router interfaces using
no shutdown. - Configure the default gateway on PCs.
- Examine the router's routing table.
- Understand directly connected routes.
-
Test communication within a LAN and between two different LANs using
ping. - Perform basic troubleshooting of inter-network connectivity.
3. Network Topology
Topology
ROUTER +------------------+ | | G0/0 | | G0/1 10.0.0.4| |192.168.1.4 +------------------+ / \ / \ / \ Switch 1 Switch 2 (LAN 1) (LAN 2) / | \ / | \ / | \ / | \ PC0 PC1 PC2 PC3 PC4 PC5
4. IP Addressing Scheme
The addressing scheme is:
LAN 1
Network:
10.0.0.0
Subnet mask:
255.0.0.0
Router interface:
GigabitEthernet0/0 = 10.0.0.4
PCs:
PC0 = 10.0.0.1 PC1 = 10.0.0.2 PC2 = 10.0.0.3
LAN 2
Network:
192.168.1.0
Subnet mask:
255.255.255.0
Router interface:
GigabitEthernet0/1 = 192.168.1.4
PCs:
PC3 = 192.168.1.1 PC4 = 192.168.1.2 PC5 = 192.168.1.3
5. Complete Addressing Table
| Device | Interface | IP Address | Subnet Mask | Default Gateway |
|---|---|---|---|---|
| Router | G0/0 | 10.0.0.4 | 255.0.0.0 | — |
| Router | G0/1 | 192.168.1.4 | 255.255.255.0 | — |
| PC0 | Fa0 | 10.0.0.1 | 255.0.0.0 | 10.0.0.4 |
| PC1 | Fa0 | 10.0.0.2 | 255.0.0.0 | 10.0.0.4 |
| PC2 | Fa0 | 10.0.0.3 | 255.0.0.0 | 10.0.0.4 |
| PC3 | Fa0 | 192.168.1.1 | 255.255.255.0 | 192.168.1.4 |
| PC4 | Fa0 | 192.168.1.2 | 255.255.255.0 | 192.168.1.4 |
| PC5 | Fa0 | 192.168.1.3 | 255.255.255.0 | 192.168.1.4 |
Important: The default gateway is essential in this experiment because PCs need to send packets to a different network. The router's interface on the same LAN acts as the default gateway.
6. Devices Required
| Device | Quantity |
|---|---|
| Cisco Router with at least 2 Gigabit Ethernet interfaces | 1 |
| Cisco 2960 Switch | 2 |
| PC | 6 |
| Copper Straight-Through Cable | 8 |
Cable requirement
- 3 cables: PCs → Switch 1
- 3 cables: PCs → Switch 2
- 1 cable: Switch 1 → Router G0/0
- 1 cable: Switch 2 → Router G0/1
Total:
8 straight-through cables
7. Theory
Consider the two networks:
LAN 1: 10.0.0.0/8 LAN 2: 192.168.1.0/24
These are two different IP networks.
A Layer-2 switch can connect devices within the same LAN, but it does not perform routing between different IP networks.
Therefore, a router is required.
LAN 1 LAN 2 10.0.0.0/8 192.168.1.0/24 | | | | Switch 1 Switch 2 | | +-------- Router ------------+ | G0/0 G0/1 10.0.0.4 192.168.1.4
The router has an interface in each network.
Therefore, it knows:
10.0.0.0/8 → G0/0 192.168.1.0/24 → G0/1
These routes are automatically added to the routing table as directly connected routes once the interfaces are configured and operational.
8. Procedure
Students should perform the following tasks in the given order.
Task 1: Start Cisco Packet Tracer
- Open Cisco Packet Tracer.
- Create a new workspace.
Task 2: Place the Router
- Select Network Devices.
- Select Routers.
- Choose a router having at least two Gigabit Ethernet interfaces.
- For example, you may use a Cisco 1941.
- Place it at the top/center of the workspace.
The router should provide:
GigabitEthernet0/0 GigabitEthernet0/1
Task 3: Place Two Switches
- Select Network Devices.
- Select Switches.
- Select a 2960 switch.
- Place two switches below the router.
Name them conceptually:
Switch0 → LAN1 Switch1 → LAN2
Task 4: Place Six PCs
From End Devices, place six PCs.
Arrange them as:
Router / \ Switch0 Switch1 / | \ / | \ PC0 PC1 PC2 PC3 PC4 PC5
Task 5: Connect LAN 1
Use Copper Straight-Through cables.
Connect:
PC0 FastEthernet0 → Switch0 FastEthernet0/1 PC1 FastEthernet0 → Switch0 FastEthernet0/2 PC2 FastEthernet0 → Switch0 FastEthernet0/3
Then connect:
Switch0 FastEthernet0/24 → Router GigabitEthernet0/0
The LAN should look like:
Router G0/0 10.0.0.4 | | Switch0 / | \ / | \ PC0 PC1 PC2 10.0.0.1 .2 .3
Task 6: Connect LAN 2
Again use Copper Straight-Through cables.
Connect:
PC3 FastEthernet0 → Switch1 FastEthernet0/1 PC4 FastEthernet0 → Switch1 FastEthernet0/2 PC5 FastEthernet0 → Switch1 FastEthernet0/3
Then connect:
Switch1 FastEthernet0/24 → Router GigabitEthernet0/1
The second LAN should look like:
Router G0/1 192.168.1.4 | | Switch1 / | \ / | \ PC3 PC4 PC5 192.168.1.1 .2 .3
Task 7: Verify the Physical Topology
Before configuring anything, check:
- Router is connected to Switch0.
- Router is connected to Switch1.
- PC0, PC1 and PC2 are connected to Switch0.
- PC3, PC4 and PC5 are connected to Switch1.
- Straight-through cables are used.
- All connections are physically correct.
Wait for the link indicators to become green.
Task 8: Configure PC0
Go to:
PC0 → Desktop → IP Configuration
Enter:
IP Address: 10.0.0.1 Subnet Mask: 255.0.0.0 Default Gateway: 10.0.0.4
Task 9: Configure PC1
Enter:
IP Address: 10.0.0.2 Subnet Mask: 255.0.0.0 Default Gateway: 10.0.0.4
Task 10: Configure PC2
Enter:
IP Address: 10.0.0.3 Subnet Mask: 255.0.0.0 Default Gateway: 10.0.0.4
Task 11: Configure PC3
Enter:
IP Address: 192.168.1.1 Subnet Mask: 255.255.255.0 Default Gateway: 192.168.1.4
Task 12: Configure PC4
Enter:
IP Address: 192.168.1.2 Subnet Mask: 255.255.255.0 Default Gateway: 192.168.1.4
Task 13: Configure PC5
Enter:
IP Address: 192.168.1.3 Subnet Mask: 255.255.255.0 Default Gateway: 192.168.1.4
Task 14: Configure Router Interface G0/0
Now configure the first router interface.
Click:
Router → CLI
You will see:
Router>
Enter:
enable
Then:
configure terminal
The prompt becomes:
Router(config)#
Select G0/0:
interface gigabitEthernet 0/0
Assign the IP address:
ip address 10.0.0.4 255.0.0.0
Enable the interface:
no shutdown
Exit:
exit
The complete sequence is:
Router> enable Router# configure terminal Router(config)# interface gigabitEthernet 0/0 Router(config-if)# ip address 10.0.0.4 255.0.0.0 Router(config-if)# no shutdown Router(config-if)# exit
You should see a message indicating that the interface has changed state to up.
Task 15: Configure Router Interface G0/1
From:
Router(config)#
enter:
interface gigabitEthernet 0/1
Assign:
ip address 192.168.1.4 255.255.255.0
Enable:
no shutdown
Exit:
exit
Complete commands:
Router(config)# interface gigabitEthernet 0/1 Router(config-if)# ip address 192.168.1.4 255.255.255.0 Router(config-if)# no shutdown Router(config-if)# exit
Then:
end
Task 16: Verify Router Interfaces
Enter:
show ip interface brief
You should see something similar to:
Interface IP-Address Status Protocol GigabitEthernet0/0 10.0.0.4 up up GigabitEthernet0/1 192.168.1.4 up up
Important observation
Both interfaces should ideally show:
Status up Protocol up
The commonly used shorthand is:
up/up
Task 17: Verify the Router Routing Table
Enter:
show ip route
You should find entries corresponding to:
C 10.0.0.0/8 is directly connected, GigabitEthernet0/0 C 192.168.1.0/24 is directly connected, GigabitEthernet0/1
You may also see L entries for the router's own interface addresses.
Important concept
The router did not require a static routing command in this experiment.
Why?
Because both networks are directly connected to the router.
The router automatically learns:
10.0.0.0/8 ↓ G0/0 192.168.1.0/24 ↓ G0/1
Task 18: Test Communication Within LAN 1
Open:
PC0 → Desktop → Command Prompt
First ping PC1:
ping 10.0.0.2
Then ping PC2:
ping 10.0.0.3
Both should succeed.
Why?
PC0, PC1 and PC2 belong to:
10.0.0.0/8
They are in the same LAN.
The communication does not need to go through the router.
Task 19: Test Communication Within LAN 2
From PC3:
ping 192.168.1.2
Then:
ping 192.168.1.3
Both should succeed.
Again, communication between PCs in the same LAN does not require routing through the router.
Task 20: Test Communication Between LAN 1 and LAN 2
This is the main objective of the experiment.
From PC0:
ping 192.168.1.1
This sends a packet from:
PC0 10.0.0.1
to:
PC3 192.168.1.1
The packet must pass through the router.
The path is:
PC0 ↓ Switch0 ↓ Router G0/0 ↓ Router G0/1 ↓ Switch1 ↓ PC3
The ping should succeed.
Task 21: Test PC0 to PC4
From PC0:
ping 192.168.1.2
Expected:
Reply from 192.168.1.2
Task 22: Test PC0 to PC5
From PC0:
ping 192.168.1.3
Expected:
Reply from 192.168.1.3
Task 23: Test Communication in the Reverse Direction
From PC3:
ping 10.0.0.1
From PC4:
ping 10.0.0.2
From PC5:
ping 10.0.0.3
These should also succeed.
This demonstrates that routing works in both directions.
9. Connectivity Test Table
Students should complete this table.
| Source | Destination | Ping Command | Result |
|---|---|---|---|
| PC0 | PC1 | ping 10.0.0.2 | ______ |
| PC0 | PC2 | ping 10.0.0.3 | ______ |
| PC3 | PC4 | ping 192.168.1.2 | ______ |
| PC3 | PC5 | ping 192.168.1.3 | ______ |
| PC0 | PC3 | ping 192.168.1.1 | ______ |
| PC0 | PC4 | ping 192.168.1.2 | ______ |
| PC0 | PC5 | ping 192.168.1.3 | ______ |
| PC3 | PC0 | ping 10.0.0.1 | ______ |
| PC4 | PC1 | ping 10.0.0.2 | ______ |
| PC5 | PC2 | ping 10.0.0.3 | ______ |
Expected result:
Successful
10. Task 24: Observe the Routing Process
Ask students to trace the path conceptually.
Suppose:
PC0 = 10.0.0.1
needs to communicate with:
PC3 = 192.168.1.1
PC0 determines that 192.168.1.1 is not in its local network.
Therefore, it sends the packet to its default gateway:
10.0.0.4
The router receives the packet through G0/0.
The router checks its routing table:
Destination Network Interface 10.0.0.0/8 G0/0 192.168.1.0/24 G0/1
It determines that the destination network is:
192.168.1.0/24
and forwards the packet through:
G0/1
The packet eventually reaches PC3.
11. Task 25: Use Simulation Mode
This is an excellent activity to help students visualize routing.
- Change Packet Tracer to Simulation Mode.
- From PC0, open the Command Prompt.
- Enter:
ping 192.168.1.1
- Observe the packets.
- Use Capture/Forward.
- Observe the path of the packet.
Students should identify that the packet travels:
PC0 ↓ Switch0 ↓ Router G0/0 ↓ Router G0/1 ↓ Switch1 ↓ PC3
Ask students:
Why does the packet have to pass through the router?
Expected answer:
Because PC0 and PC3 belong to different IP networks.
12. Task 26: Examine the Router Routing Table
On the router:
Router# show ip route
Ask students to locate the two important entries.
LAN 1
10.0.0.0/8
LAN 2
192.168.1.0/24
Discuss the meaning of:
C
which means:
Connected
and:
L
which means:
Local
13. Task 27: Deliberately Create a Gateway Error
This is a useful troubleshooting exercise.
Change PC0's default gateway from:
10.0.0.4
to:
10.0.0.5
Keep:
IP address = 10.0.0.1 Subnet mask = 255.0.0.0
Now execute:
ping 192.168.1.1
The ping should fail.
Ask students:
Why does communication fail even though PC0 has the correct IP address?
Because PC0 has been given an incorrect default gateway.
14. Task 28: Correct the Gateway
Change PC0's default gateway back to:
10.0.0.4
Repeat:
ping 192.168.1.1
The ping should succeed.
15. Task 29: Shut Down a Router Interface
This is another troubleshooting activity.
On the router:
enable configure terminal interface gigabitEthernet 0/1 shutdown
Now try from PC0:
ping 192.168.1.1
The communication should fail.
Check:
show ip interface brief
G0/1 should show:
administratively down
16. Task 30: Enable the Interface Again
Enter:
interface gigabitEthernet 0/1 no shutdown
Then:
end
Verify:
show ip interface brief
The interface should return to:
up up
Repeat:
ping 192.168.1.1
The ping should succeed.
17. Important Commands Used
| Purpose | Command |
|---|---|
| Enter privileged mode | enable |
| Enter configuration mode | configure terminal |
| Select G0/0 | interface gigabitEthernet 0/0 |
| Select G0/1 | interface gigabitEthernet 0/1 |
| Assign IP address | ip address IP MASK |
| Enable interface | no shutdown |
| Disable interface | shutdown |
| Verify interfaces | show ip interface brief |
| View routing table | show ip route |
| View configuration | show running-config |
| Test connectivity | ping IP-address |
| Save configuration | copy running-config startup-config |
18. Observation Table
Router Configuration
| Interface | IP Address | Subnet Mask | Status |
|---|---|---|---|
| G0/0 | 10.0.0.4 | 255.0.0.0 | __________ |
| G0/1 | 192.168.1.4 | 255.255.255.0 | __________ |
PC Configuration
| PC | IP Address | Mask | Gateway |
|---|---|---|---|
| PC0 | 10.0.0.1 | 255.0.0.0 | 10.0.0.4 |
| PC1 | 10.0.0.2 | 255.0.0.0 | 10.0.0.4 |
| PC2 | 10.0.0.3 | 255.0.0.0 | 10.0.0.4 |
| PC3 | 192.168.1.1 | 255.255.255.0 | 192.168.1.4 |
| PC4 | 192.168.1.2 | 255.255.255.0 | 192.168.1.4 |
| PC5 | 192.168.1.3 | 255.255.255.0 | 192.168.1.4 |
19. Expected Routing Table
After configuring both router interfaces, the important part of the routing table should contain routes similar to:
C 10.0.0.0/8 is directly connected, GigabitEthernet0/0 L 10.0.0.4/32 is directly connected, GigabitEthernet0/0 C 192.168.1.0/24 is directly connected, GigabitEthernet0/1 L 192.168.1.4/32 is directly connected, GigabitEthernet0/1
Students should understand:
The router knows about both networks because each network is directly connected to one of its interfaces.
No RIP, OSPF, EIGRP, or static route is necessary for this experiment.
20. Result
Two separate LANs were successfully created using Cisco Packet Tracer. Each LAN was connected to a different interface of a router. Appropriate IP addresses, subnet masks, and default gateways were configured on the PCs, and the router interfaces were configured and enabled. Connectivity within each LAN and communication between the two different LANs were successfully verified using the ping command. The router's directly connected routes were also examined using the show ip route command.
Comments
Post a Comment