IP Routing

Table of contents:

Introduction

Routing is the act of forwarding packets toward a given destination from one network segment or interface to the next. Routing tables, also sometimes called routing information bases ( RIBs), are the databases that routers use to route traffic toward their destination. These tables contain the network addresses and prefixes that have been learned from dynamic routing protocols such as RIP, IS-IS, OSPF, and BGP; that have been learned statically from static (configured) routing-table entries; and that have been learned from the router's network interfaces. Each address and prefix in a routing table has a next hop associated with it that takes the packet one hop closer to its destination.

Each IP packet that a router receives contains two types of information: the packet data itself (the packet's payload) and information that identifies the packet. In IP packets, the identifying information is at the beginning of the packet, in the header. One of these header fields is the source address, which states the packet's origin; another, which is key to the routing tables, is the destination address, which tells where the packet is going when the router uses standard destination-based forwarding. (Routing policy can alter the path toward a destination.) When the router is determining the path toward the destination, it checks the routing table for a route that matches the packet's destination and then sends the packet to the next hop associated with that route. If there is no exact match, the router locates a more general route, selecting the longest match, which is the route that matches the most bits in the network portion of the address. For example, if the packet's destination is 10.0.16.2 and the routing table contains a route to 10.0.16.2/32, which is the address of the specific host, the packet is sent using the next hop associated with that route. If the only matching routes in the table are 10.0.0.0/8 and 10.0.16.0/24, the latter route is used because it is the longest match.

If no match is found in the routing table, the default route of 0.0.0.0/0 is used if it exists. If no default route is configured or learned, the traffic is dropped.

When a single routing protocol provides equal-cost paths to a single prefix, the JUNOS default is to randomly choose one path on a per-prefix basis.

The JUNOS routing-protocol process (RPD) maintains a number of different routing tables to separate information learned from or used by different protocols. Table 8-1 lists the default routing tables that RPD maintains. You cannot rename the default routing tables or use them for different purposes but you can create routing tables for other purposes. All IPv4 routing tables are named inet.n, and all IPv6 routing tables are named inet6.n, where n is an integer.

Table 8-1. JUNOS default routing tables

Name

Description

inet.0

IPv4 unicast routes. BGP, IS-IS, OSPF, and RIP store their routing information in this table and use the routes in this table when advertising routes to their neighbors. Configured static routes are also stored in this table.

inet.1

Multicast forwarding cache. DVMRP and PIM store their routing information in this table.

inet.2

Used by MBGP to provide reverse path forwarding (RPF) checks.

inet.3

Traffic engineering paths. Stores path and label information.

inet6.0

IPv6 unicast routes.

iso.0

ISO routes for IS-IS.

mpls.0

MPLS label-switched path (LSP) next hops.

From the routes in each routing table, RPD determines active routes toward network destinations. For unicast routes, RPD chooses the route with the lowest preference value. For multicast traffic, RPD determines active routes based on traffic flow and other parameters specified by the multicast routing-protocol algorithms.

RPD installs the active routes into the Routing Engine's forwarding table (also sometimes called a forwarding information base, or FIB), and the Routing Engine's kernel copies this table to a forwarding table maintained by the Packet Forwarding Engine (PFE). This forwarding table maps each next-hop router IP address with the physical interface through which that router is reached. Forwarding-table entries are used to physically direct traffic out a router interface and toward its destination.

In addition to storing a superset of the routes that are installed into the forwarding tables, the routing-table routes also contain control information that is not relevant to forwarding. This information includes the metric, AS path, and BGP communities.

Juniper Networks M-series and T-series routers architecturally and physically separate the routing and forwarding processes. Routing is done by RPD, which runs on the Routing Engine, a small form-factor PC that is built into the router. The RE encompasses the control plane and performs all routing operations. Routing means discovering the network topology and sharing this information with neighboring routers. Routing protocols, both interior gateway protocols (IGPs)such as RIP, IS-IS, and OSPF, and the exterior gateway protocol (EGP) BGP, learn network topology by talking with other routers and advertising routing information to them. A number of other software modules run in the router's control plane, including the CLI and accounting processes such as SNMP. Each of these modules runs as a separate process in the JUNOS software, and, in some cases, multiple instances of a module might be running (for instance, if two users are logged in to the router, two CLI processes run).

The PFE is the router's forwarding plane, housing the forwarding table and handling most forwarding processing. Forwarding is the process of receiving a packet on an inbound interface, de-encapsulating it, executing a number of packet-processing activities (such as filtering, accounting, and next-hop determination), encapsulating it, and queuing it on the outbound interface toward the packet's destination. The PFE consists of custom ASICs and the router's input and output interfaces. The ASICs use the forwarding table to perform route lookup, looking up the IP address prefix and determining the output interface (next hop) for the packet. The link between the Routing Engine and the PFE is a standard Fast Ethernet link (the fxp1 interface).

On the smaller J-series routers, the control and data planes are handled by the same CPU, which runs the software for both the RE and PFE.

RPD installs all active routes from the routing tables into the forwarding table. The JUNOS kernel maintains a master copy of the forwarding table and copies the table to the PFE. The operation to update the forwarding table is done atomically, one route at a time. This ensures that the forwarding table always has a single view of how to forward traffic on the network.

IPv4 and IPv6 Addresses

IPv4 addresses are 32 bits long and are written in a dotted quad notation. Originally, IPv4 addresses were divided into four classes, Classes A, B, C, and D. This type of addressing is called classful. Classful addresses require an address and a network mask. The address consists of a network portion and a host portion. The subnetwork mask defines how to interpret the address bits in order to know which are being used for the network portion and which for the host portion.

The IETF developed classless addresses in the late 1990s with the introduction of Classless Interdomain Routing ( CIDR). This was done as one way to increase the number of network addresses available on the Internet. All IPv4 addresses on JUNOS routers are expressed in CIDR format. Instead of network and host portions and subnetwork masks, CIDR addresses have a prefix that represents the network address, followed by a slash and the prefix length, which identifies the number of bits being used for the network address. For example, one of the groups of routers used as examples in this book has interface addresses in the network 10.0.1.0/24. Here, the prefix is 10.0.1.0, and 24 bits are used for the network prefix. The remaining 8 bits are available for host addresses, so this network can have up to 256 hosts.

IPv6 uses 128-bit addresses that consist of 8 groups of 16-bit hexadecimal values separated by colons, followed by a slash and a mask, or prefix length, that indicates which bits are the network address. An example of an address is fe80:0000:0205: 85ff:feca:ca70/128. You can omit any leading zeros in a group, so you can shorten this address to fe80::205:85ff:feca:ca70/128.

A complete discussion of the structure of IP addresses is beyond the scope of this book. For more information, see IP Routing and IPv6 Essentials (both from O'Reilly).

Default Route Preferences

A route's preference is a value from 0 through 255 that ranks a route with respect to other routes to the same prefix. When RPD learns about routes to the same destination from different sources, including routing protocols, it chooses the one that has the lowest preference value as the active route and installs it in the forwarding table. The default preference value depends on how the route was learned (see Table 8-2).

Table 8-2. JUNOS default route preferences

How route is learned

Default preference value

Directly connected router or network

0

Static routes

5

MPLS

7

LDP

9

OSPF internal routes

10

IS-IS Level 1 internal routes

15

IS-IS Level 2 internal routes

18

SNMP

50

RIP, RIPng

100

PIM

105

DVMRP

110

Aggregate

130

OSPF external routes

150

IS-IS Level 1 external routes

160

IS-IS Level 2 external routes

165

BGP

170

MSDP

175

If more than one route exists with the same preference, secondary criteria are used to select which is the active one.

Selecting Active Routes

For each destination (prefix) in the routing table, RPD selects the best route, called the active route, and installs it into the forwarding table. The algorithm that RPD uses to select the active route is fairly involved, but there will be times when you will be analyzing the flow of traffic through your network and you will need to understand how and why RPD has chosen a particular path. The following is the JUNOS algorithm for selecting the active route:

  1. Choose the route with the lowest preference value.
  2. For BGP routes, prefer the one with the higher local preference value. Otherwise, choose the path with the lowest preference2 value. (This is a secondary preference you can set for some protocols to use as a tiebreaker when the primary preferences are identical.)
  3. If the route includes an AS path:

    1. Prefer the route with a shorter AS path. (Confederation sequences are assigned a path length of 0, and AS and confederation sets have a path length of 1.)
    2. Prefer the route with the lower origin code. Routes learned from an IGP have a lower origin code than those learned from an EGP, and both have lower origin codes than incomplete routes (routes whose origin is unknown).
    3. If you are not using BGP nondeterministic routing-table path selection behavior, for paths with the same neighboring AS numbers at the beginning of the AS path, prefer the path with the lowest multiple exit discriminator ( MED) metric. Confederation AS numbers are not considered when deciding what the neighbor AS number is.

      If you are using nondeterministic routing-table path selection behavior, prefer the path with the lowest MED metric.

      In both cases, confederations are not considered when determining neighboring ASs, and a missing metric is treated as a MED of 0.

  4. Prefer strictly internal routes, which include IGP routes and locally generated routes (such as static and direct).
  5. Prefer strictly EBGP routes over external paths learned through IBGP.
  6. For BGP, prefer the route whose next hop is resolved through the IGP route with the lowest metric.
  7. For BGP, prefer the route with the greatest number of BGP next hops.
  8. For BGP, prefer the route with the shortest route reflection cluster list. Routes without a cluster list are considered to have a cluster list of length 0.
  9. For BGP, prefer the route with the lowest IP address value for the BGP router ID.
  10. Prefer the path that was learned from the neighbor with the lowest peer IP address.


Router Configuration and File Management

Basic Router Security and Access Control

IPSec

SNMP

Logging

NTP

Router Interfaces

IP Routing

Routing Policy and Firewall Filters

RIP

IS-IS

OSPF

BGP

MPLS

VPNs

IP Multicast



JUNOS Cookbook
Junos Cookbook (Cookbooks (OReilly))
ISBN: 0596100140
EAN: 2147483647
Year: 2007
Pages: 290
Authors: Aviva Garrett

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net