An enterprise network generally can be understood as an instance of an autonomous system. As defined within RFC 1030, an autonomous system or AS, as it is also commonly known, is a connected group of one or more IP prefixes run by one or more network operators which has a SINGLE and CLEARLY DEFINED routing policy.
The concept of autonomous systems originally considered the existence of a single routing protocol, however as networks have evolved, it is possible to support multiple routing protocols that interoperate through the injection of routes from one protocol to another. A routing policy can be understood to be a set of rules that determine how traffic is managed within an autonomous system, to which a single, or multiple operator(s) must adhere to.
The principles surrounding switching have dealt mainly with the forwarding of traffic within the scope of a local area network and the gateway, which has until now defined the boundary of the broadcast domain. Routers are the primary form of network layer device used to define the gateway of each local area network and enable IP network segmentation. Routers generally function as a means for routing packets from one local network to the next, relying on IP addressing to define the IP network to which packets are destined.
The router is responsible for determining the forwarding path via which packets are to be sent the route to a given destination. It is the responsibility of each router to make decisions as to how the data is forwarded. Where a router has multiple paths to a given destination, route decisions based on calculations are made to determine the best next hop to the intended destination. The decisions governing the route that should be taken can vary depending on the routing protocol in use, ultimately relying on metrics of each protocol to make decisions in relation to varying factors such as bandwidth and hop count.
Routers forward packets based on routing tables and a forwarding information base (FIB), and maintain at least one routing table and one FIB. Routers select routes based on routing tables and forward packets based on the FIB. A router uses a local routing table to store protocol routes and preferred routes. The router then sends the preferred routes to the FIB to guide packet forwarding. The router selects routes according to the priorities of protocols and costs stored in the routing table. A routing table contains key data for each IP packet.
The destination & mask are used in combination to identify the destination IP address or the destination network segment where the destination host or router resides.
The protocol (Proto) field, indicates the protocol through which routes are learned. The preference (Pre) specifies the preference value that is associated with the protocol, and is used to decide which protocol is applied to the routing table where two protocols offer similar routes. The router selects the route with the highest preference (the smallest value) as the optimal route.
A cost value represents the metric that is used to distinguish when multiple routes to the same destination have the same preference, the route with the lowest cost is selected as the optimal route.
A next-hop value indicates the IP address of the next network layer device or gateway that an IP packet passes through. In the example given a next-hop of 127.0.0.1 refers to the local interface of the device as being the next-hop.
Finally the interface parameter indicates the outgoing interface through which an IP packet is forwarded.
A routing table may contain the routes originating from multiple protocols to a given destination. Not all routing protocols are considered equal, and where the longest match for multiple routes of differing routing protocols to the same destination are equal, a decision must be made regarding which routing protocol (including static routes) will take precedence.
Only one routing protocol at any one time determines the optimal route to a destination. To select the optimal route, each routing protocol (including the static route) is configured with a preference (the smaller the value, the higher the preference). When multiple routing information sources coexist, the route with the highest preference is selected as the optimal route and added to the local routing table.
In the example, two protocols are defined that provide a means of discovery of the 10.1.1.0 network via two different paths. The path defined by the RIP protocol appears to provide a more direct route to the intended destination, however due to the preference value, the route defined by the OSPF protocol is preferred and therefore installed in the routing table as the preferred route. A summary of the default preference values of some common routing mechanisms are provided to give an understanding of the default preference order.
Where the route is unable to be distinguished by either a longest match value or preference, the cost metric is taken as the decision maker in identifying the route that should be installed in the routing table. Cost represents the length of a path to a destination network.
Each segment provides a cost metric value along a path that is combined to identify the cost of the route. Another common factor is network bandwidth, on which the cost mechanism is sometimes based. A link with a higher speed (capacity) represents a lower cost value, allowing preference of one path over another to be made, whilst links of equal speed are given a balanced cost for efficient load balancing purposes. A lower metric always takes precedence and therefore the metric of 50 as shown in the example, defines the optimal route to the given destination for which an entry can be found in the routing table.
By using the “preference” and the “cost”, IP Routing-table can be established.
And the IP Routing-table can be devided into three kinds based on different source.
- Direct routes
- Static routes
- Dynamic routes
In order to allow packets to reach their intended destination, routers must make specific decisions regarding the routes that are learned and which of those routes are applied. A router is likely to learn about the path to a given network destination via routing information that is advertised from neighboring routers, alternatively it is possible for the statically applied routes to be manually implemented through administrator intervention.
Each entry in the FIB table contains the physical or logical interface through which a packet is sent in order to reach the next router. An entry also indicates whether the packet can be sent directly to a destination host in a directly connected network. The router performs an "AND" operation on the destination address in the packet and the network mask of each entry in the FIB table.
The router then compares the result of the "AND" operation with the entries in the FIB table to find a match. The router chooses the optimal route to forward packets according to the best or "longest" match. In the example, two entries to the network 10.1.1.0 exist with a next-hop of 20.1.1.2. Forwarding to the destination of10.1.1.1 will result in the longest match principle being applied, for which the network address 10.1.1.0/30 provides the longest match.
The capability of a router to forward an IP packet to a given destination requires that certain forwarding information be known. Any router wishing to forward an IP packet must firstly be aware of a valid destination address to which the packet is to be forwarded, this means that an entry must exist in the routing table that the router is able to consult. This entry must also identify the interface via which IP packets must be transmitted and the next-hop along the path, to which the packet is expected to be received before consultation for the next forwarding decision is performed.
SUMMARY
When router chooses the best route, first, put the routes with the smallest preference value into IP routing-table; if the priority is equal, then compares metric values to decide which routes to put into the routing table; finally, when looking up the routing table, it chooses the route items to guide the data packet forwarding according to the longest mask matching principle.
The preference is typically used to denote the reliability of a route over routes that may be considered less reliable. Vendors of routing equipment may however assign different preference values for protocols that are supported within each vendors own product. The preference values of some common routing protocols supported by Huawei routing devices can be found within this section.