How to Connect Switch to Router in Packet Tracer
In this article
To connect a switch to a router in Cisco Packet Tracer, you use a straight-through Ethernet cable (Copper Straight-Through) between a GigabitEthernet port on the router and a FastEthernet or GigabitEthernet port on the switch. Then you assign an IP address to the router interface and optionally configure the switch with a management IP or VLANs. This setup lets devices on the switch communicate with other networks through the router. Before starting, make sure you have Packet Tracer installed and a basic understanding of the workspace—drag devices from the bottom-left panel onto the canvas.
What You'll Need
- Cisco Packet Tracer (any recent version, e.g., 7.x or 8.x)
- A router model (e.g., 2911 or 4321)
- A switch model (e.g., 2960 or 3650)
- At least one end device (PC or laptop) if you want to test connectivity
- Basic knowledge of dragging devices and using the cable tool
Step-by-Step
- Open Packet Tracer and create a new blank project. You’ll see the device panel at the bottom left.
- Add a router: In the bottom-left panel, click on “Routers,” then drag a router model (like the 2911) onto the canvas.
- Add a switch: Click on “Switches” in the same panel, then drag a switch (like the 2960) onto the canvas, placing it near the router.
- Add a PC (optional but recommended): Click on “End Devices,” then drag a PC onto the canvas and connect it to the switch later.
- Select the cable tool: In the top toolbar, click the lightning bolt icon (or the cable icon). Choose “Copper Straight-Through” from the connection types.
- Connect router to switch: Click on the router first. A list of ports will pop up—select a GigabitEthernet port (e.g., GigabitEthernet0/0). Then click on the switch and select an Ethernet port (e.g., FastEthernet0/1). The link will appear as a green line when both ends are connected.
- Connect PC to switch: With the same cable type, click on the PC, choose FastEthernet0, then click on the switch and choose another port (e.g., FastEthernet0/2).
- Configure the router interface: Click on the router to open its configuration window. Go to the “CLI” tab. Enter global configuration mode by typing
enable, thenconfigure terminal. Then select the interface you connected:interface gigabitethernet0/0. Assign an IP address and subnet mask, for example:ip address 192.168.1.1 255.255.255.0. Then bring the interface up withno shutdown. Exit withexit. - Configure the PC (optional): Click on the PC, go to the “Desktop” tab, then “IP Configuration.” Set IP address to 192.168.1.2, subnet mask to 255.255.255.0, and default gateway to 192.168.1.1 (the router’s IP).
- Test connectivity: Open the PC’s Command Prompt (Desktop > Command Prompt) and type
ping 192.168.1.1. If you get replies, the connection works. - Optional: Configure the switch for management: If you want the switch to be managed, you can assign an IP to its VLAN 1 interface. Click on the switch, go to CLI, and type:
enable,configure terminal,interface vlan 1,ip address 192.168.1.10 255.255.255.0,no shutdown, thenexit. Also set a default gateway:ip default-gateway 192.168.1.1.
Common Mistakes
- Using a crossover cable instead of straight-through. For router-to-switch, straight-through is correct (crossover is for same device types like switch-to-switch).
- Forgetting to enable the router interface with
no shutdown. By default, router interfaces are administratively down. - Connecting to the wrong port on the router—make sure you configure the exact interface you clicked when connecting the cable.
- Not setting a default gateway on the PC, so ping to the router fails even though the link is up.
- Using the wrong IP subnet—the router and PC must be in the same subnet (e.g., both 192.168.1.x).
Tips
- Use the “Inspect” tool (magnifying glass icon) to check link status—green means up, red means down.
- Label your devices and ports using the “Place Note” tool (paper icon) to keep track of IPs and connections.
- If you’re planning to expand, use GigabitEthernet ports on the switch for trunk links and FastEthernet for end devices—this matches typical real-world setups.
- Save your project frequently (File > Save) to avoid losing work.
- Use the “Simulation” mode (bottom-right) to watch packets travel step-by-step, which helps understand the data flow.
Troubleshooting
If the ping fails or the link is red, follow these checks in order:
- Check the cable type: Right-click the cable and select “Delete” if it’s wrong, then re-add with Copper Straight-Through. A red link often means wrong cable type or a port is off.
- Verify the router interface is up: In the router CLI, type
show ip interface brief. The interface you configured should show “up/up”. If it says “administratively down”, you forgotno shutdown. - Check IP addresses: On the PC, run
ipconfigin Command Prompt to confirm the IP and subnet. On the router, useshow running-configto see the interface IP. - Ping from the router first: In the router CLI, type
ping 192.168.1.2(the PC’s IP). If that works but PC-to-router ping fails, the issue is on the PC side (gateway or IP). - Restart the devices: In Packet Tracer, you can power-cycle a device by clicking it and selecting “Power” from the physical tab, then turning it back on. This resets the device state.
- Check for VLAN mismatches: If you configured VLANs on the switch, ensure the port connected to the router is in the correct VLAN (default is VLAN 1). Use
show vlan briefon the switch.
Frequently Asked Questions
Can I use a crossover cable instead?
Yes, but it’s not necessary. Modern equipment and Packet Tracer support auto-MDIX, so either works, but straight-through is the standard for router-to-switch.
Do I need to configure the switch at all?
No, for basic connectivity, a switch works out of the box. You only configure it if you want management access or VLANs.
What if my router has no GigabitEthernet port?
Some older router models (like 1841) have FastEthernet ports only. Use those—just make sure the interface name matches (e.g., FastEthernet0/0).
How do I connect multiple switches to one router?
Connect each switch to a separate router interface, or daisy-chain switches (switch to switch) and have one switch connect to the router. The router needs a different subnet for each interface if you want separate networks.
Why is my link green but ping fails?
This usually means the physical layer is fine but Layer 3 is misconfigured—check IP addresses, subnet masks, and default gateways.
Can I connect a switch to a router using a console cable?
No, console cables are for management (configuration) only, not for network traffic. Use Ethernet cables for data.