170 likes | 380 Views
Routing. So how does the network layer do its business?. Forwarding. The actual “routing” part of routing is pretty straightforward. A packet arrives. The router gets the destination address of the packet and looks up its entry in the routing table
E N D
Routing So how does the network layer do its business?
Forwarding • The actual “routing” part of routing is pretty straightforward. • A packet arrives. • The router gets the destination address of the packet and looks up its entry in the routing table • The routing table tells the router what machine to forward the packet to, and on what port.
Routing table • The actual guts of routing is the routing table. • The routing table is what tells the router where to forward packets it receives, based on the destination address. • Static routing tables are ones where all the entries are manually entered by a system administrator. • Dynamic routing tables are ones where the router builds the table itself. • When we talk about a “routing protocol” we are referring to a system for building dynamic routing tables.
Stages of construction • All routing protocols involve three stages: • Initialization: Setting the initial state of the routing table depends on what the later steps of the protocol are. • Sharing: For any dynamic routing to work, routers must share some or part of their routing tables with their neighbors. • Updating: Based on the information a router gets from its neighbors, it needs to update its own routing table.
Unicast routing • All routing wants to find the least-cost route between any two nodes of the network. They differ in how they define “least cost.” • The majority of communication is from one source to a single destination. This is unicast communication, and requires unicast routing. • There are three main systems of unicast routing: • Distance vector • Link State • Path vector
Distance vector routing • Distance vector routing defines the least-cost route as the one with the shortest distance. • In the initialization phase, routers know the distance to their immediate neighbors, and assume all other nodes are an infinite distance away.
In the sharing phase, each node shares its routing table with all of its neighbors. • This generally happens immediately when there is a change. • Otherwise, on a periodic basis. • Updating is relatively straightforward. Presume node B sends it’s table to node A. A then: • Adds the distance from A to B to all of the distances in B’s table. • A adds B as the next-hop for every entry in B’s table. • A compares each row of its table with the corresponding row of B’s table. • If the next-hop entry is different, A keeps the row with the lower cost. • If it is the same, A keeps the new row.
One problem with distance vector routing is the two-node loop instability, which is a form of a race condition. • Solutions include: • Redefine infinity so eventually the system stops. • Split horizon: B does not need bother telling A about routes to X that go through A. • Split horizon w/ poison reverse
Routing Information Protocol • RIP implements distance vector routing for parts of the internet. • Distance is defined as the number of hops. Each hop has a distance of 1. • Infinity is defined as 16.
Link State Routing • Each node in the network knows the full network topology - nodes, links, costs of links, etc. • Each node uses Dijkstra’s algorithm to build its routing table. • Initialization involves each node generating a description of its link states. • Each node shares its link states with every other node using the Link State Packet (LSP). • Each node updates its table using Dijkstra’s algorithm for calculating a shortest path tree.
Path Vector Routing • Distance vector and Link State routing do not scale upwards very well. For large networks (like the internet) we need something else. • Path vector routing works like distance vector routing, except that each LAN has one router called a speaker node that advertises its routing table to its neighboring speaker nodes.
Border Gateway Protocol • BGP implements path vector routing on the internet. It divides autonomous systems into three types: • Stub AS: The end of the line (Carthage) • Multihomed AS: Connections to multiple other AS’s, but no thru traffic allowed (Google) • Transient AS: Thru traffic permitted (backbones)
Multicast link-state routing • Source-based SPTs: Each router has one shortest path tree for each group. A group is a set of destinations for a multicast packet. Essentially, the table maintains a list of next hops for all destinations. • Group-shared trees: One central router distributes all multicast packets. MOSPF implements source-based trees using a special packet associating the unicast address of a host with its group address(es).
Multicast Distance Vector • DVMRP uses source-based trees, but the routing tables are not kept. They are created whenever a multicast packet arrives using one of four methods: • Flooding: The packet is forwarded on every interface except the one it was received from. • Reverse Path Forwarding: Only the copy of a packet that has traveled the shortest possible distance when it arrives at the router is forwarded. • Reverse Path Broadcasting: Define a parent router for each network. The network will only accept multicast packets from a given source through this designated parent router • Reverse Path Multicasting: The designated parent router maintains information about which of its hosts belong to which groups.