Network Devices and Protocols

Chapter 6
Routing Devices and Routing Protocols

Diploma in Computer Architecture and Networking
Network Devices and Protocols   •   Diploma

Routing Devices and Routing Protocols

Introduction and Context

Routing is the process of selecting paths through an internetwork and forwarding packets toward their destinations. A router connects separate IP networks, examines packet headers, consults a routing table, and sends each packet through an appropriate outgoing interface or next-hop device. Routing is therefore different from switching: a Layer 2 switch primarily forwards frames within a local broadcast domain, whereas a router forwards Layer 3 packets between different networks.

Modern enterprise networks may contain branch offices, data centres, wireless networks, cloud connections, voice systems and security zones. Static routes are useful in small or stable environments, while dynamic routing protocols allow routers to exchange reachability information and adapt to failures. This chapter introduces the operation and configuration principles of routers, static and default routes, routing metrics, RIP, OSPF, BGP, and first-hop redundancy protocols.

Learning Objectives

By the end of this chapter, a learner should be able to:

  • Explain the purpose and operation of a router and its interfaces.
  • Configure and verify IPv4 router interfaces.
  • Interpret routing tables and explain route selection.
  • Configure static, default and floating static routes.
  • Describe the operation and limitations of RIP.
  • Explain OSPF areas, neighbours, costs and shortest-path calculation.
  • Describe the role of BGP in inter-autonomous-system routing.
  • Explain gateway redundancy and first-hop redundancy protocols.
  • Apply routing concepts to a small enterprise network and troubleshoot common faults.

1. Routers, Interfaces and Forwarding

A router normally has multiple interfaces, each belonging to a different IP subnet. An interface may be physical, such as Ethernet or serial, or logical, such as a loopback, subinterface or tunnel. Before an interface can forward traffic, it normally requires an IP address, a subnet mask or prefix length, and an operational link.

A router performs the following general operation:

  1. It receives a frame on an incoming interface.
  2. It removes the data-link header and examines the destination IP address.
  3. It searches its routing table for the best matching route.
  4. It decreases the IPv4 Time To Live (TTL), or performs the equivalent IPv6 Hop Limit operation.
  5. It resolves the next-hop Layer 2 address if necessary.
  6. It encapsulates the packet in a new data-link frame and transmits it through the selected interface.

The router does not normally preserve the original Layer 2 frame across a routed link. The source and destination IP addresses generally remain unchanged during ordinary forwarding, although Network Address Translation (NAT) can modify them at a boundary device.

1.1 Interface states

An interface has both a physical state and a protocol state. Common diagnostic states include:

StateTypical meaning
Administratively downThe interface has been disabled by configuration.
Down/downThe physical link or local hardware is unavailable.
Up/downThe physical link is active, but the protocol or encapsulation is not operating correctly.
Up/upThe interface is operational and able to forward traffic.

A connected route is normally installed when an interface is up and has an address. A local host route for the interface address may also appear in the routing table, depending on the operating system.

1.2 Basic interface configuration

The following Cisco IOS-style example illustrates a common configuration sequence. Exact commands vary by vendor and software version.

Router> enable
Router# configure terminal
Router(config)# interface gigabitEthernet 0/0
Router(config-if)# description LAN connection
Router(config-if)# ip address 192.168.10.1 255.255.255.0
Router(config-if)# no shutdown
Router(config-if)# exit
Router(config)# interface gigabitEthernet 0/1
Router(config-if)# description WAN connection
Router(config-if)# ip address 203.0.113.2 255.255.255.252
Router(config-if)# no shutdown
Router(config-if)# end
Router# show ip interface brief

The address 192.168.10.1/24 identifies the router as a host on the LAN subnet 192.168.10.0/24. The address 203.0.113.2/30 places the WAN interface in a four-address subnet, commonly used for a point-to-point link. The address block is reserved for documentation and should not be used as a real public address.

Configuration should be followed by verification. Useful commands include show ip interface brief, show interfaces, show running-config, ping, and traceroute. A successful local interface check does not prove that remote routing is correct; each hop must be tested systematically.

2. Routing Tables and Route Selection

