Your First CCNA Lab: Why Two PCs on the Same Switch Can't Ping Each Other

2026-12-03来源 dev.toEnglish

You connect two PCs to the same switch, give them IP addresses in the same subnet, and run a ping. It fails. Both switch ports are up and the IP settings look right. What should you check next?

In this Cisco Packet Tracer lab, you'll reproduce the problem, fix it, and use two switch commands to explain what happened.

1. Build the lab

Add two PCs and one Cisco 2960 switch in Packet Tracer. Connect each PC to the switch using a copper straight-through cable.

Device Switch port IPv4 address Subnet mask
PC1 Fa0/1 192.168.10.10 255.255.255.0
PC2 Fa0/2 192.168.10.20 255.255.255.0

On each PC, open Desktop → IP Configuration and enter the settings from the table. Leave the default gateway blank for this exercise.

2. Put the PCs in different VLANs

Open the switch CLI and enter:

enable configure terminal vlan 10 name TRAINING exit vlan 20 name TEST exit interface fastEthernet0/1 switchport mode access switchport access vlan 10 exit interface fastEthernet0/2 switchport mode access switchport access vlan 20 end 

On PC1, open Desktop → Command Prompt and run:

ping 192.168.10.20 

Expected result: The ping fails.

PC1 sees 192.168.10.20 as a local address and broadcasts an ARP request to learn PC2's MAC address. The switch keeps that broadcast within VLAN 10. PC2 is in VLAN 20, so it never receives the request.

3. Verify the port assignments

Run this command in the switch CLI:

show vlan brief 

Look for Fa0/1 under VLAN 10 and Fa0/2 under VLAN 20. These assignments explain why the ARP request never reached PC2.

4. Move PC2 into VLAN 10

configure terminal interface fastEthernet0/2 switchport access vlan 10 end 

Return to PC1 and run the ping again:

ping 192.168.10.20 

Expected result: PC2 replies. If the first attempt times out, run the ping again to allow ARP resolution to complete.

After the PCs exchange traffic, check the switch's MAC address table:

show mac address-table dynamic 

Look for both PCs' MAC addresses under VLAN 10, one on Fa0/1 and the other on Fa0/2.

Try it in Simulation mode

Move PC2 back to VLAN 20, switch Packet Tracer to Simulation mode, and filter for ARP and ICMP. Repeat the ping and follow the ARP request. Then move PC2 into VLAN 10 and repeat the test. If the PCs already cached each other's MAC addresses from the earlier test, power-cycle the PCs before starting the simulation.

When two devices in the same subnet can't reach each other, check the link status, IP addresses and subnet masks, and access VLAN assignments.

For more hands-on practice with switching and routing, explore AimNxt's CCNA & CCNP Networking course in Hyderabad.

原文:https://www.a8q9.cn/en/article/your-first-ccna-lab-why-two-pcs-on-the-same-switch-can-t-ping-each-other-67c74f.html

相关文章