路由 - 路由概念

路由算法的基础概念

路由算法主要功能:(选择最优路径 & 转发数据包)

* 根据路由表选择最优路径 (routing table)

* 转发数据包

 

数据包转发机制 

Routing table-driven switching - The first and oldest switching mechanism available in Cisco routers is process switching(过程转发). Becase process switching must find a destination in the routing table(possibly a recursive lookup) and construct a new Layer 2 frame header for every packet, it is very slow and is normally not used.

Cache-driven switching - To overcome the slow performance of process switching, Cisco IOS platforms support several switching mechanisms that use a cache to store the most recently used destinations. The cache uses a faster searching mechanism and it stores the entir Layer 2 frame header to improve the encapsulation performance. The first packet whose destination is not found in the fast-switching cache is process-switched, and an entry is created in the cache. The subsequent packets are switched in the interrupt code using the cache to improve performance.

Topology-driven switching - CEF, which incorporates the best of the previous switching mechanisms. CEF supports per-packet load balancing, per-source or per-destination load balancing fast destiantion lookup, and many other features not supported by other switching mechanisms.

 

Using Standard IP switching, The following steps occur with process switching and fast switching:

Step 1: When a BGP update is received and processed in the BGP table, an entry is creted in the routing table if it is selected as the best route.

Step 2: When the first packet arrives for this destination, the router tries to find the destination in the fast-switching cache. Because the destination is not in the fast-switching cache, process switching has to switch the packet. A recursive lookup is performed to find the outgoing interface. If the Layer 2 address is not found in the cache, an ARP request is triggered. Finally, an entry is created in the fast-switching cache.

Step 3: All subsequent packets for the same destination are fast-switched, as follows:

The switching occurs in the interrupt code(the packet is processed immediately).

Fast destination lookup is performed(no recursive lookup).

The encapsulation uses a pregenerated Layer 2 header that contians the destination and Layer 2 source(MAC) address.

 

What is CEF Switching Architecture?

CEF uses a complete IP swiching table. the FIB table, which holds the same information as the IP routing table. The generation of entries in the FIB table is not packet-trigged but change-triggered. When something changes in the IP routing table, the change is also reflected in the FIB table.

 

路由器内部构造 

* CPU

* RAM (Random Access Memory)

* ROM (Read-Only Memory)

* NVRAM (Non-Volatile Random Access Memory)

* Flash 

* Operating System 

 

 

路由器启动过程

第一步:执行POST自检

第二步:Execute Bootup loader

第三步:Locate the IOS

第四步:Load the IOS

第五步:Locate the Configuration File

第六步:Execute the configuration File .... Or enter Setup Mode

 

(冷启动)Cold Start

When a router powers up, it knows nothing about the network topology. It does not even know that there are devices on the other end of its links. The only information that a router has is from its own saved configuration file stored in NVRAM.

 

Router interfaces can be divided into two major groups (Show ip interface brief)

  • LAN interfaces - such as Ethernet and FastEthernet
  • WAN interfaces - such as serial, ISDN, and Frame Relay

   

Routing Table(路由表)

show ip route   

 

What is a gateway of last resort?

The IP address of another router.

   

What is the purpose of a routing protocol?

Allows a router to share information about known networks with other routers

 

Let's introduce three routing table principles, as described by Alex Zinin Cisco IP Routing.

Principle 1: "Every router makes its decision alone, based on the information it has in its own routing table."

Principle 2: "The fact that one router has certain information in its routing table does not mean that other routers have the same information."

Principle 3: "Routing information about a path from one network to another does not provide routing information about the reverse, or return path."

 

Dynamic Routing(动态路由)

share information about the reliability and status of remote networks. Dynamic routing protocols perform several activities, including:

  • Network discovery (网络自动发现)
  • Updating and maintaining routing tables(更新与维护路由表)

 

Packet forwarding involves two functions:

  • Path determination function
  • Switching function
    • Path determination function is the process of how the router determines which path to use when forwarding a packet.
      One of three path determinations results from this search:
      • Directly Connected Network
      • Remote Network
      • No Route Determined
           
    • Switching function is the process used by a router to accept a packet on one interface and forward it out another interface.

   

   

 

Load Balancing

Equal cost load balancing: when a router has two or more paths to a destination with equal cost metrics, then the router forwards the packets using both paths equally.

   

Only EIGRP supports unequal cost load balancing.

 

 

What does a router do with a packet received from one network and destined for another network?

 

 

 

 

The router performs the following three major steps:

 

第一步:Deencapsulates the Layer 3 packet by removing the Layer 2 frame header and trailer.

第二步:Examines the destination IP address of the IP packet to find the best path in the routing table.

第三步:Encapsulates Layer 3 packet into a new Layer 2 frame and forwards the frame out the exit interface.

   

 

Router#erase startup-config 
Router#reload // 清除所有现有配置 
Router(config)#no ip domain-lookup //禁用DNS查找 
Router(config)#line console 0 
Router(config-line)#logging synchronous //IOS no longer interfere with your typing. 
Router(config)#no exec-timeout 0 0 //退出时间 0 min 0 sec
 

 

Router(config)#hostname XXX 
Router(config)#enable secret XXX 
Router(config)#line console 0 
Router(config-line)#password cisco 
Router(config-line)#login 


Router(config)#line vty 0 4 
Router(config)#password cisco 
Router(config)#login 
Router(config)#banner motd #message# 
R1(config)#service password-encryption 
R1#copy running-config startup-config

 

R1(config)#ipv6 unicast-routing #begins sending ICMPv6 router advertisement messages 
R1(config)#interface type number 
R1(cofig-if)#description XXXX 
R1(config-if)#ipv6 address 2001:db8:acad:1::1/64 [link-local] [eui-64] // Configure IPv6 Address 
R1(config-if)#ipv6 address ipv6-address/prefix-length //create a global unicast 

