Gated – Gateway Routing Daemon: A Comprehensive Technical Guide
In the realm of network routing, managing dynamic routing protocols efficiently is critical for maintaining robust and scalable networks. The gated (Gateway Routing Daemon) is a legacy but influential routing daemon designed to unify the management of multiple routing protocols on a single gateway or router. Originally developed at Cornell University in the 1980s, gated gained widespread adoption in Unix-based systems for its ability to integrate diverse routing protocols (e.g., RIP, OSPF, BGP) into a single, configurable service.
While modern networks often use newer tools like FRRouting (FRR) or BIRD, understanding gated remains valuable for legacy system administrators, network engineers maintaining older infrastructure, and anyone interested in the evolution of routing daemons. This blog provides a deep dive into gated, covering its purpose, architecture, configuration, best practices, and real-world examples.
Table of Contents#
- Overview of Gated
- Core Features
- Architecture
- Configuration Fundamentals
- Common Use Cases
- Best Practices
- Example Usage
- Troubleshooting
- References
Overview of Gated#
Gated is a unified routing daemon that dynamically manages routing tables by integrating information from multiple routing protocols. Unlike running separate daemons for each protocol (e.g., ripd for RIP, ospfd for OSPF), gated consolidates protocol handling, route selection, and kernel routing table updates into a single process. This simplifies management and ensures consistent policy enforcement across protocols.
Key Historical Context#
- Developed in the late 1980s by the Computer Science Department at Cornell University, with copyright dates spanning 1990–1995.
- The first unified routing daemon to consolidate multiple protocols into a single process, pioneering the architecture later adopted by modern suites like FRR and BIRD.
- Release 3.5 was the publicly available version; later releases (3.6+) were maintained by NextHop Technologies under the Gated Consortium.
- Widely used in BSD, Linux, and Unix systems before the rise of modular daemons like FRR.
Core Features#
Gated’s power lies in its ability to harmonize multiple routing protocols and enforce routing policies. Key features include:
1. Multiprotocol Support#
Gated supports major interior and exterior routing protocols:
- Interior Gateway Protocols (IGPs): RIP (v1/v2), OSPF (v2), HELLO (an early IGP).
- Exterior Gateway Protocols (EGPs): BGP (v4), EGP (obsolete, replaced by BGP).
- Static Routes: Manually defined routes for fallback or specific paths.
2. Route Selection and Policy Enforcement#
Gated uses a route selection engine to evaluate routes from all protocols and select the "best" path based on:
- Protocol-specific metrics (e.g., RIP hop count, OSPF cost).
- Preference values (a priority assigned to each route source; lower = more preferred, e.g., OSPF=10, RIP=100, BGP=170).
- User-defined policies (e.g., route filters, redistribution rules).
3. Route Redistribution#
Gated enables sharing routes between protocols (e.g., redistributing OSPF routes into BGP for external advertisement). This is critical for hybrid networks (e.g., an OSPF-based internal network connected to the internet via BGP).
4. Kernel Integration#
Gated directly updates the host’s kernel routing table, ensuring that selected routes are used by the operating system for packet forwarding.
Architecture#
Gated's architecture is modular, with components that work together to process routing information and update the kernel. Key components include:
1. Configuration Parser#
Reads and validates the gated.conf configuration file, ensuring syntax correctness and policy consistency.
2. Protocol Modules#
Integrated modules for each supported protocol (RIP, OSPF, BGP, EGP, HELLO). These modules:
- Exchange routing updates with neighboring routers.
- Validate incoming routes (e.g., RIP hop count checks).
- Pass candidate routes to the route selection engine.
3. Route Selection Engine#
The "brain" of gated. It:
- Collects routes from all protocol modules.
- Applies user-defined policies (e.g., filters, metrics).
- Selects the best route based on preference values and protocol metrics.
4. Kernel Interface#
Communicates with the OS kernel to update the routing table with the selected best routes. Uses system calls like ioctl or netlink (on Linux) for kernel interactions.
5. Logging and Debugging#
Generates logs for troubleshooting (e.g., protocol adjacencies, route updates) and supports debug modes for in-depth analysis.
Configuration Fundamentals#
Gated is configured via a plain-text file (typically /etc/gated.conf). The syntax is declarative, with blocks for global settings, protocols, and policies. Below is a breakdown of key configuration elements:
Basic Structure#
# Global options (optional)
options {
gendefault ; # Generate default route when peering with BGP neighbor
};
# Protocol configuration (e.g., RIP, OSPF, BGP)
rip yes {
interface eth0 {
version 2 ;
multicast ;
};
};
# OSPF configuration
ospf yes {
backbone {
interface eth0 {
priority 5 ;
};
};
};
# Route redistribution via export statements
export proto ospfase type 2 {
proto rip ;
};Key Configuration Elements#
- Options Block: Set global gated behavior (e.g., default route generation).
- Protocol Blocks: Enable and configure protocols using statements like
rip yes,ospf yes,bgp yes. - Export Statements: Control route redistribution—what routes are advertised via each protocol.
- Import Statements: Restrict which routes are accepted from specific sources.
Common Use Cases#
Gated excels in scenarios requiring multiprotocol routing. Common use cases include:
1. Enterprise Gateways#
A corporate network using OSPF for internal routing and BGP to connect to an ISP. Gated redistributes OSPF routes into BGP for internet access and vice versa for external routes.
2. Lab Environments#
Network engineers use gated to test protocol interactions (e.g., RIP-OSPF redistribution) without deploying multiple daemons.
3. Legacy ISP Edge Routers#
Older ISPs may still use gated to manage BGP for interdomain routing and RIP/OSPF for internal backbones.
Best Practices#
To ensure stable and secure operation, follow these best practices:
1. Validate Configurations#
Always test configurations with gated -C (check syntax) before deploying. Example:
gated -C -f /etc/gated.conf2. Limit Protocol Exposure#
Restrict protocol adjacencies to trusted neighbors. For OSPF, use neighbor statements; for BGP, configure explicit peers.
3. Secure Routing Updates#
- Use authentication for protocols (e.g., RIP v2 MD5, OSPF simple password authentication).
- Filter routes with prefix lists or access control lists (ACLs) to prevent route injection attacks.
4. Avoid Default Redistribution#
Blindly redistributing all routes between protocols can cause routing loops. Use explicit redistribution rules with route maps.
5. Monitor and Log#
Enable detailed logging and monitor metrics like route count, adjacency status, and CPU/memory usage. Tools like gdc (gated control utility) or netstat -r help track routing table changes.
Example Usage#
Let’s walk through a practical example: configuring gated to run RIP on an internal interface and OSPF on an external interface, with route redistribution between them.
Scenario#
- Internal Network: 192.168.1.0/24 (eth0), using RIP.
- External Network: 10.0.0.0/24 (eth1), using OSPF backbone area.
- Goal: Redistribute RIP routes into OSPF and OSPF routes into RIP.
Step 1: Create gated.conf#
# Define the OSPF router id
routerid 10.0.0.1 ;
# RIP configuration (internal interface)
rip yes {
broadcast ;
defaultmetric 5 ;
interface eth0 {
version 2 ;
multicast ;
authentication simple "REALstuff" ;
};
};
# OSPF configuration (external interface)
ospf yes {
backbone {
authtype simple ;
interface eth1 {
priority 5 ;
authkey "It'sREAL" ;
};
};
};
# Redistribute RIP routes into OSPF (as ASE Type 2)
export proto ospfase type 2 {
proto rip ;
};
# Redistribute OSPF routes into RIP
export proto rip {
proto ospf ;
};Step 2: Validate and Start Gated#
# Check configuration syntax
gated -C -f /etc/gated.conf
# Start gated (varies by OS; example for SystemV)
service gated start
# Verify status
service gated statusStep 3: Verify Routes#
Check the kernel routing table to confirm routes are learned and redistributed:
netstat -r # Linux
route -n # Alternative for LinuxTroubleshooting#
Common issues with gated and their solutions:
1. Configuration Errors#
- Symptom: Gated fails to start.
- Fix: Run
gated -C -f /etc/gated.confto identify syntax errors (e.g., missing semicolons, invalid protocol names).
2. Missing Routes#
- Symptom: Routes from a protocol are not appearing in the routing table.
- Fix:
- Check protocol adjacencies by reviewing gated trace output (use
-tflag for tracing). - Verify redistribution rules (ensure
exportstatements are correctly configured). - Check import statements (routes may be filtered by import policies).
- Check protocol adjacencies by reviewing gated trace output (use
3. High CPU/Memory Usage#
- Symptom: Gated consumes excessive resources.
- Fix: Reduce debug verbosity, limit the number of routes (e.g., with prefix filters), or upgrade hardware for large networks.
4. Routing Loops#
- Symptom: Packets loop between routers.
- Fix: Avoid circular redistribution (e.g., RIP → OSPF → RIP). Use route maps to filter redistributed routes.
References#
-
Protocol RFCs (implemented by Gated):
-
Documentation:
- GateD Release 3.5 Manual Page (Cornell GateDaemon Project)
- IBM AIX gated Daemon Documentation
- "TCP/IP Network Administration" by Craig Hunt (O'Reilly Media)
-
Modern Alternatives:
Gated remains a cornerstone in the history of routing daemons, offering a unified approach to multiprotocol routing. While modern tools have superseded it in many environments, understanding gated’s design and configuration principles provides valuable insight into network routing fundamentals. Whether maintaining legacy systems or learning about routing architecture, gated is a critical topic for network professionals.