A routing table is a collection of destination prefixes and forwarding instructions. A typical entry contains:

  • destination network and prefix length;
  • route source, such as connected, static, RIP or OSPF;
  • administrative distance or preference;
  • metric;
  • next-hop address;
  • outgoing interface;
  • route age or timer information, where applicable.

A simplified table might contain entries such as:

DestinationSourceNext hopInterface
192.168.10.0/24Connected—G0/0
192.168.20.0/24OSPF10.0.0.2G0/1
0.0.0.0/0Static203.0.113.1G0/1

2.1 Longest-prefix matching

When several entries could match a destination, the router first selects the route with the longest matching prefix. A longer prefix represents a more specific destination. For example, a packet destined for 192.168.10.50 could match both 192.168.0.0/16 and 192.168.10.0/24; the /24 route is selected because it has more matching network bits.

This principle is independent of whether a route was learned statically or dynamically. A highly specific static route can therefore take precedence over a less-specific dynamic route even when the dynamic protocol has a preferred administrative distance.

2.2 Administrative distance and metric

If two routes have the same destination prefix, the router compares the trust or preference assigned to their sources. Cisco terminology calls this administrative distance (AD); other vendors use terms such as preference. A lower value is generally preferred. Connected routes and static routes commonly have lower default preferences than dynamic protocols, but values vary by vendor and can be changed by an administrator.

If multiple routes come from the same routing protocol, the protocol compares its metric. A metric may represent hop count, bandwidth, delay, reliability, load, cost, or a composite value. There is no universal metric formula. The meaning must be understood for the particular protocol.

A simplified route-selection sequence is therefore:

  1. Select the most specific matching prefix.
  2. Among routes to that prefix, select the source with the best administrative preference.
  3. Among routes from that source, select the lowest protocol metric.
  4. Install one or more equal-cost paths if the implementation supports equal-cost multipath.

2.3 Default route

A default IPv4 route is written as 0.0.0.0/0. It matches every IPv4 destination not matched by a more specific entry. A default IPv6 route is ::/0. Default routes are useful at branch, home or stub networks where all external traffic should be sent to one upstream router.

A static default route can be configured as follows:

Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1

The next hop should be reachable through an operational interface. In a production network, the administrator should decide whether the route is unconditional or should be tied to an object-tracking mechanism so that it is removed when the upstream path fails.

3. Static and Floating Static Routes

A static route is manually entered by an administrator. It consumes little control-plane bandwidth, is predictable and is appropriate for small networks, stub links, special-purpose paths and security-sensitive routing boundaries. Its disadvantages are poor scalability and the possibility of stale or incorrect configuration after a topology change.

Example:

Router(config)# ip route 192.168.30.0 255.255.255.0 10.0.0.2

This route tells the router that traffic for 192.168.30.0/24 should be forwarded to next hop 10.0.0.2.

A floating static route is a backup static route configured with a worse administrative preference than the primary route. For example:

Router(config)# ip route 192.168.30.0 255.255.255.0 10.0.0.2 1
Router(config)# ip route 192.168.30.0 255.255.255.0 10.0.1.2 200

The second route is retained as a backup if the primary route disappears. However, merely losing an end-to-end path may not remove the primary route if the local interface remains up. Reliable designs therefore combine floating routes with link-state detection, IP Service Level Agreement probes, Bidirectional Forwarding Detection, or another tracking mechanism where supported.

3.1 Recursive and fully specified static routes

A recursive static route specifies a next-hop IP address. The router performs another lookup to determine how to reach that next hop. A fully specified route identifies both the next hop and outgoing interface. Fully specified routes can be useful on multiaccess networks or where recursive resolution could become ambiguous, but syntax and behaviour vary by platform.

3.2 Static route verification

A disciplined verification process includes:

  • checking interface status and addressing;
  • confirming that the next hop is reachable;
  • examining the route table;
  • testing a destination with ping;
  • using traceroute to identify the point of failure;
  • checking counters, access-control lists and ARP or neighbour discovery information.

A route in the table does not guarantee successful forwarding. Return routing, filtering, MTU, address resolution and host firewalls must also be considered.

4. Dynamic Routing Protocols

Dynamic routing protocols exchange information about network reachability. They differ in the information exchanged, route-calculation algorithm, convergence behaviour, scalability and administrative complexity.

