Stackvora.tech

Cisco Routing & Switching Lab Setup with Packet Tracer

Cisco Packet Tracer is a powerful simulation tool essential for network engineers, system administrators, and developers looking to understand and…

Cisco Packet Tracer is a powerful simulation tool essential for network engineers, system administrators, and developers looking to understand and practice Cisco routing and switching concepts without expensive hardware. This article provides a comprehensive guide to setting up a multi-area OSPF lab within Packet Tracer, covering device selection, initial configuration, inter-VLAN routing, OSPFv2 deployment, and basic troubleshooting.

While Packet Tracer provides a highly realistic simulation environment for many core CCNA and CCNP topics, it's crucial to remember that it is a simulator, not an emulator. Advanced features, specific ASIC behaviors, or complex protocol interactions found in real hardware may not be perfectly replicated. However, for foundational learning and design prototyping, it remains an invaluable resource.

Obtaining and Installing Packet Tracer

Cisco Packet Tracer is freely available to anyone enrolled in a Cisco Networking Academy course. The most common entry point is the "Getting Started with Cisco Packet Tracer" course, which is self-paced and free. Follow these steps:

  1. Create an account on netacad.com.
  2. Enroll in the "Getting Started with Cisco Packet Tracer" course.
  3. Once enrolled, navigate to the "Resources" section within the course interface to find the download links for Windows, macOS, or Linux.
  4. Download the appropriate installer for your operating system (e.g., PacketTracer-8.2.1-ubuntu-64bit.deb for Linux or PacketTracer_821_Windows_64bit_setup.exe for Windows). The current stable version as of this writing is 8.2.1.
  5. Install Packet Tracer by running the downloaded installer. On Windows, follow the wizard. On Linux (Debian/Ubuntu), use sudo dpkg -i PacketTracer-*.deb, then sudo apt install -f to resolve dependencies if necessary.
  6. Launch Packet Tracer and log in using your NetAcad credentials. This authentication is required periodically to use the software.

Building a Basic Inter-VLAN Routing Topology

Let's start by constructing a common scenario: a router-on-a-stick providing inter-VLAN routing for two separate VLANs on a switch.

Device Selection

  • Router: Drag a 1941 router from the "Network Devices" -> "Routers" category. This model provides two Gigabit Ethernet interfaces by default (GigabitEthernet0/0 and GigabitEthernet0/1), suitable for our needs.
  • Switch: Drag a 2960-24TT switch from "Network Devices" -> "Switches". This is a Layer 2 switch, requiring a separate router for inter-VLAN routing.
  • End Devices: Drag two PCs from "End Devices". We'll assign each to a different VLAN.

Cabling

  • Connect PC0 to Switch0's FastEthernet0/1 using a copper straight-through cable.
  • Connect PC1 to Switch0's FastEthernet0/2 using a copper straight-through cable.
  • Connect Router0's GigabitEthernet0/0 to Switch0's GigabitEthernet0/1 using a copper straight-through cable. This link will carry traffic for both VLANs.

Initial Configuration

Configure the PCs with static IP addresses and default gateways:


// PC0 (VLAN 10)
IP Address: 192.168.10.10
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.10.1

// PC1 (VLAN 20)
IP Address: 192.168.20.10
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.20.1

Now, configure the switch (Switch0):


Switch>enable
Switch#configure terminal
Switch(config)#hostname SW1
SW1(config)#vlan 10
SW1(config-vlan)#name PC_VLAN_10
SW1(config-vlan)#exit
SW1(config)#vlan 20
SW1(config-vlan)#name PC_VLAN_20
SW1(config-vlan)#exit
SW1(config)#interface FastEthernet0/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#interface FastEthernet0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#interface GigabitEthernet0/1
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk encapsulation dot1q  // Optional on 2960, but good practice for other models
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#end
SW1#copy running-config startup-config

Finally, configure the router (Router0) for router-on-a-stick:


Router>enable
Router#configure terminal
Router(config)#hostname R1
R1(config)#interface GigabitEthernet0/0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface GigabitEthernet0/0.10
R1(config-subif)#encapsulation dot1Q 10
R1(config-subif)#ip address 192.168.10.1 255.255.255.0
R1(config-subif)#exit
R1(config)#interface GigabitEthernet0/0.20
R1(config-subif)#encapsulation dot1Q 20
R1(config-subif)#ip address 192.168.20.1 255.255.255.0
R1(config-subif)#exit
R1(config)#end
R1#copy running-config startup-config

After this, PC0 should be able to ping PC1 and vice-versa, demonstrating successful inter-VLAN routing.

Advanced Lab: Multi-Area OSPFv2 Deployment

Let's expand our lab to include multiple routers and OSPFv2, a common interior gateway protocol (IGP).

Topology Expansion

Add two more 1941 routers (Router1, Router2) and connect them as follows:

  • Connect Router0's GigabitEthernet0/1 to Router1's GigabitEthernet0/0. (Link 1: 10.0.0.0/30)
  • Connect Router1's GigabitEthernet0/1 to Router2's GigabitEthernet0/0. (Link 2: 10.0.0.4/30)

We'll configure Router0 as an Area Border Router (ABR) connecting Area 0 (backbone) and Area 1. Router1 will be a backbone router (Area 0), and Router2 will be in Area 0 as well, but with a loopback in Area 2.

OSPFv2 Configuration

Assign IP addresses and OSPF processes.

Router 0 (R1 - ABR)