//configure a global unicast IPv6 address with an interface ID in the low-order 64 bits of the IPv6 address using the EUI-64 

R1(config
-if)#ipv6 address ipv6-address/prefix-length eui-64

R1(config-if)ipv6 address ipv6-address/prefix-length link-local // create a static lik-local R1(config-if)# no shutdown

 

R1# show ipv6 route 
S1#show ip interface //display the IP interface status and configuration 
S1#show ip interface brief //display a brief summary of IP status and configuration 
S1#show ip route connected //displays a list of active directly connected networks 
S1#show history 
S1#terminal history size 200

 

 
  • Section - show entre section that starts with the filtering expression
  • Include - includes all output lines that match the filtering expression
  • Exclude - excludes all output lines that match the filtering expression
  • Begin - show all the output lines from a certain point, starting with the line that matches the filtering expression.
    Command History Feature: ctrl + p or up arrow        
  • Protocol:
    Perspective and Background Routing protocols are used to facilitate the exchange of routing information between routers. Routing protocols allow routers to dynamically share information about remote networks and automatically add this information to their own routing tables.    Network discovery and Routing table maintenance A routing protocol is a set of processes, algorithms, and messages that are used to exchange routing information and populate the routing table with the routing protocol's choice of best paths. The purpose of a routing protocol includes: Purpose : IGP or EGP
    • Discovery of remote networks
    • Maintaining up-to-date routing information
    • Choosing the best path to destination networks
    • Ability to find a new best path if the current path is no longer available
       What are the components of a routing protocol?
    • Data structures - Some routing protocols use tables and/or databases for its operations. This information is kept in RAM.
    • Algorithm - An algorithm is a finite list of steps used in accomplishing a task. Routing protocols use algorithms for facilitating routing information and for best path determination.
    • Routing protocol messages - Routing protocols use various types of messages to discover neighboring routers, exchange routing information, and other tasks to learn and maintain accurate information about the network.
       Dynamic Routing Advantages
    • Suitable in all topologies where multiple routers are required.
    • Generally independent of the network size
    • Automatically adapts topology to reroute traffic if possible.
       Disadvantages:
    • Can be more complex to implement
    • Less secure. Additional configuration settings are required to secure.
    • Route depends on the current topology.
    • Requires additional CPU, RAM and link bandwidth.
       Dynamic Routing Protocol Operation In general, the operations of a dynamic routing protocol can be described as follows:
    • The router sends and receives routing messages on its interfaces.
    • The router shares routing messages and routing information with other routers that are using the same routing protocol.
    • Routers exchange routing information to learn about remote networks.
    • When a router detects a topology change the routing protocol can advertise this change to other routers.
       Classifying Dynamic Routing Protocols  Routing protocols can be classified by their:
  • Operation: DC or Link-State or Path-vector Protocol
  • Behavior: classful or classless protocol
    IGP and EGP An autonomous system (AS) - otherwise known as a routing domain - is a collection of routers under a common administration.
  • Interior Gateway Protocols (IGP) are used for intra-autonomous system routing - routing inside an autonomous system
  • Exterior Gateway Protocols (EGP) are used for inter-autonomous system routing - routing between autonomous systems
       Distance Vector and Link State
    • Distance vector routing protocols typically implement a routing loop prevention technique known as split horizon. Split horizon prevents information from being sent out the same interface from which it was received.
         
    • Distance vector means that routes are advertised as vectors of distance and direction. Distance is defined in terms of a metric such as hop count and direction is simply the next-hop router or exit interface. Distance vector protocols typically use the Bellman-Ford algorithm for the best path route determination.
       Distance vector protocols work best in situations where:
    • The network is simple and flat and does not require a special hierarchical design.
    • The administrators do not have enough knowledge to configure and troubleshoot link-state protocols.
    • Specific types of networks, such as hub-and-spoke networks, are being implemented.
    • Worst-case convergence times in a network are not a concern.
       Link-state protocols work best in situations where:
    • The network design is hierarchical, usually occurring in large networks.
    • The administrators have a good knowledge of the implemented link-state routing protocol.
    • Fast convergence of the network is crucial.
       Classful and Classless Classful routing protocols do not send subnet mask information in routing updates. Classless routing protocols include the subnet mask with the network address in routing updates.    Convergence
    • Convergence is when all routers' routing tables are at a state of consistency. The network has converged when all routers have complete and accurate information about the network.
         
    • Convergence time is the time it takes routers to share information, calculate best paths, and update their routing tables.
       The speed of achieving convergence consists of:
    • How quickly the routers propagate a change in the topology in a routing update to its neighbors.
    • The speed of calculating best path routes using the new routing information collected.
       

Purpose of Metric

 

A metric is a value used by routing protocols to assign costs to reach remote networks. The metric is used to determine which path is most preferable when there are multiple paths to the same remote network.

  

Metrics used in IP routing protocols include:

 

  • Hop count - A simple metric that counts the number of routers a packet must traverse
  • Bandwidth - Influences path selection by preferring the path with the highest bandwidth
  • Load - Considers the traffic utilization of a certain link
  • Delay - Considers the time a packet takes to traverse a path
  • Reliability - Assesses the probability of a link failure, calculated from the interface error count or previous link failures
  • Cost - A value determined either by the IOS or by the network administrator to indicate preference for a route. Cost can represent a metric, a combination of metrics or a policy.

   

Administrative Distances(AD值)

AD值定义了路由的优先级

 

posted @ 2015-12-21 14:19  elewei  阅读(803)  评论(0)    收藏  举报