4.1 Distance-vector routing

A distance-vector router advertises destinations and a distance to those destinations through neighbours. Classic RIP is a distance-vector protocol. Its simplicity is attractive for teaching and very small networks, but its hop-count metric and slow convergence limit its practical use.

Distance-vector protocols can suffer from routing loops and count-to-infinity behaviour. Split horizon, route poisoning, hold-down timers and triggered updates are techniques used to reduce these problems.

4.2 Link-state routing

A link-state router describes its links and their states to other routers in an area or domain. Each router builds a link-state database and independently calculates shortest paths. OSPF is a link-state protocol. Link-state protocols generally converge more rapidly and provide greater control than traditional distance-vector protocols, but they require more memory, processing and design discipline.

5. RIP

Routing Information Protocol version 2 (RIPv2) is an interior gateway protocol for IPv4. It uses hop count as its metric. A route with fewer hops is preferred, and 16 hops represents infinity; consequently, a route cannot be more than 15 routers away. RIPv2 supports classless routing through prefix information and supports authentication mechanisms defined by the protocol specification.

A simplified Cisco configuration is:

Router(config)# router rip
Router(config-router)# version 2
Router(config-router)# no auto-summary
Router(config-router)# network 10.0.0.0
Router(config-router)# network 192.168.10.0

The exact interpretation of the network command depends on the platform. Passive interfaces should be used on user LANs when routing updates are not required there:

Router(config-router)# passive-interface gigabitEthernet 0/0

RIP is easy to configure, but it is unsuitable for many modern enterprise networks because hop count does not reflect bandwidth or delay, the maximum path length is small, and convergence can be slow. It remains valuable as an introductory protocol because its operation makes distance-vector principles clear.

6. OSPF

Open Shortest Path First (OSPF) is a link-state interior gateway protocol. OSPF routers form neighbour relationships, exchange link-state information, construct a link-state database, and calculate shortest paths using the Shortest Path First algorithm. OSPF supports classless addressing, authentication, route summarisation and hierarchical areas.

6.1 OSPF cost

OSPF uses an interface cost. A commonly used conceptual relationship is:

Cost = Reference bandwidth ÷ Interface bandwidth

Bandwidth values must use consistent units, normally bits per second. The reference bandwidth is an administrative parameter, historically often 100 Mb/s in some implementations. Implementations may round or impose a minimum cost, and modern networks should configure a reference bandwidth that distinguishes high-speed links. The formula is therefore a model of default cost calculation, not a universal requirement for every vendor.

For a path containing several interfaces, the path cost is the sum of the interface costs:

Cpath = ∑(Ci), i = 1 to n

Here, C_path is the total path cost, C_i is the cost of interface or link i, and n is the number of links. The calculation assumes that the protocol is using additive interface costs and that all costs are expressed in the same dimensionless metric units.

For example, if a path has costs 10, 20 and 5, its total cost is 35. OSPF prefers the lowest-cost path, not necessarily the path with the fewest physical hops.

6.2 Areas and router roles

OSPF divides a large routing domain into areas. Area 0 is the backbone area, and other areas should normally connect to it. An Area Border Router (ABR) connects areas. An Autonomous System Boundary Router (ASBR) introduces routes from another routing source, such as static routes or BGP.

Areas reduce the size of link-state databases and limit the scope of topology changes. They also support route summarisation. Poor area design, however, can create operational complexity and suboptimal routing.

6.3 OSPF neighbour formation

On a shared network, OSPF routers use Hello packets to discover neighbours and establish adjacencies. Parameters such as area number, timers, network type, authentication and address compatibility must agree. On broadcast networks, a Designated Router (DR) and Backup Designated Router (BDR) reduce the number of required adjacencies.

A typical configuration is:

Router(config)# router ospf 10
Router(config-router)# router-id 1.1.1.1
Router(config-router)# network 10.0.0.0 0.0.0.3 area 0
Router(config-router)# network 192.168.10.0 0.0.0.255 area 0

Modern implementations may also enable OSPF directly under interfaces. Verification commands commonly include show ip ospf neighbor, show ip ospf interface, show ip ospf database, and show ip route ospf.

