Cracking the Coding Interview, 4 Edition - 150 Programming Interview Questions and Solutions
Cracking the Coding Interview, 4 Edition - 150 Programming Interview Questions and Solutions
Cracking the Coding Interview, 4 Edition - 150 Programming Interview Questions and Solutions
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Solutions</strong> to Chapter 17 | Networking<br />
17.2 Explain any common routing protocol in detail. For example: BGP, OSPF, RIP.<br />
SOLUTION<br />
pg 84<br />
Depending on <strong>the</strong> reader’s level of underst<strong>and</strong>ing, knowledge, interest or career aspirations,<br />
he or she may wish to explore beyond what is included here. Wikipedia <strong>and</strong> o<strong>the</strong>r websites<br />
are great places to look for a deeper underst<strong>and</strong>ing. We will provide only a short summary.<br />
BGP: Border Gateway Protocol<br />
BGP is <strong>the</strong> core routing protocol of <strong>the</strong> Internet. “When a BGP router first comes up on <strong>the</strong><br />
Internet, ei<strong>the</strong>r for <strong>the</strong> first time or after being turned off, it establishes connections with<br />
<strong>the</strong> o<strong>the</strong>r BGP routers with which it directly communicates. The first thing it does is download<br />
<strong>the</strong> entire routing table of each neighboring router. After that it only exchanges much<br />
shorter update messages with o<strong>the</strong>r routers.<br />
BGP routers send <strong>and</strong> receive update messages to indicate a change in <strong>the</strong> preferred path<br />
to reach a computer with a given IP address. If <strong>the</strong> router decides to update its own routing<br />
tables because this new path is better, <strong>the</strong>n it will subsequently propagate this information<br />
to all of <strong>the</strong> o<strong>the</strong>r neighboring BGP routers to which it is connected, <strong>and</strong> <strong>the</strong>y will in turn<br />
decide whe<strong>the</strong>r to update <strong>the</strong>ir own tables <strong>and</strong> propagate <strong>the</strong> information fur<strong>the</strong>r.”<br />
Borrowed from http://www.livinginternet.com/i/iw_route_egp_bgp.htm.<br />
RIP: Routing Information Protocol<br />
“RIP provides <strong>the</strong> st<strong>and</strong>ard IGP protocol for local area networks, <strong>and</strong> provides great network<br />
stability, guaranteeing that if one network connection goes down <strong>the</strong> network can quickly<br />
adapt to send packets through ano<strong>the</strong>r connection. “<br />
“What makes RIP work is a routing database that stores information on <strong>the</strong> fastest route<br />
from computer to computer, an update process that enables each router to tell o<strong>the</strong>r routers<br />
which route is <strong>the</strong> fastest from its point of view, <strong>and</strong> an update algorithm that enables<br />
each router to update its database with <strong>the</strong> fastest route communicated from neighboring<br />
routers.”<br />
Borrowing from http://www.livinginternet.com/i/iw_route_igp_rip.htm.<br />
OSPF: Open Shortest Path First<br />
“Open Shortest Path First (OSPF) is a particularly efficient IGP routing protocol that is faster<br />
than RIP, but also more complex.”<br />
The main difference between OSPF <strong>and</strong> RIP is that RIP only keeps track of <strong>the</strong> closest router<br />
for each destination address, while OSPF keeps track of a complete topological database of<br />
all connections in <strong>the</strong> local network. The OSPF algorithm works as described below.<br />
CareerCup.com<br />
2 5 0