Continues from previous config. G0/0 is the inter-VLAN subinterfaces. G0/1 will be our OSPF link to R1.


R1(config)#interface GigabitEthernet0/1
R1(config-if)#ip address 10.0.0.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 192.168.10.0 0.0.0.255 area 1 // VLAN 10 network in Area 1
R1(config-router)#network 192.168.20.0 0.0.0.255 area 1 // VLAN 20 network in Area 1
R1(config-router)#network 10.0.0.0 0.0.0.3 area 0  // Link to R1 in Area 0 (Backbone)
R1(config-router)#end
R1#copy running-config startup-config

Notice the use of 0.0.0.3 as the wildcard mask for a /30 subnet (255.255.255.252).

Router 1 (R2 - Backbone Router)


Router>enable
Router#configure terminal
Router(config)#hostname R2
R2(config)#interface GigabitEthernet0/0
R2(config-if)#ip address 10.0.0.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface GigabitEthernet0/1
R2(config-if)#ip address 10.0.0.5 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 10.0.0.0 0.0.0.3 area 0 // Link to R1 in Area 0
R2(config-router)#network 10.0.0.4 0.0.0.3 area 0 // Link to R3 in Area 0
R2(config-router)#end
R2#copy running-config startup-config

Router 2 (R3 - Internal Area 0, with Loopback in Area 2)


Router>enable
Router#configure terminal
Router(config)#hostname R3
R3(config)#interface GigabitEthernet0/0
R3(config-if)#ip address 10.0.0.6 255.255.255.252
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface Loopback0
R3(config-if)#ip address 172.16.1.1 255.255.255.0
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 10.0.0.4 0.0.0.3 area 0 // Link to R2 in Area 0
R3(config-router)#network 172.16.1.0 0.0.0.255 area 2 // Loopback network in Area 2
R3(config-router)#end
R3#copy running-config startup-config

At this stage, R1 and R2 should establish an OSPF adjacency, as should R2 and R3. R1 will become an ABR for Area 1, and R3 for Area 2.

Verification Commands

Use these commands to verify OSPF operation:

  • show ip ospf neighbor: Displays OSPF neighbor information (state, dead timer, address). Look for "FULL/DR" or "FULL/BDR" states.
  • show ip ospf database: Displays the link-state database. You should see different LSA types (Router LSA, Network LSA, Summary LSA for ABRs).
  • show ip route ospf: Shows routes learned via OSPF. Pay attention to O (intra-area), O IA (inter-area), and O E1/E2 (external routes, not covered here).
  • show ip protocols: Provides a summary of all routing protocols configured.

From PC0, you should now be able to ping 172.16.1.1 (R3's loopback interface), demonstrating full end-to-end connectivity across multiple OSPF areas.

Comparing Packet Tracer Capabilities

While Packet Tracer is excellent for foundational understanding, it has limitations compared to more advanced tools like GNS3 or EVE-NG, which use actual Cisco IOS images.

Feature Cisco Packet Tracer GNS3 / EVE-NG (with IOS images)
Cost Free (via NetAcad) Free (open source), but requires licensed Cisco IOS images
Resource Usage Low (simulator) High (emulator, runs VMs)
Protocol Support Good for CCNA/early CCNP, some advanced features missing Full feature set of actual IOS image
Device Variety Fixed set of simulated devices Any device supported by QEMU/VMware (routers, firewalls, Linux hosts, etc.)
External Connectivity Limited to host machine (using Generic Cloud) Excellent, seamless integration with host and external networks
Automation Scripting Limited (Python within Packet Tracer) Full Python/Ansible/Netmiko support due to actual CLI access
Troubleshooting Realism Simulated output, may differ from real hardware Authentic IOS CLI output and behavior

Common Pitfalls and Troubleshooting

  • No OSPF Adjacency:
    • Mismatched Area IDs: Ensure neighbors are in the same area for directly connected links.
    • Mismatched Subnets/Masks: OSPF requires matching primary subnet masks for adjacencies on broadcast networks (default for Ethernet).
    • Missing network commands: The network command activates OSPF on interfaces and defines the area.
    • Interface State: Ensure interfaces are "up/up" (no shutdown).
    • Router ID Conflicts: While not preventing adjacency, it can cause issues. Ensure each router has a unique ID (configured manually or derived from highest IP).
    • Packet Tracer Bug: Occasionally, deleting and re-creating a link, or power cycling a device, can resolve transient issues.
  • Inter-VLAN Routing Failure:
    • Trunking Misconfiguration: Ensure the switchport connected to the router is in switchport mode trunk and the router subinterfaces have correct encapsulation dot1Q .
    • VLAN Assignment: Verify access ports are assigned to the correct VLANs (show vlan brief).
    • IP Addressing: Double-check PC IP addresses, subnet masks, and default gateways matching their respective VLAN subinterface IPs.
  • Missing Routes:
    • Incorrect network statements: OSPF network commands use wildcard masks. A common error is using a subnet mask instead. For example, for a /24 network (255.255.255.0), the wildcard mask is 0.0.0.255.
    • Area Boundary Issues: Ensure backbone (Area 0) connectivity is continuous. Non-backbone areas must connect to Area 0.
    • Firewall/ACLs: Though not explicitly configured in this lab, always check for hidden ACLs or firewalls blocking OSPF traffic (multicast 224.0.0.5, 224.0.0.6).
  • Saving Configuration: Always use copy running-config startup-config or wr mem to save configurations before closing Packet Tracer or powering off devices.

Back to the knowledge base · Ask the AI assistant