Common causes of neighbour failure include mismatched area numbers, incorrect masks, incompatible timers, duplicate router IDs, passive interfaces, authentication mismatch and an interface that is not operational.

7. BGP and Autonomous Systems

The Border Gateway Protocol (BGP) exchanges reachability information between autonomous systems (ASes). An AS is a network or group of networks administered under a common routing policy and identified by an Autonomous System Number (ASN). BGP is the principal interdomain routing protocol of the Internet.

External BGP (eBGP) operates between different ASes. Internal BGP (iBGP) distributes BGP information within one AS. BGP is a path-vector protocol: advertisements include path attributes, including the AS path, which helps prevent loops and supports policy decisions.

BGP does not simply select the physically shortest route. Selection depends on ordered policy attributes. The exact sequence varies by implementation, but commonly considered attributes include local preference, locally originated routes, AS-path length, origin type, Multi-Exit Discriminator, eBGP over iBGP and internal metrics to the next hop. Administrators can use these attributes to control traffic engineering, redundancy and provider selection.

A simplified conceptual eBGP configuration might be:

Router(config)# router bgp 65001
Router(config-router)# neighbor 203.0.113.1 remote-as 65002
Router(config-router)# network 198.51.100.0 mask 255.255.255.0

The advertised network must normally exist in the local routing table, and the neighbour relationship requires IP reachability and compatible parameters. Real deployments require careful filtering, maximum-prefix limits, route validation, authentication where appropriate, and explicit import and export policy.

BGP is powerful but not a replacement for an internal gateway protocol. An enterprise commonly uses OSPF or IS-IS inside its AS and BGP at connections to service providers, cloud platforms or Internet exchanges.

8. First-Hop Redundancy and Gateway Availability

Hosts generally use a single default gateway. If that router fails, the hosts may lose external connectivity even when another router is available. First-Hop Redundancy Protocols (FHRPs) solve this problem by presenting a virtual gateway address and, often, a virtual MAC address to hosts.

Examples include:

  • HSRP, commonly associated with Cisco environments;
  • VRRP, an open standard used by multiple vendors;
  • GLBP, which can provide gateway redundancy and traffic distribution in supported environments.

One router operates as the active or master gateway, while another is standby or backup. If the active router fails, the standby assumes the virtual gateway role. Hosts retain the same default-gateway address and do not require reconfiguration.

FHRP is distinct from routing-protocol redundancy. OSPF may provide alternative paths between routers, while an FHRP protects the host-to-gateway relationship. Both may be required for end-to-end resilience. Preemption, authentication, interface tracking and carefully selected priorities should be configured deliberately. Aggressive timers can cause instability when links are intermittent.

9. Applied Case: Redundant Branch Network

The following is an illustrative case, not a description of a particular organisation.

Background

A training company has a headquarters LAN using 10.10.10.0/24 and a branch LAN using 10.20.20.0/24. The branch has two WAN links to headquarters. Users require access to central applications and the Internet. The branch currently has one router, creating a single point of failure.

Problem

The administrator configured a default route through the primary WAN link, but when the provider failed, the router still showed the interface as operational. Traffic was discarded because the route remained installed. In addition, the default gateway itself was unavailable during router maintenance.

Analysis

The design contains two separate availability problems:

  1. WAN path failure must be detected beyond the local interface.
  2. The LAN needs a resilient first-hop gateway.

A second branch router is installed. The two routers share a virtual gateway address, 10.20.20.1, through an FHRP. The routers use OSPF across the WAN and advertise the branch LAN. A tracked primary default route is preferred, while a floating static route uses the secondary link.

Approach and solution

The administrator:

  • assigns unique IP addresses to all physical interfaces;
  • verifies both WAN links independently;
  • configures OSPF for internal reachability;
  • configures a virtual gateway for branch hosts;
  • uses tracking or probes to withdraw the primary default route when the upstream path fails;
  • applies a higher administrative distance to the backup route;
  • filters unnecessary routing updates on user-facing interfaces;
  • records the design, addressing plan and recovery procedure.

Testing includes failure of the primary interface, failure beyond the provider handoff, shutdown of the active gateway, and restoration of the primary path. The administrator checks convergence time, packet loss, route-table changes and whether traffic returns to the intended primary path without causing route flapping.

Outcome

