Internetworking

How netorks may differ

Internetworking hides the difference with a common prorocol (IP) and a common addressing scheme (IP addresses).

Connecting Datagram and Virtual Circuit Networks

Need to map a destination address to a VC and visa versa. In order to accomplish this, might have to set up a VC between two routers, and then use datagrams to send packets between the routers.

+--------+   802.11   +--------+ <---- MPLS ----> +--------+  Ethernet  +--------+
|  host  |------------| Router |                  | Router |------------|  host  |
+--------+            +--------+ <--------------> +--------+            +--------+
 source                            VC network                           destination

IP Addressing

IP is the lowest common denominator of the internet. It allows networks that support entirely different services to communicate. Asks very little of the underlying network, and provides very little in return.

IPv4


<--------------------------------------- 32 bits --------------------------------------->

+---------------------+---------------------+---------------------+---------------------+
| Version |    IHL    |   Dif. Services     |         Total Length (bytes)              |
+---------------------+---------------------+---------------------+---------------------+
|              Identification               |    | DF | MF |  Fragment Offset (13 bits) |
+---------------------+---------------------+---------------------+---------------------+
|  Time to Live (TTL) | Protocol (TCP, UDP) |            Header Checksum                |
+---------------------+---------------------+---------------------+---------------------+
|                               Source IP Address (32 bits)                             |
+---------------------+---------------------+---------------------+---------------------+
|                            Destination IP Address (32 bits)                           |
+---------------------+---------------------+---------------------+---------------------+
|                                  Options (0 or more words)                            |
|                                                                                       |
|                                        ....                                           |
+---------------------+---------------------+---------------------+---------------------+
|                                       Payload                                         |
|                                                                                       |
|                                        ....                                           |
+---------------------+---------------------+---------------------+---------------------+

IP Prefixes

Example:

128.13.0.0/16

        Network                Host
+----------+----------+----------+----------+
| 10000000 | 00001101 |   ....   |   ....   |
+----------+----------+----------+----------+

IP Datagram Forwarding

When a host wants to send a packet to another host, it first checks if the destination IP address is on the same network (matching subnet). If it is, it can send the packet directly over the link layer (using ARP to get resolve IP address to MAC address). Otherwise, it sends the packet to the default gateway, or router.

The router then forwards the packet to its next hop based on the destination IP and the router's routing table.

if (NetworkNum of destination = NetworkNum of one of my interfaces):
    deliver packet to destination over that interface (using ARP)
else:
    if (NetworkNum of destination is in my forwarding table):
        deliver packet to NextHop router
    else:
        deliver packet to default router

Longest Prefix Match

for each entry in the forwarding table:
    if (NetworkNum of destination & Mask) == (NetworkNum of entry & Mask):
        deliver packet to NextHop router