I already explained a couple of times in class that we are not worrying yet how routers get their routing tables. The problem of how routers get their routing tables will be handled later, see Forouzan Ch 13. For the time being, we pretend: Routing tables are given. For example, put in by hand by a super intelligent systems manager. That manager is so intelligent that he or she never makes errors: All routing tables are consistent. A packet never travels around in a cycle. (And equipment never fails, so routing tables do not need to be updated!). ---- A different problem is how users get addresses. Currently, the situation is as follows: Companies that already ``own'' an address space (like NJIT ``owns'' 128.235.0.0/16 and Telcordia (I believe) ``owns'' 192.4.0.0/16) keep that address space and take it with them if they change ISP. On the other hand, many companies now, in particular smaller companies, get a small address space from their ISP (defined in ``slash notation''). When those companies change ISP, they get a new address space. To fully understand the consequences of what happens when IP addresses change but (for example) names of computers remain the same, we must learn about DOMAINS , see Forouzan Ch 16. ---- Next, we give an example of routing tables that use slash notation, and contain host-specific routes, and (of course!) use longest-fit routing. For good measure we throw in a default route. The example is on my website. See http://web.njit.edu/~ott/CIS656.S.02/mininet.html (Or: Go to http://web.njit.edu/~ott, click on CIS656, Spring 2002, click on Example Mini-Network.) There is a company that owns address spaces 221.45.71.0/24 and 221.45.72.0/24 . (Please note that this is bad design: It is impossible to combine those two address spaces into some x.y.z.0/23 .) (If the other parts of 221.45.64.0/20 had not already been given to other companies, we COULD give this company the whole address space 221.45.64.0/20 , but then the company would have had an address space 8 times as large as what it seems to need. This shows the need for being careful when handing out IP address space!) For safety, the company has two routers to the outside world (to its ISP: UUnet). Large companies often do this. Sometimes companies choose to have two routers to two different ISPs, one for normal use and one for when the first router or link or ISP fails. (When such a failure occurs the routing tables must be updated, see Forouzan Ch 13). The two routers are R1 and R2. There are two networks: Network 1 = 221.45.71.0/24 . Network 2 = 221.45.72.0/24 . Router R1 has IP address 20.20.20.21 toward UUnet and IP address 221.45.71.240 on Network 1. Router R2 has IP address 20.20.20.22 toward UUnet and IP address 221.45.72.140 on network 2. Router R3 has IP address 221.45.71.224 on network 1 and IP address 221.45.72.224 on network 2. For 1 .LEQ. k .LEQ. K host k has address 221.45.71.k on nework 1. For 1 .LEQ. i .LEQ L-K, host (K+i) has address 221.45.72.i on network 2. (We assume K < 224 and L-K < 224). Host L+1 is "multi-homed" to network 1 and network 2. On network 1 it has address 221.45.71.248, and on network 2 it has address 221.45.72.248. --- This was the network. Next we put in the routing tables. Router 1 has entries (a bit abbreviated): Network | ``action'' | 221.45.71.0/24 | Direct delivery to host on network 1 221.45.72.0/24 | Forward to 221.45.71.224 on network 1 221.45.72.248/32 | Direct Delivery to 221.45.71.248 (Router 1 has more entries in its routing tables, for traffic from the company to UUnet and the rest of the world). We see: If router 1 has a packet for a host on network 1, it does direct delivery. If router 1 has a packet for a host on network 2, it forwards to router 3, UNLESS the destination address is the address of host L+1 on network 2. In that case the packet is sent to the IP address of host L+1 on network 1. This is an example of a ``host specific route''. To check this works: Suppose router 1 has a packet with destination address 221.45.72.248. It compares with 221.45.71.0/24 : no match. (check at home!). It compares with 221.45.72.0/24 : Packet Dest Address: 1101 1101 0000 1101 0100 1000 1111 1000 Mask: 1111 1111 1111 1111 1111 1111 0000 0000 AND: 1101 1101 0000 1101 0100 1000 0000 0000 There is a fit! But: it also compares it with 221.45.72.248 : Packet Dest Address: 1101 1101 0000 1101 0100 1000 1111 1000 Mask: 1111 1111 1111 1111 1111 1111 1111 1111 AND: 1101 1101 0000 1101 0100 1000 1111 1000 There also is a fit! So we have two fits! In that case the fit with the longest mask wins: The action is "Direct Delivery to 221.45.71.248". ---- A similar situation in router 2. Do as homework! ---- There is an interesting situation in router 3. Let us make the policy that a packet in R3 for any destination outside network 1 or network 2 is sent to router R1. For example, because router R1 is an expensive, fast router. Router R3 now has the following entries in its routing table: Network | ``action'' | 221.45.71.0/24 | Direct delivery to host on network 1 221.45.72.0/24 | Direct delivery to host on network 2 0.0.0.0/0 | Forward to 221.45.71.240 on Network 1 For ANY destination address w.x.y.z there is a match with 0.0.0.0/0 . (Check: homework). But that match has a mask of length zero. So if there is any other match, the other one wins. (If there were multiple other ones, the one with the longest mask would win). We call 0.0.0.0/0 a ``Default Route''. The router uses this route if there is no other route that fits.