Users continue to use the same default gateway during router failure. The branch changes to the secondary WAN path when the primary path fails, and OSPF restores preferred routing after recovery. The design is more resilient, but it introduces additional configuration, monitoring and troubleshooting requirements.

Learning points

Redundancy is effective only when failure detection is meaningful. A physically up interface may still have no usable end-to-end path. Gateway redundancy, routing redundancy and service monitoring should be designed together rather than treated as interchangeable features.

10. Troubleshooting and Professional Practice

Routing faults should be approached methodically rather than by changing several settings at once. A useful sequence is:

  1. Confirm the physical link and interface state.
  2. Verify addressing, subnet masks and duplicate-address absence.
  3. Test the directly connected next hop.
  4. Inspect the local routing table.
  5. Confirm the selected route and next hop for the destination.
  6. Test the return path.
  7. Examine filtering, NAT, MTU and host firewalls.
  8. Review routing-protocol neighbours, timers and databases.
  9. Compare the current configuration with the approved design.
  10. Document the cause, corrective action and verification evidence.

Common mistakes include using an incorrect subnet mask, configuring a route to an unreachable next hop, forgetting no shutdown, advertising the wrong network, creating an OSPF area mismatch, failing to filter BGP announcements, and assuming that a backup route is active merely because it appears in the configuration.

Operational best practice includes configuration backups, change control, least-privilege management access, secure protocols such as SSH, time synchronisation, central logging, monitoring of adjacency state, and documented rollback procedures. Routing updates should not be accepted from untrusted interfaces without authentication or filtering where supported.

11. Security, Governance and Contemporary Developments

Routing protocols influence the reachability of critical systems, so incorrect or malicious advertisements can cause outages, interception or traffic diversion. Administrative controls should include authenticated management, protected routing sessions, prefix filters, route maps or policies, maximum-prefix limits and separation of management traffic. BGP deployments should consider Resource Public Key Infrastructure (RPKI) validation and route-origin authorisation where applicable.

IPv6 routing follows the same broad principles but uses different addressing, neighbour discovery and protocol details. OSPFv3 supports IPv6, while MP-BGP carries multiple address families, including IPv6. Dual-stack designs must be monitored independently because IPv4 and IPv6 may choose different paths.

Software-defined networking and controller-based systems may centralise policy and calculate paths, but the underlying principles remain: interfaces must be reachable, routes must be selected according to defined policy, and failure behaviour must be tested. Automation can reduce configuration errors, but an incorrect automation template can distribute errors rapidly. Automated changes therefore require validation, version control, peer review and staged deployment.

Chapter Summary

Routers connect separate IP networks and forward packets using routing tables. Interfaces must be correctly addressed and operational before connected routes can be used. Static routes provide predictable manual control, while default routes handle destinations for which no more-specific route exists. Floating static routes can provide backup paths when their preference is worse than the primary route.

Route selection begins with longest-prefix matching, followed by administrative preference and then the routing protocol’s metric. RIP is a simple distance-vector protocol with a hop-count limit and limited scalability. OSPF is a link-state protocol that uses interface costs, neighbour relationships and shortest-path calculation, with areas supporting hierarchy. BGP is a policy-driven path-vector protocol used primarily between autonomous systems. First-hop redundancy protocols protect the default-gateway function, while dynamic routing and path tracking protect broader reachability. Reliable network design combines correct configuration, monitoring, security controls, testing and documentation.

Key Terms

Router: A Layer 3 device that forwards packets between IP networks.

Interface: A physical or logical connection through which a router sends or receives traffic.

Routing table: A data structure containing destination prefixes and forwarding information.

Prefix length: The number of network bits in an IP route, written after a slash.

Longest-prefix matching: Selecting the route with the most specific matching prefix.

Next hop: The next router or destination to which a packet is forwarded.

Static route: A manually configured route.

Default route: A route used when no more-specific route matches.

Floating static route: A backup static route with a less-preferred administrative value.

Metric: A value used by a routing protocol to compare routes.

Administrative distance: A preference used to compare routes learned from different sources.

RIPv2: An IPv4 distance-vector routing protocol using hop count.

OSPF: A link-state interior gateway protocol using shortest-path calculation.

