Internetworking is an arbitrary collection of network(either 802.11 or Eithernet or other) inter-connected together via routers(Gateway) to provide end-to-end service.

It uses IP to build heterogenious and scalable network.

Service model

IP needs to provide a service model that’s undemanding enough that the underlying physical network can provide the necessary service.

Addressing scheme

Datagram delivery

Datagram is a type of packet that’s sent in connectionless manner over a network. If the packet is corrupted, then that’s it. It’s unreliable. This “best effort” means: 1. Packet could be lost 2. Packet might arrive out of order 3. Packet might be received twice

IP packet format

ip format

First word:

Version: IP v4 or Iv Hlen : Header length in words. If not set the default is 5 words(20 bytes) TOS: Type of service: TCP or UDP. Allow packet to be treated differently for different service Lentgh: Size of datagram. In BYTE. It has 16 bits so the max size of a packet is 65535 bytes.

Second word:

Used to fragmentation. Explained in detail in next section.

Third word:

About transportation TTL: Time to live. Each router will decrease by 1. Set by sending host. Default at 64. Protocol:TCP or UDP Checksum:

Forth word

Source addr

Fifth word

Destination Address


Fragmentation breaks larger packets into smaller packets and provide means to reassemble them eventually at the end host. Fragmentation is needed because every network has its MTU Maximum trasmission unit, the largest IP datagram it can carry in a frame.

MTU and and max IP datagram size

MAX IP datagram size is smaller than MTU since we need to fit the entire IP datagram into the payload of frame for the network(Ethernet or wireless)


With Offset and IsEnd flag in the second word in the IP header.

Offset counts 8-bytes chunk

It is assumed that the boundary for fragmentation is always gonna be multiple of 8 bytes It is done so because the num of bits used to express offset length is smaller than 16 because we need to accommendate other flags. So we have to count in a higher unit.

Global Address

IP is hierarchical

Made up with several parts. Network and host. The network part identifies the network that the host is connected to. All host in the same network has the same network part for IP address.

Class-ful network

IP address is divided into 3 classes. A, B and C. Class A has leading bit 0, class B has leading bit 10 and class C has leading 110. Presumabily, class D has leading 1110.

Size of network for each class

There are 2^32 – 1 possible address. Since half of them can start with leading 0 bit, class A has half of those IP address. Of the remaining half, the leading bit of the IP addresses all start with one and can be split in half by the second leading bit. Class B address starts with 10, which takes half from the remaining half == 1/4 of total.

Datagram forwarding in IP

Assume the forwarding table is built already by routing proces. Entries in forwarding table is just <NetworkNumber, NextHop>

if(NetworkNum of Dest IP == NetworkNum of one of my interface){
  forward to that interface
else if (NetworkNum of DestIp == one of the entry in forwarding table){
  Forward it to NextHop
else {
Forward to default

Inefficiency introduced by class-ful network

A class C network can have 254 hosts. But if you need to have 255 hosts, then you need to upgrade to a class B network. But the utilization would be less than 1%.


Appear to outside as a single network but inside its another Inter-network. Use subnet mask to check if packet belong to that specific network

Classless network (CIDR)

CIDR stands for Classless interdomain Routing. Imagine a client needs 16 class C addresses. We give them a contiguous class C addresses. EG 192.4.16 — 192.4.31. The top 20 bits are identical. Effectively created a subnet of size 20 bits. EG: ISP can advertise a shorter network address prefix so the routing backbone can route all traffic that share the same prefix to that ISP.

ARP(address resolution protocol)

Translate IP addres to link-layer address(MAC). Broadcast an ARP request. The host with the dest address will reply the ARP

Virtual Network

It’s like virtual circuit switching in layer2 but in layer 3(in concept) It is a virtual point to point connection. But actually its separated by arbitrary amount of links.

The router at the entrance of the tunnel will encapsulate the IP packet with another IP header ** that contains **the dest IP address. The router at the entrance will also has a virtual interface for packet to the exit of tunnel. If the next hop of the forwarding table, the router will simply append the IP header and treat it like a regular packet, forwarding it to the right physical interface based on the appended IP header.

At the end of the tunnel, since the router must be connected to the network the sender is intended, the router can just forward the packet to the network.

Host config via DHCP

In Ethernet, MAC addresses are predetermined by the manufacturer. IP addresses also need to be unique and also need to reflect structure of the network. This prevents hard-code IP since the device’s network might change.
Use DHCP, dynamic host configuration protocol.
Set up a DHCP server that maintains a pool of available IP and users can request them.
Q: How to get to DHCP in the first place?
A: A new device can send a DHCPDISCOVER msg to ip(225,225,225,225) the broadcast address. All hosts and routers will receive this msg routers won’t forward it.
DHCP will response.

We can let multiple networks use the same DHCP server by using relay agents

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see