Computer Network and Security - Path Determination & Routing

Path Determination

  • Routers determine the best path to forward packets.
  • Routers forward packets toward their destination.

Best Path

  • The best path is the "longest match" in the routing table.
  • Longest match: the route with the greatest number of far-left matching bits between the destination IP address and the route in the routing table.
  • Prefix length: the number of far-left bits that must match.

IPv4 Example

  • Destination IPv4 Address: 172.16.0.10
  • Matching route 172.16.0.0/26 has the longest match.

IPv6 Example

  • Destination IPv6 Address: 2001:db8:c000::99/48
  • Matching route 2001:db8:c000::/48 is the longest match.

Building the Routing Table

  • Directly Connected Networks: Added when an interface is configured with an IP address and is active.
  • Remote Networks: Learned via:
    • Static routes: Manually configured.
    • Dynamic routing protocols: Learned dynamically.
  • Default Route: A next-hop router to use when the routing table doesn't contain a specific route.
    • Has a /0 prefix length.
    • Referred to as a gateway of last resort.

Packet Forwarding Decision Process

  1. Packet arrives on ingress interface.
  2. Router examines destination IP address.
  3. Router finds the longest matching prefix in the routing table.
  4. Router encapsulates the packet and forwards it out the egress interface.
  5. If no matching route, the packet is dropped.

Forwarding to a Directly Connected Network

  • The packet is forwarded directly to the destination device.
  • The router needs to determine the destination MAC address associated with the destination IP address.

Forwarding to a Next-Hop Router

  • The packet is forwarded to the next-hop router.
  • A similar ARP process occurs to determine the destination MAC address of the next-hop router.

Drop the Packet

  • If there is no match in the routing table and no default route, the packet is dropped.

Basic Router Configuration Commands

  • enable
  • configure terminal
  • hostname
  • enable secret class
  • line console 0
  • logging synchronous
  • password cisco
  • login
  • line vty 0 4
  • password cisco
  • login
  • transport input ssh telnet
  • service password-encryption
  • banner motd #
  • ipv6 unicast-routing
  • interface gigabitethernet 0/0/0
    • description Link to LAN 1
    • ip address 10.0.1.1 255.255.255.0
    • ipv6 address 2001:db8:acad:1::1/64
    • ipv6 address fe80::1:a link-local
    • no shutdown
  • copy running-config startup-config

Basic Router Verification Commands

  • show ip interface brief
  • show running-config interface interface-type number
  • show interfaces
  • show ip interface
  • show ip route
  • ping
  • Replace ip with ipv6 for IPv6 versions.

IP Routing Table Route Sources

  • Directly connected networks
  • Static routes
  • Dynamic routing protocols

Common Codes

  • L - Address assigned to a router interface.
  • C - Directly connected network.
  • S - Static route.
  • O - Dynamically learned network from OSPF.
  • * - Candidate for a default route.

Routing Table Principles

  • Routers make decisions independently based on their own routing tables.
  • Routing table information of one router doesn't necessarily match another router.
  • Routing information about a path doesn't provide return routing information.

Routing Table Entries

  • Route source
  • Destination network (prefix and prefix length)
  • Administrative distance (trustworthiness of the route source)
  • Metric (value assigned to reach the remote network)
  • Next-hop (IP address of the next router)
  • Route timestamp (time since the route was learned)
  • Exit interface

Directly Connected Networks

  • Status code C in the routing table.
  • Local route with status code L.
  • IPv4 local routes have a 32prefixlength.</li><li>IPv6localrouteshavea32 prefix length.</li> <li>IPv6 local routes have a128 prefix length.

Static Routes

  • Manually configured and not automatically updated.
  • Uses:
    • Smaller networks.
    • Single default route.
    • Stub networks.

Dynamic Routing Protocols

  • Automatically share information about network reachability and status.

Default Route

  • Used when the routing table doesn't contain a specific route.
  • IPv4: 0.0.0.0/0
  • IPv6: ::/0

IPv4 Routing Table Structure

  • Organized using classful addressing architecture.
  • Indented entry (child route): subnet of a classful network.
  • Directly connected networks are always indented.
  • Classful network address shown above the route entry (parent route).

IPv6 Routing Table Structure

  • Straightforward; every entry is formatted the same way.

Administrative Distance (AD)

  • Used to determine the route to install into the IP routing table.
  • Lower AD = more trustworthy.

Common AD Values

  • Directly connected: 0
  • Static route: 1
  • OSPF: 110
  • RIP: 120

Static vs Dynamic Routing

  • Most networks use a combination of both.

Static Routing Common Scenarios

  • Default route to a service provider.
  • Routes outside the routing domain.
  • Explicitly defining a path.
  • Routing between stub networks.

