Skip to content

5.2 Routing

In a DHCP-enabled LAN, devices usually get dynamic IPs assigned by the DHCP server. However, in some cases, using static IPs is necessary to ensure consistent network performance and accessibility.

Why Static IPs in a DHCP-enabled Network?

  1. Reliability for Critical Devices – Some network devices need a consistent IP to function properly. If their IP changes, connectivity issues may arise.
  2. Port Forwarding & Remote Access – Services like web servers, VPNs, and remote desktop connections rely on a fixed IP for proper routing.
  3. Avoiding DHCP Conflicts – If a device has a static IP outside the DHCP range, it won’t be reassigned, preventing network conflicts.
  4. Security & Access Control – Static IPs help firewalls, access lists, and security policies enforce rules for specific devices.

Good Examples of Using Static IPs in a DHCP Network

  1. Network Printers – If a printer’s IP changes, users would need to update their settings frequently. A static IP ensures seamless printing.
  2. Servers (Web, File, Database, etc.) – A web or file server needs a fixed address so clients can always reach it.
  3. IP Cameras & Security Systems – Surveillance systems require fixed IPs for reliable monitoring and recording.
  4. VoIP Phones – To ensure quality service, VoIP devices are often assigned static IPs for seamless call routing.
  5. Network Infrastructure (Routers, Switches, APs) – Assigning static IPs to core devices ensures easy management and troubleshooting.

Best Practice

  • Use static IPs for essential devices while allowing DHCP for general devices like laptops and mobile phones.
  • Assign static IPs outside the DHCP pool to avoid conflicts.

=====================

1. Basics of Routers in Packet Tracer

A router operates primarily at Layer 3 (Network Layer) and is responsible for connecting different networks together. Routers forward data between networks based on IP addresses.

  • Function: A router connects multiple networks and determines the best path for data to travel across different subnets.

1.1 Example of Router Configuration in Packet Tracer

  1. Drag a Router:

    • Open Packet Tracer and drag a Router (e.g., Router 2900 or Router 1941) onto the workspace.
  2. Connect Devices to the Router:

    • Use copper straight-through cables to connect the router to two PCs (or more, depending on the example). You will need two routers if you want to simulate communication between multiple subnets.
  3. Assign IP Addresses to the PCs:

    • Assign different IP addresses to the PCs for each network (subnet):
      • PC1 (Subnet 1): 192.168.1.2/24.
      • PC2 (Subnet 2): 192.168.2.2/24.
  4. Configure Router Interfaces:

    • Click on the router and go to the CLI tab to configure the router’s interfaces.

    For Router’s First Interface (connected to Subnet 1):

    Terminal window
    Router> enable
    Router# configure terminal
    Router(config)# interface gigabitEthernet0/0
    Router(config-if)# ip address 192.168.1.1 255.255.255.0
    Router(config-if)# no shutdown
    Router(config-if)# exit

    For Router’s Second Interface (connected to Subnet 2):

    Terminal window
    Router(config)# interface gigabitEthernet0/1
    Router(config-if)# ip address 192.168.2.1 255.255.255.0
    Router(config-if)# no shutdown
    Router(config-if)# exit

    Explanation:

    • The first interface (GigabitEthernet0/0) connects to PC1’s subnet (192.168.1.0/24).
    • The second interface (GigabitEthernet0/1) connects to PC2’s subnet (192.168.2.0/24).
  5. Enable Routing (Static Route): If you want to enable communication between the two networks (subnets), you can use static routing. This tells the router how to reach the other subnet.

    On the router, enter the following command to create a static route:

    Terminal window
    Router(config)# ip route 192.168.2.0 255.255.255.0 192.168.1.1

    This tells the router that if it wants to reach the 192.168.2.0/24 network, it should send the traffic to the 192.168.1.1 interface.

  6. Testing Connectivity:

    • Ping from PC1 to PC2:

      • On PC1, open the Command Prompt and type:
        Terminal window
        ping 192.168.2.2
      • If the router and interfaces are correctly configured, PC1 will be able to communicate with PC2 across different subnets.

      Explanation: The router receives the packet from PC1, forwards it to the correct interface, and routes it to PC2.

1.2 Complete Example: Connecting Two Networks Using a Switch and Router

Goal

You have two PCs, each on different subnets, and you want them to communicate using a router. We’ll use a switch for internal communication within each subnet and a router to route traffic between the two subnets.

Step-by-Step

  1. Add Devices:

    • Add a Switch, two PCs, and a Router to the workspace.
  2. Connect PCs to the Switch:

    • Use copper straight-through cables to connect PC1 to the switch and PC2 to the switch.
  3. Assign IP Addresses:

    • PC1: IP address: 192.168.1.2, Subnet mask: 255.255.255.0
    • PC2: IP address: 192.168.2.2, Subnet mask: 255.255.255.0
  4. Connect the Router to the Switch:

    • Use copper straight-through cables to connect Router interfaces to the switch.
  5. Configure Router Interfaces:

    • On Router, configure GigabitEthernet0/0 for PC1’s subnet (192.168.1.1/24).
    • Configure GigabitEthernet0/1 for PC2’s subnet (192.168.2.1/24).
  6. Add Static Route:

    • On Router, add a route between the subnets:
      Terminal window
      Router(config)# ip route 192.168.2.0 255.255.255.0 192.168.1.1
  7. Test the Configuration:

    • From PC1, ping PC2:
      Terminal window
      ping 192.168.2.2
    • If everything is configured correctly, the ping will be successful, and PC1 can now communicate with PC2 across different subnets.

2. Static Routing

3. Dynamic Routing

NAT