INTERNETWORKING
Dr. R. Mahammad Shafi
Internetworking
• What is internetwork
– An arbitrary collection of networks interconnected to provide some
sort of host-to-host packet delivery service
A simple internetwork where H represents hosts and R represents routers
13 March 2019 Dr. R. Mahammad Shafi 2
Internetworking
• What is IP
– IP stands for Internet Protocol
– Key tool used today to build scalable, heterogeneous internetworks
– It runs on all the nodes in a collection of networks and defines the
infrastructure that allows these nodes and networks to function as a
single logical internetwork
A simple internetwork showing the protocol layers
13 March 2019 Dr. R. Mahammad Shafi 3
IP Service Model
• Two parts
– Global Addressing Scheme
• Provides a way to identify all hosts in the network
– Datagram (Connectionless) model for data delivery
• Best-effort delivery (unreliable service)
• packets are lost
• packets are delivered out of order
• duplicate copies of a packet are delivered
• packets can be delayed for a long time
13 March 2019 Dr. R. Mahammad Shafi 4
Packet Format
• Version (4 bits):
– currently 4 or 6.
– Also called IPv4 and IPv6
• Hlen (4 bits):
– number of 32-bit words in header
– usually 5 32-bit words with no options
• TOS (8 bits):
– type of service (not widely used)
• Length (16 bits):
– number of bytes in this datagram
including the header
• Ident (16 bits) and Flags/Offset
(16 bits):
– used by fragmentation
13 March 2019 Dr. R. Mahammad Shafi 5
Packet Format
• TTL (8 bits):
– number of hops/routers this
packet can travel
• discard the looping packets
– Originally based on time, but
changed to a hop-count based
– Each router decrements it by 1
– Discard the packet when it
becomes 0
– Default is 64
– Problems
• Setting it too high the packet will loop a
lot
• Setting it too low the packet will not
reach the destination
13 March 2019 Dr. R. Mahammad Shafi 6
Packet Format
• Protocol (8 bits):
– demux key (TCP=6, UDP=17)
• Checksum (16 bits):
– of the header only
• DestAddr & SrcAddr (32 bits)
– The key for datagram delivery
– Every packet contains a full
destination address
– Forwarding/routing decisions are
made at each router
– The source address is for the
destination to know the sender
and if it wants to reply to it
13 March 2019 Dr. R. Mahammad Shafi 7
IP Fragmentation and Reassembly
• Each network has some MTU (Maximum Transmission
Unit)
– Ethernet (1500 bytes), FDDI (4500 bytes)
– IP packets need to fit in the payload of link-layer frame
– Solutions
• Make all packet size small enough to fit all
• Or fragment the large packets into smaller ones and reassembles
them later
• Strategy
– Fragmentation occurs in a router when it receives a datagram
that it wants to forward over a network which has (MTU <
datagram)
– Reassembly is done at the receiving host
– All the fragments carry the same identifier in the Ident field
• Fragments are self-contained datagrams
13 March 2019 Dr. R. Mahammad Shafi 8
IP Fragmentation and Reassembly
Suppose PPP has MTU of 532-byte packet (20 header +
512 payload)
IP datagrams traversing the sequence of physical networks
13 March 2019 Dr. R. Mahammad Shafi 9
IP Fragmentation and Reassembly
Header fields used in IP fragmentation. (a) Unfragmented packet; (b) fragmented packets.
13 March 2019 Dr. R. Mahammad Shafi 10
IP Fragmentation and Reassembly
• MTU path discovery is a good strategy to avoid
fragmentation
– Send some packets first just discover the MTUs on the path to the destination
13 March 2019 Dr. R. Mahammad Shafi 11
Global Addresses
• IP addresses Properties
– globally unique
– hierarchical: network + host
• Network part: identifies the network the host is attached to
• Host: identifies a unique host on that network
• Ethernet addresses, even globally unique, are flat (no structure and thus no
meaning) and can not be use for routing
– Note that a router is attached to at least two networks, so it must
have an IP address on each port/interface
• Thus it is more precise to think of IP addresses as belonging to interfaces
rather than to hosts
13 March 2019 Dr. R. Mahammad Shafi 12
Global Addresses
• Approximately, 4 Billion IP address, half are A type, ¼ is
B type, and 1/8 is C type
(a) Class A (b) Class B (c) Class C
13 March 2019 Dr. R. Mahammad Shafi 13
Global Addresses
• Class A was intended for Wide Area Networks
– Thus there should a very few of them
• Class B was intended for a modest size networks (like a campus)
• Class C is for the large number of LANs
• However, these classifications are not flexible and today’s IP addresses are
normally “classless” as we will see
• Format
– 4 bytes, each byte is represented by a decimal number
– Dot notation
• 10.3.2.4
• 128.96.33.81
• 192.12.69.77
13 March 2019 Dr. R. Mahammad Shafi 14
IP Datagram Forwarding
• Strategy
– every datagram contains destination's address
– if directly connected to destination network, then forward to
host
– if not directly connected to destination network, then forward to
some router
– forwarding table maps network number into next hop
– each host has a default router
– each router maintains a forwarding table
• Example (router R2)
13 March 2019 Dr. R. Mahammad Shafi 15
IP Datagram Forwarding
• Algorithm
if (NetworkNum of destination = NetworkNum of one of my
interfaces) then
deliver packet to destination over that interface
else
if (NetworkNum of destination is in my forwarding table)
then
deliver packet to NextHop router
else
deliver packet to default router
For a host with only one interface and only a default router in its forwarding table,
this simplifies to
if (NetworkNum of destination = my NetworkNum)then
deliver packet to destination directly
else
deliver packet to default router
13 March 2019 Dr. R. Mahammad Shafi 16
Subnetting
• The network number part was designed to uniquely
identify exactly one physical network
– However, this approach has some problems
– A network with only 2 hosts has to have at least a class C
network!!
– A network with only 256 hosts has to have at least a class B
network!!
– Thus, we will waste our valuable IP address space
– Solution
• Subnetting
13 March 2019 Dr. R. Mahammad Shafi 17
Subnetting
• Key Idea
– Allocate a single network number and use it for several physical
networks
• called subnets
– Several things need to be done
• Subnets need to be physically close to each other
– From the Internet point of view, they all look ONE network
– A perfect situation to use subnetting is for large campus or corporation
• Configure all nodes on each subnet with a subnet mask
– It masks the network part
– Introduces the subnet number
– All nodes on the same subnet have the same subnet number and the same mask
• The IP address of a nodes ANDed with the subnet mask
give the subnet number
– IP AND subnet mask subnet number
13 March 2019 Dr. R. Mahammad Shafi 18
Subnetting
Increases the number of
networks and reduces the
number of hosts
13 March 2019 Dr. R. Mahammad Shafi 19
Subnetting
• When a host wants to send a packet to a certain IP
address
– First, it does the bitwise AND between its own subnet mast and destination IP
address
– If the result equals the subnet number of the sender, then the destination host is
on the same subnet so the packet can be delivered directly (without a router)
– Else, the packet will be forwarded to another subnet (through a router)
13 March 2019 Dr. R. Mahammad Shafi 20
Subnetting
Forwarding Algorithm
D = destination IP address
for each entry < SubnetNum, SubnetMask, NextHop>
D1 = SubnetMask & D
if D1 = SubnetNum
if NextHop is an interface
deliver datagram directly to destination
else
deliver datagram to NextHop (a router)
13 March 2019 Dr. R. Mahammad Shafi 21
Classless Addressing
• Subnetting has a counterpart, sometimes called
supernetting, but often called Classless Interdomain
Routing, CIDR (pronounced cider)
13 March 2019 Dr. R. Mahammad Shafi 22
Classless Addressing
• Address assignment efficiency
– A network with 256 hosts needs a class B address
– Address assignment efficiency = 256/65535 = 0.39
• Solutions
– Use subnetting
– Only give class C networks
• Give class B only with a proof of that the network has more than 64K hosts
13 March 2019 Dr. R. Mahammad Shafi 23
Classless Addressing
• Problem with this solution
– Excessive storage requirement at the routers.
• If a single site has, say 16 class C network numbers
assigned to it,
– Every Internet backbone router needs 16 entries in its routing
tables for that site (too much for one site)
– This is true, even if the path to every one of these networks is the
same
• If we had assigned a class B address to the AS
– The same routing information can be stored in one entry
• Efficiency = number of hosts / number of available addresses =16 ×
255 / 65, 536 = 6.2% (not efficient)
13 March 2019 Dr. R. Mahammad Shafi 24
Classless Addressing
• CIDR tries to balance the desire to minimize the
number of routes that a router needs to know
against the need to hand out addresses
efficiently.
• CIDR uses aggregate routes
– Uses a single entry in the forwarding table to tell the
router how to reach a lot of different networks
– Breaks the rigid boundaries between address classes
13 March 2019 Dr. R. Mahammad Shafi 25
Classless Addressing
• Consider a site with 16 class C network numbers.
• Instead of handing out 16 addresses at random, hand
out a block of contiguous class C addresses
• Suppose we assign the class C network numbers from
192.4.16 through 192.4.31
• Observe that top 20 bits of all the addresses in this
range are the same (11000000 00000100 0001)
– We have created a 20-bit network number (which is in between
class B network number and class C number)
13 March 2019 Dr. R. Mahammad Shafi 26
Classless Addressing
• Requires to hand out blocks of class C addresses that
share a common prefix
• The convention is to place a /X after the prefix where X
is the prefix length in bits
• For example, the 20-bit prefix for all the networks
192.4.16 through 192.4.31 is represented as 192.4.16/20
• By contrast, if we wanted to represent a single class C
network number, which is 24 bits long, we would write it
192.4.16/24
13 March 2019 Dr. R. Mahammad Shafi 27
Classless Addressing
Route aggregation with CIDR
13 March 2019 Dr. R. Mahammad Shafi 28
Different Protocols
• ARP (Address Resolution Protocol)
• DHCP (Dynamic Host Configuration Protocol)
• ICMP (Internet Control Message Protocol)
13 March 2019 Dr. R. Mahammad Shafi 29
Address Translation Protocol (ARP)
• Map IP addresses into physical addresses
• ARP (Address Resolution Protocol)
– table of IP to physical address bindings
– The router broadcasts a request (who-has / tell) if the
required IP address not in the ARP table
• Ex., who-has 192.168.0.29 tell 192.168.0.1
– target machine (with IP 192.168.0.29 in the example)
responds with its physical address (its MAC)
13 March 2019 Dr. R. Mahammad Shafi 30
Host IP Configurations
• Most host Operating Systems provide a way to manually
configure the IP information for the host
• Drawbacks of manual configuration
– A lot of work to configure all the hosts in a large network
– Configuration process is error-prune
• Automated Configuration Process is required
– Using the DHCP protocol
13 March 2019 Dr. R. Mahammad Shafi 31
Dynamic Host Configuration Protocol
(DHCP)
• DHCP server is responsible for providing
configuration information to hosts
• There is at least one DHCP server for an
administrative domain
• DHCP server maintains a pool/set of available
addresses
13 March 2019 Dr. R. Mahammad Shafi 32
DHCP
• Newly booted or attached
host sends
DHCPDISCOVER
message to a special IP
address
(255.255.255.255)
• DHCP relay agent
unicasts the message to
DHCP server and waits
for the response
13 March 2019 Dr. R. Mahammad Shafi 33
Internet Control Message Protocol
(ICMP)
• Defines a collection of error messages that are
sent back to the source host whenever a router
or host is unable to process an IP datagram
successfully
– Destination host unreachable due to link /node failure
– Reassembly process failed
– TTL had reached 0 (so datagrams don't cycle forever)
– IP header checksum failed
• ICMP-Redirect
– From router to a source host
– With a better route information
13 March 2019 Dr. R. Mahammad Shafi 34
13 March 2019 Dr. R. Mahammad Shafi 35