Hi everyone, in this article we start building our first real network in Cisco Packet Tracer: a simple LAN with one switch and three PCs. I cover how to set an IP address on each PC, how to give a Cisco switch a management IP so it can be pinged and reached from the network, and how to check the MAC address table the switch learns.
I do every step directly in Cisco Packet Tracer 8.2.1 with a Cisco 2960 switch. If you have not memorized the enable and configure terminal commands yet, read my guide on basic Cisco Packet Tracer commands and what they do first.
Building the Switch and PC Topology
Place the devices and cables

The devices you need are 1 Cisco 2960-24TT switch and 3 PCs (PC-PT). A PC and a switch are different types of devices, so every link uses the Copper Straight-Through cable, which is the solid black line in the Connections category.
PC0 FastEthernet0 -> Switch0 FastEthernet0/1 (straight)
PC1 FastEthernet0 -> Switch0 FastEthernet0/2 (straight)
PC2 FastEthernet0 -> Switch0 FastEthernet0/3 (straight)Click the straight cable icon, click a PC and choose the FastEthernet0 port, then click the switch and choose the destination port. Repeat this for each PC. Wait until the triangles at both ends of every cable turn green. They stay orange for about 30 seconds at first because the switch is still running the Spanning Tree process.
To keep things easy to remember, I use the following IP plan.
PC0 192.168.10.11 255.255.255.0
PC1 192.168.10.12 255.255.255.0
PC2 192.168.10.13 255.255.255.0
Switch0 192.168.10.2 255.255.255.0 (interface VLAN 1)Configuring the IP Address on Each PC
Enter the IP in IP Configuration

Click PC0, open the Desktop tab, then IP Configuration. Make sure Static is selected, enter 192.168.10.11 as the IPv4 Address, then click the Subnet Mask field. Packet Tracer fills in 255.255.255.0 automatically because 192.168.10.11 is a class C address. Do the same for PC1 and PC2 with their own IP addresses. Leave the Default Gateway empty for now, since there is no router on this network yet.
Configuring the Management IP on the Switch
A layer 2 switch like the 2960 does not need an IP address to forward data between PCs. However, for the switch to be pinged, monitored, and later managed remotely over Telnet or SSH, it needs a management IP. This IP goes on the VLAN 1 interface, not on a FastEthernet port.
Assign the IP to interface VLAN 1

Click the switch, open the CLI tab, press Enter until the Switch> prompt appears, then type the following commands.
enable
configure terminal
hostname SW-LAB
interface vlan 1
ip address 192.168.10.2 255.255.255.0
no shutdown
exit
ip default-gateway 192.168.10.1
endThe VLAN 1 interface on a Cisco switch is shut down by default, so you must type no shutdown. After that, the message Interface Vlan1, changed state to up appears, which means the interface is now active.
The ip default-gateway 192.168.10.1 command tells the switch where to send packets that leave the local network. There is no router in this topology yet, but I am reserving the .1 address for the router in the next article.
Check the switch ports and IP

show ip interface brief | include upPorts Fa0/1 through Fa0/3, which connect to the PCs, are up, and Vlan1 now has the IP 192.168.10.2 with an up status.
Testing Connectivity with Ping
Ping between PCs

Click PC0, open Desktop and then Command Prompt, and ping PC2.
ping 192.168.10.13Four replies come back with Lost = 0 (0% loss), which means PC0 and PC2 can already talk to each other through the switch.
Ping the switch IP

ping 192.168.10.2The first reply is Request timed out, and the next three succeed. This is normal. The PC uses the first packet to look up the switch MAC address through ARP, so it times out before a reply arrives. If you ping a second time, you get 4 out of 4 right away.
Viewing the Switch MAC Address Table
Check the MAC addresses the switch has learned

Go back to the switch CLI and run the following command.
show mac address-tableThe switch records the MAC address of each PC along with the port that PC is plugged into. In this table you can see PC0 on Fa0/1, PC1 on Fa0/2, and PC2 on Fa0/3, all in VLAN 1 with the DYNAMIC type because they were learned automatically from traffic. This table is what lets the switch send data straight to the destination port instead of flooding it out every port.
Save the switch configuration

write memoryThe [OK] message means the management IP configuration is saved and will not be lost when the switch restarts.
Common Problems and How to Fix Them
Every ping to the switch fails
This usually happens because no shutdown was never typed on interface vlan 1. Check with show ip interface brief. If Vlan1 is still administratively down, go back into interface vlan 1 and type no shutdown.
Ping between PCs shows Request timed out
Make sure every PC is on the same network, which is 192.168.10.x with a subnet mask of 255.255.255.0, and that no two PCs share the same IP. Also make sure the lights at both ends of each cable are green, not orange or red.
The MAC address table is empty
A switch only records MAC addresses once traffic comes in from the PCs. Run a ping from one of the PCs first, then run show mac address-table again.
At this point you have a simple LAN running with one switch and three PCs, the switch has a management IP, and you can read its MAC address table. In the next article we will add a router so two different networks can talk to each other. If you run into any other error while trying this, just leave a comment below.