Area: A logical subdivision of an OSPF routing domain.

BGP: A path-vector protocol for exchanging routes between autonomous systems.

Autonomous system: A network under a common administrative routing policy.

FHRP: A protocol family that provides a resilient virtual default gateway.

Convergence: The process by which routers agree on usable routes after a change.

Route summarisation: Representing several more-specific routes with a less-specific aggregate.

RPKI: A system used to support validation of authorised Internet route origins.

Review Questions

Short Answer Questions

  1. What is the primary function of a router?
  2. Why does longest-prefix matching matter in route selection?
  3. What is the purpose of a default route?
  4. State one important limitation of RIP.
  5. What problem does a first-hop redundancy protocol solve?

Long Answer Questions

  1. Explain the complete process by which a router receives and forwards an IPv4 packet.
  2. Compare static routing, RIP and OSPF in terms of configuration, scalability, convergence and operational use.
  3. Explain OSPF neighbour formation, link-state databases, areas and cost-based path selection.
  4. Describe BGP, including autonomous systems, eBGP, iBGP and policy-based route selection.
  5. Explain how floating static routes and first-hop redundancy protocols can be combined in a resilient branch design.

Analytical / Application Questions

  1. A router has routes to 10.0.0.0/8, 10.20.0.0/16 and 10.20.30.0/24. Which route should be selected for destination 10.20.30.45, and why?
  2. A primary WAN interface remains physically up, but the provider has lost upstream connectivity. Explain why an ordinary static default route may remain installed and propose two mechanisms for detecting the failure.
  3. Design a basic routing and redundancy approach for a small branch with two routers, two WAN links and one user LAN. Identify the roles of the interior routing protocol, backup route, gateway redundancy protocol and monitoring process.

Multiple Choice Questions with Answers

Question 1

Which route is selected when a destination matches both 192.168.0.0/16 and 192.168.10.0/24?

A. The 192.168.0.0/16 route

B. The 192.168.10.0/24 route

C. The route learned most recently

D. The route with the highest metric

Correct Answer: B. The 192.168.10.0/24 route

Question 2

What does the IPv4 default route 0.0.0.0/0 represent?

A. Only the local router address

B. All destinations not matched by a more-specific route

C. All multicast destinations

D. Only directly connected networks

Correct Answer: B. All destinations not matched by a more-specific route

Question 3

Which metric does classic RIP use?

A. Bandwidth

B. Delay

C. Hop count

D. AS-path length

Correct Answer: C. Hop count

Question 4

What is the main function of an OSPF link-state database?

A. To store Ethernet MAC addresses only

B. To describe the known topology used for path calculation

C. To translate private addresses into public addresses

D. To authenticate user accounts

Correct Answer: B. To describe the known topology used for path calculation

Question 5

If OSPF interface costs on a path are 10, 20 and 5, what is the total path cost under an additive cost model?

A. 15

B. 25

C. 30

D. 35

Correct Answer: D. 35

Question 6

Which protocol is primarily used for exchanging routing information between autonomous systems?

A. RIP

B. OSPF

C. BGP

D. ARP

Correct Answer: C. BGP

Question 7

What is the purpose of a floating static route?

A. To replace every connected route

B. To provide a less-preferred backup path

C. To advertise routes to all Internet providers

D. To assign IP addresses automatically

Correct Answer: B. To provide a less-preferred backup path

Question 8

What does a first-hop redundancy protocol provide to end hosts?

A. A virtual and resilient default gateway

B. A larger Ethernet frame size

C. A DNS server for every subnet

D. An encrypted replacement for IP

Correct Answer: A. A virtual and resilient default gateway

Question 9

Which condition commonly prevents an OSPF neighbour relationship from forming?

A. Matching area numbers

B. Compatible timers

C. An area-number mismatch

D. A reachable interface

Correct Answer: C. An area-number mismatch

Question 10

Why might a tracked default route be preferable to an ordinary static default route on a WAN connection?

A. It automatically increases bandwidth

B. It can be withdrawn when end-to-end reachability fails

C. It eliminates the need for a routing table

D. It converts IPv4 into Ethernet

Correct Answer: B. It can be withdrawn when end-to-end reachability fails

Network Devices and Protocols
Chapter 6 of 14