Você está na página 1de 7

CMPT 765 LECTURE NOTES

Taken by: Hoda Akbari

Routers and Routing Algorithms


Router: a network device working in the network layer; it receives packets, puts them in a queue and dispatches the packets to the links toward their destinations. To do this, it uses the IP header of packets together with its precalculated forwarding table. Routing ntra!A": #outing within a single autonomous system: a network with a single administrator. $%ample: &"'( and # ' routing protocols

nter!A": sometimes called policy routing; competition and security issues may arise because of communicating among networks with different administrators. $%ample: )*' routing protocol.

OSPF
&"'(+ is a routing protocol based on the Dijkstras algorithm. t constructs a shortest path tree for each source. t is robust against link failures and converges quite rapidly to new solutions in response to dynamic changes in the network.

RIP
# ' acts based on the Bellman-Ford algorithm. $ach node computes and stores a local routing table containing information about which nodes can be reached by how much cost (distance and through which neighbor (ne!t-hop . To propagate this information throughout the network, each node sends its ,node, distance- information to all its neighbors. This happens on a regular basis after each t time units to ensure that the node is live, or when an update occurs.

&pen "hortest 'ath (irst

CMPT 765 LECTURE NOTES


When a link cost goes down:

Taken by: Hoda Akbari

.onsider the following e%ample, where cost of the link "w changes from / to 1.

nitially, routing tables for w and " are:

After the link appears, " and w know that they are now connected with a weight + link. They send their routing tables to each other, and update the routing tables based on the new information:

Apparently, in this case the algorithm converges rapidly.

CMPT 765 LECTURE NOTES


When a link cost goes up:

Taken by: Hoda Akbari

0ow consider the graph below, where cost of the edge ab increases from + to 12.

nitially, routing tables of c and b are as follows:

3hen a and b discover that the link cost has been increased, they update their tables and send them to their neighbors. As the link cost is high, b and a no more route through each other. )ut c doesn4t reali5e the fact, and feeds a and b with obsolete information. This causes a long sequence of alternating changes in routing tables of b and c, until c reali5es that to reach a, it shouldn4t rout through b.

CMPT 765 LECTURE NOTES

Taken by: Hoda Akbari

As you see, when link cost increases, convergence time is very high. This problem is known as 6 #he $ounting to Infinity Problem7. t is caused by the fact that b and c are engaged in a pattern of mutual deception. $ach claims to be able to get to a via the other. To solve the problem, we note that it is never useful to claim reachability for a destination node to the neighbor from which the route passes. 6 %plit hori"on with poisoned re&erse7 solves this problem based on this fact: If node b is next hop on your path to a, advertise infinity to a to b. )ut the problem still remains for longer loops:

nitially, the routing tables are:

Then, b finds out that it is no more linked to a. Also, b receives 6 to a7 from d. Thus, it can route toward a using c. 3hat happens is in an infinite loop, b,c, and d update their route to a: b routes through c, c through d and d through a. Although the 6"plit hori5on with poisoned reverse7 scheme is applied, it turns out to fail for loops of length three or more.

CMPT 765 LECTURE NOTES

Taken by: Hoda Akbari

To come up with the problem: )*' has put an upperbound on the number of hops. Thus infinity is no more unachievable; a specific number e.g. +8 is considered as infinity.

Firewalls
Firewalls are sets of Rules: a list of criteria a packet should satisfy or it will be blocked and won4t be allowed to enter the network. TCP flags !" and #I": "90 and ( 0 flags in T.' header used to manage T.' connections. A "90:( 0 packet is the most well known illegal combination 1. $%ample rules: f a packet comes from a trusted source, accept. f "90 and ( 0 bits are both set, re;ect.

f there is more than one match, the first match is important, i.e. we look through the rules and we stop once we find the first match.

n a sense, this works similar to the forwarding table. The forwarding table in a router determines to which link a packet should be dispatched, considering a prefi% of its destination ' address. n case of a forwarding table, if multiple matches e%ist, the longest should be taken into account.
1

"ince a "90 packet is used to initiate a connection, it should never have the ( 0 flag set in con;unction. t is always a malicious attempt at getting past your firewall. Thus most firewalls are now aware of "90:( 0 packets.

CMPT 765 LECTURE NOTES

Taken by: Hoda Akbari

Forwarding tables
Tables used in network layer to route packets based on the prefi% of their destination ' address.

Remark: IP classes
' address is a <1 bit number. These addresses admit a hierarchical structure. All hosts within a single network have similar parts of ' used as the network address. To route a packet to its destination, we first route it toward the destination network which in turn directs the packet to its destination. Thus at the first step, the host address doesn4t matter. This is analogous to hierarchical structure of mailing addresses: as long as a package hasn4t reached your house, the apartment number is not important. 'reviously, ' addresses belonged to one of the following classes <: .lass A: A small number ,+1=- of networks with huge number ,1 1>- of hosts. .lass ): (or medium si5ed networks. .lass .: (or small networks of at most 18= hosts.

This way of classification caused waste of ' space for two reasons: (ew people liked class . addresses because they were too restrictive; also no network with a class A ' could fill up a reasonable fraction of 11> 's. This happens because the gap between type ) and . is large, making the options too discrete. To prevent waste of ' addresses, we have . ?# >. n . ?#, we dedicate some bits of the network address to the host address. 0etwork addresses are numbers like ++1.8=.2:+> where :+> means we should only look at the first +> bits for subnet mask , ' range-. #outing tables do 6@ongest 'refi% Aatching7: they route packets based on the longest match in the routing table that is a prefi% of destination address. Exam le! refix
<

next"#o

There are also two other classes ? and $. .lassless nter!?omain #outing

>

CMPT 765 LECTURE NOTES


+1<>8=C2++2+B 2++B 22++++B 22+++2B ++2+++B +B B ' B ' B $ ' $

Taken by: Hoda Akbari

a- 2++2222+DD.. : Aatches 1 and C, hence goes through ). b- 2++2++++DD.. : Aatches +, 1 and C, thus goes through A based on ,+-. c- 22++2222DD.. : Aatches default column C: goes through .. To better represent routing tables, they are stored in data structures called #rie. A trie is a tree in which edges represent characters, and each of the nodes represents the string obtained by traversing all edges from the root to that node. To store the routing table using trie, we insert each of the rows as a string in the trie, and for the nodes at the end of each string, we determine the ne%t!hop. To achieve a more compressed representation, we may combine the nodes which have only one child with their descendents. Here is a trie for the above e%ample:
2 2 + + + % 2 + C + 2 2+++ C +

$ + 2

+2+++ C

+ + 2 +

++ % 2+ $ $

+ % $ $

% + + C

Você também pode gostar