ccna-notes

Static Routing

Consider the following network topology

Network topology for Static Routing examples

Default Gateway

To send packets to destinations outside of the transmitter’s local network, they must send the packets to their default gateway.

Default gateway of PC1 and PC4

Static Routes

Lets look at the following example where PC1 wants to send something to PC4

R1 gets a packet from PC1 for PC4

  1. PC1 sends a frame through its default gateway (R1)
  2. R1 de-encapsulates the frame (look at the packet)
  3. R1 will check the routing table for the most-specific matching route
    • The following is R1s routing table atm:

    Routing table only has the default routes so far

  4. R1 has no matching routes in its routing table so it will drop the packge

There are two possible path packets from PC1 to PC4 can take:

* `PC1` --> `R1` --> `R3` --> `R4` --> `PC4`
* `PC1` --> `R1` --> `R2` --> `R4` --> `PC4`

We will use the former one (R3) in this example

Each router in the path needs two routes:

  1. route to 192.168.1.0/24 (PC1’s network)
  2. route to 192.168.4.0/24 (PC4’s network)

This will ensure two-way reachability (PC1 can send packets to PC4 and PC4 can sendd packets to PC1)

This will be the plan for static routes: Static Route config Plan to allow PC1 to reach PC4 and vice-versa

Static Route Configuration

The command for this is ip route <ip-address> <netmask> <next-hop>

R1 - Adding IP route for PC4's network with next-hop R3

R3 - Adding IP route for PC4's network with next-hop R4 and PC1 network with next-hop R1

R4 - Adding IP route for PC1's network with next-hop R3

PC1 can now ping PC4 and there's two-way reachability

Static Route Configuration with exit-interface

There’s two other ways to configure a static route:

We’ll configure static routes for R2 using there:

alt text

Default Route (Gateway)

Example

Smalled network topology example

No default route has been configured yet

R1's routing table without default gateway configured

After configuring a default route, routing table automatically picked the best candidate to be the last resort IP address

R1's routing table after configuring default gateway