Static routing explained

Static routing describes a process by which routing is configured with fixed values that do not change at runtime unless manually edited. Static routes are used with and without dynamic Routing protocols and usually share the same routing table as those protocols.[1] Routes require at least two attributes; the destination and the gateway, but may contain additional attributes such as a metric (sometimes called the administrative distance). Some implementations treat the network address and subnet mask as separate values, however in practice both of the values have to be considered for any given routing decision to determine the longest prefix match. Static routes together with connected routes and routes from configuration protocols such as DHCP or Router Advertisements provide the routes which are then redistributed using dynamic routing protocols.[2] While static routes are entered into the system and remain there until removed or changed manually, dynamic routing protocols create and delete routes dynamically at runtime without intervention. Thus the term static here refers to the nature of remaining unchanged by the system itself. The most prominent example of a static route is a default route which is often used on devices with a statically configured IP address to provide the device with access to the rest of the network or the internet by default.[3] In contrast to a so called connected route which is automatically generated upon address assignment based on the used subnet mask, a static route must be manually configured. Due to this the configuration may fail if there is no route to the provided gateway at the time of configuration, other than the connected route which will always succeed as it does not require a gateway. The gateway of a static route need not be an address, but can also specify an interface in most implementations.

Uses

Static routing may have the following uses:

Advantages

Static routing has the following advantages:

Disadvantages

Static routing can have some potential disadvantages:[7]

Example

To route IP traffic destined for the network 10.10.20.0/24 via the next-hop router with the IPv4 address of 192.168.100.1, the following configuration commands or steps can be used:

Linux

Linux distributions generally provide a variety of network configuration software for users to use,[8] but also ship with a default such as systemd-networkd or ifupdown.[9] The configuration software of choice is then used to configure the persistent configuration which is applied on boot.It is also possible to configure Linux networking ad-hoc using the ip command from the iproute2 package.The following command can be used to configure the route using ip:[10]

root@router:~# ip route add 10.10.20.0/24 via 192.168.100.1

Cisco

Cisco routers running the Cisco IOS operating system can be configured using the command line interface:[11]

> enable

  1. configure terminal

(config)# ip route 10.10.20.0 255.255.255.0 192.168.100.1

Configuring administrative distance

The administrative distance can be manually (re)configured so that the static route can be configured as a backup route, to be used only if the dynamic route is unavailable.[12]

(config)# ip route 10.10.20.0 255.255.255.0 exampleRoute 1 254

Setting the administrative distance to 254 will result in the route being used only as a backup.

See also

Notes and References

  1. http://www.redbooks.ibm.com/redbooks/pdfs/gg243376.pdf TCP/IP Tutorial and Technical Overview (IBM RedBooks Series)
  2. Web site: ESPCommunity . 2024-12-18 . enterprise-support.nvidia.com.
  3. Web site: Static Routing Cumulus Linux 5.11 . 2024-12-18 . docs.nvidia.com.
  4. Web site: Route Filtering and Redistribution Cumulus Linux 5.11 . 2024-12-18 . docs.nvidia.com.
  5. Web site: Inter-Router Communication > BGP Fundamentals Cisco Press . 2024-12-18 . www.ciscopress.com.
  6. Web site: IP Routing Configuration Guide, Cisco IOS XE 17.16.x (Catalyst 9500 Switches) - Configuring OSPFv3 Authentication Support with IPsec . 2024-12-18 . Cisco . en.
  7. Web site: Cisco Networking Articles . 2013-11-05 . dummies . en . https://web.archive.org/web/20131105090942/http://www.dummies.com/how-to/content/pros-and-cons-of-static-routing.html . 2013-11-05.
  8. Web site: Chapter 5. Network setup . 2024-12-18 . www.debian.org.
  9. Web site: 8.2. Configuring the Network . 2024-12-18 . www.debian.org.
  10. Web site: 16.4. Static Routes and the Default Gateway Red Hat Enterprise Linux 5 . 2024-12-18 . docs.redhat.com.
  11. Web site: 2013-02-02 . Cisco IOS IP Command Reference, Volume 2 of 4: Routing Protocols, Release 12.3 T - IP Routing Protocol Commands: ip policy route-map through is-type . 2024-12-18 . https://web.archive.org/web/20130202041013/http://www.cisco.com/en/US/docs/ios/12_3t/ip_route/command/reference/ip2_i2gt.html#wp1106404 . 2 February 2013 .
  12. Web site: Describe Administrative Distance . 2014-06-12 . Cisco . en.