Dynamic Routing Common Scenarios

  • Networks with more than a few routers.
  • Automatic adaptation to topology changes.
  • Scalability.

Dynamic Routing Evolution

  • RIP was one of the first routing protocols.
  • New routing protocols emerged as networks evolved.

Routing Protocol Classification

  • IGPs (Interior Gateway Protocols): within a single organization
  • EGP (Exterior Gateway Protocol) - BGP: between different organizations (autonomous systems).

Dynamic Routing Protocol Concepts

  • Set of processes, algorithms, and messages used to exchange routing information.

Purpose

  • Discovery of remote networks
  • Maintaining up-to-date routing information
  • Choosing the best path
  • Finding a new best path if the current path is unavailable

Main Components

  • Data structures (tables or databases in RAM)
  • Routing protocol messages
  • Algorithm (finite list of steps)

Best Path

  • Selected based on a metric (quantitative value to measure distance).
  • Lowest metric = best path.

Common Metrics

  • RIP: Hop count (max 15 hops).
  • OSPF: Cost (based on cumulative bandwidth).
  • EIGRP: Based on bandwidth and delay values (can include load and reliability).

Load Balancing

  • Equal cost load balancing: Forwarding packets using multiple paths with equal cost metrics.
  • Increases network effectiveness and performance.
  • Enabled automatically by dynamic routing protocols (also with static routes).
  • EIGRP supports unequal cost load balancing.

Types of Static Routes

  • Standard static route
  • Default static route
  • Floating static route
  • Summary static route

Static Route Next-Hop Options

  • Next-hop IP address
  • Exit interface
  • Both

Types of Static Routes based on Next-Hop

  • Next-hop route: Only the next-hop IP address is specified
  • Directly connected static route: Only the router exit interface is specified
  • Fully specified static route: Both the next-hop IP address and exit interface are specified

IPv4 Static Route Command

  • Router(config)# ip route network-address subnet-mask { ip-address | exit-intf [ip-address]} [distance]
  • Either the IP address, exit interface, or both must be configured.

IPv6 Static Route Command

  • Router(config)# ipv6 route ipv6-prefix/prefix-length {ipv6-address | exit-intf [ipv6-address]} [distance]
  • Most parameters are identical to IPv4.

Next-Hop IPv4 Static Route (Example)

R1(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.2
R1(config)# ip route 192.168.1.0 255.255.255.0 172.16.2.2
R1(config)# ip route 192.168.2.0 255.255.255.0 172.16.2.2

Next-Hop IPv6 Static Route (Example)

R1(config)# ipv6 unicast-routing
R1(config)# ipv6 route 2001:db8:acad:1::/64  2001:db8:acad:2::2
R1(config)# ipv6 route 2001:db8:cafe:1::/64  2001:db8:acad:2::2
R1(config)# ipv6 route 2001:db8:cafe:2::/64  2001:db8:acad:2::2

Directly Connected IPv4 static route

  • Should only be used with point-to-point serial interfaces.
R1(config)# ip route 172.16.1.0 255.255.255.0 s0/1/0
R1(config)# ip route 192.168.1.0 255.255.255.0 s0/1/0
R1(config)# ip route 192.168.2.0 255.255.255.0 s0/1/0

Directly Connected IPv6 static route

  • Should only be used with point-to-point serial interfaces.
R1(config)# ipv6 route 2001:db8:acad:1::/64  s0/1/0
R1(config)# ipv6 route 2001:db8:cafe:1::/64  s0/1/0
R1(config)# ipv6 route 2001:db8:cafe:2::/64  s0/1/0

Fully Specified Static Route

  • Both the exit interface and the next-hop IP address are specified.
  • Used when the exit interface is a multi-access interface.
  • Necessary to use a next-hop address.
  • Recommended for Ethernet networks.
  • Required when using IPv6 link-local addresses as the next-hop address.

Default Static Route for IPv4

  • Matches all packets.
  • Commonly used for connecting to a service provider or a stub router.
  • Referred to as a "quad-zero route"
  • Syntax: Router(config)# ip route 0.0.0.0 0.0.0.0 {ip-address | exit-intf}.

Default Static Route for IPv6

  • Syntax: Router(config)# ipv6 route ::/0 {ipv6-address | exit-intf}.

Floating Static Routes

  • Provide a backup path to a primary static or dynamic route.
  • Configured with a higher administrative distance than the primary route.

Static Host Routes

  • IPv4 address with a 32-bit mask, or an IPv6 address with a 128-bit mask.

Automatically Installed Host Routes

  • Installed when an interface address is configured."C" code in Route table
  • Marked with L in the output of the routing table. "L" code in Route table

Static Host Routes

  • Manually configured to direct traffic to a specific destination device.
  • IPv4 host routes use a /32 mask.
  • IPv6 host routes use a /128 prefix length.