Chapter 4
IP Protocol
1
Introduction
IP Protocol
IP services
IP packet description
Fragmentation & Re-assemble
Addressing
ARP / RARP / BOOTP
ICMP
2
Internet Protocol (IP)
Key factor of the Internet
Routing of datagramme
No detection of errors on packets
No indication on lost packets (or erroneous)
Is not affected with the subnet characteristics
3
IP protocol
Addressing
Routing
Packets Fragmentation & reassembling
Time To Live
Congestion
Datagram
32bit addressing (IP-v4)
Error control (header only)
Security
Fault Management 4
Advantages
Datagram services
– Simple packet management
– No bottom neck
– Connection less service
Addressing (Network, Machine)
Simple
Routing is independent of the selected
route 5
Disadvantages
Limited addressing
Limited Quality of Service
Low security
6
IPv4 packet description
0 4 8 12 16 20 24 28 - 31
Header
Version length Type of Service Packet length
Identification Flags Fragment displacement
Time To Live Protocol ID Checksum
Source Address
Destination Address
Options Padding
Data
7
IPv4 packet description
0 Standard
4 8 IP packet
12 16 size
20 is 20
24 bytes
28 - 31
Header
Version length Type of Service Packet length
Identification Flags Fragment displacement
Time To Live Protocol ID Checksum
Source Address
Destination Address
Options Padding
Data
8
IP packet fields
Version (Value = 4 for IPv4).
Header length (IHL Internet Header Length).
Type of Service (ToS) – not used.
Total packet length.
Packet Identification.
Flags
– First bit D (Don’t Fragment);
– Second bit M (More Fragment);
– Third bit O (Qualification of packet).
Fragment displacement= TCP Fragment position if it exist
Time To Live (TTL).
Protocol (6: TCP, 17: UDP, 1: ICMP)
Error control (Header Checksum).
Source Address & Destination Address.
Options. 9
Padding.
Fragmentation & Reassembling
Problem
– Different technologies have different packet sizes
MTU (Maximum Transfer Unit)
– The source doesn’t know the path (route) to be taken by the
packet (in order to know the MTU).
The source router fragments the packet if its size is bigger then
the interface MTU.
Each fragment is a complete datagram (packet).
The destination must reassemble the fragments to obtain the
original packet.
– The fragments can be delivered in random order (the receiver
reorder the fragments).
– If a packet misses a fragment, the packet will be deleted.
No fragment retransmission is carried at IP level. 10
IP address allocation
IP address are unique all over the Internet.
INTERNET is managed by the Network
Information Center (NIC).
Each interface is allocated a unique IP address.
A router, bridge, gateway have more than one
IP address.
11
IPv4 Addressing
IP addressing is the method used to identify hosts and network
devices.
In order to send and receive messages on an IP network, every
network host must be assigned a unique 32 bit IP address.
2^32 = About 4 billion possible IPs.
• Large binary numbers are difficult
for humans to read and understand.
• IP addresses are usually displayed in
dotted-decimal notation.
• Each of the 4 octets is converted to
a decimal number separated by a
decimal point. 12
IPv4 Addressing
The 32-bit address space was organized into five classes.
– Three of these classes, A, B, and C, provide addresses that can
be assigned to individual hosts or networks.
– Class D is reserved for multicast.
– Class E is reserved for experimental use.
13
IPv4 Address classes
For network administration purposes, IP addresses are divided in
classes or group of address. Each class is associated with a Subnet
Mask. The class structures ease the management of the IP
distribution.
Class A 0 N H H H
Class B 1 0 N N H H
Class C 1 1 0 N N N H
Class D 1 1 1 0 Multicast
Class E 1 1 1 1 0 Reserved
14
8 bits 8 bits 8 bits 8 bits
IPv4 Address classes
15
IPv4 Address classes
16
IPv4 Address classes
17
IP Addresses classes
Network Machine Number Number of
Class Bits Value part part of Network addresses Default Mask
A 0 1-126 N H.H.H 126 16777214 255.0.0.0
B 10 128-191 N.N H.H 16382 65534 255.255.0.0
C 110 192-223 N.N.N H 2097150 254 255.255.255.0
D 1 1 1 0 224-239 Multicast Address
E 1 1 1 1 240-254 Experimental
18
IP Addresses classes
19
Address Mask
Defines the subnet address.
It is hold by the Internet Gateway.
All machines of the logical subnet should have the same
address mask.
It is formed by 4 bytes (similar to the IPv4 address): For
the Class C address, the first 3 represents the network
address while the last byte represent the machine address
(Class C).
20.
IP Subnet Mask
Class Range Default
From To subnet mask
A 0.0.0.0 126 . 255 . 255 . 255 255 . 0 . 0 . 0
B 128 . 0 . 0 . 0 191 . 255 . 255 . 255 255 . 255 . 0 . 0
C 192 . 0 . 0 . 0 223 . 255 . 255 . 255 255 . 255 . 255 . 0
D 224 . 0 . 0 . 0 239 . 255 . 255 . 255
E 240 . 0 . 0 . 0 254 . 255 . 255 . 255
The subnet mask allow to distinguish between the network address and the machine
address. If the subnet is 255.0.0.0, the first eight bits represents the network address
segment, and the last 3 bytes represents the machines addresses.
A network cannot have 16’000’000 machine address, or even 64’000 without using
routers (collision, congestion…). Consequently, the A & B Classes also C class uses
rarely the default address mask.
21
Private IPs
RFC 1918 is a standard that reserves several ranges of
addresses within each of the classes A, B and C.
Private addresses can be used internally by hosts in an
organization as long as the hosts do not connect directly to
the Internet.
Therefore, the same set of private addresses can be used by
multiple organizations.
22
Private IPs
Private addresses are not routed on the Internet and will be
quickly blocked by an ISP router.
The use of private addresses can provide a measure of
security since they are only visible on the local network, and
outsiders cannot gain direct access to the private IP
addresses.
23
Private IPs
From Class A:
– 10.0.0.0 - 10.255.255.255
From Class B:
– 172.16.0.0 - 172.31.255.255
From Class C:
– 192.168.0.0 - 192.168.255.255
There are also private addresses that can be used for the
diagnostic testing of devices. This type of private address is
known as a loopback address. The class A, 127.0.0.0 network,
is reserved for loopback addresses.
24
Classless InterDomain Routing (CIDR)
No more network classes with CIDR
CIDR uses variable length subnet masks (VLSM) for
subnetting
Network ID no longer has to be on an octet (byte) boundary
CIDR
– subnet portion of address of arbitrary length
– address format: a.b.c.d/x, where x is # bits in subnet
portion of address.
Host part
Subnet part
11001000 00010111 00010000 00000000
200.23.16.0/23 OR 200.23.16.0 255.255.254.0 25
Subnet Mask
Since the parts that are used as the NetID and HostID, are
not fixed and vary from one IP to another, an additional
information is needed in order to determine the NetID as
well as the HostID.
This information is supplied in another 32-bit number called a
subnet mask.
Example:
If we take the IP 192.168.50.110 with the subnet mask
255.255.255.0, we will be able to identify that the
NetID is 192.168.50.0 and
the HostID is 0.0.0.110
26
Example: IP address
0.0.0.0 Unknown address (Source)
255 . 255 . 255 . 255 All machines (destination)
193 . 75 . 199 . 3 Machine number 3
Network 193 . 75 . 199
193 . 75 . 199 . 0 Unknown machine
Network 193 . 75 . 199
193 . 75 . 199 . 255 All machine of the network 193 . 75 . 199
0.0.0.4 Machine number 4 of this network (source)
127 . 0 . 0 . 1 This machine
127 . 0 . 0 . x Local loop
27
IP Protocol
IP 0 IP # Internet Protocol, pseudo protocol number
ICMP 1 ICMP # Internet Control Message Protocol
IGMP 2 IGMP # Internet Group Multicast Protocol
GGP 3 GGP # Gateway-Gateway Protocol
TCP 6 TCP # Transmission Control Protocol
PUP 12 PUP # PARC Universal Packet protocol
UDP 17 UDP # User Datagram Protocol
IDP 22 IDP # What's This?
RAW 255 RAW # RAW IP interface
28
Classes Advantages and
Disadvantages
Advantages
– Equal analysis time
– Adaptation to the organization needs
– Help routing
Disadvantages
– Each organization might not uses its allocated
space no optimization of the IP address
– Subnet Doesn’t split the network
29
Packet delivery
– Each packet hold the destination address
– Each machine has a local routing table
1. Is the machine on the same subnet?
Yes: deliver , no: go to step 2
2. The packet is sent to the default gateway (router)
3. Go to step 1
– The routing table of the routers are dynamically updated by
exchanging information between the network routers.
Routing algorithms are used to optimize the number of hops and use
better the network resources.
– DV : Distance Vector
– LS : Link State
– SPF : Shortest Path First
30
Internet routing
The Internet is an hierarchy of routers (multi level of routers):
Autonomous System (AS)
– Corresponds to an administrative domain
Interior Gateway Protocol
– Routing protocol used inside the AS.
Example: RIP: Route Information Protocol (algorithm DV);
OSPF: Open Shortest Path First (algorithm LS).
Exterior Gateway Protocol
– Routing protocol used between two ASs.
– Standard BGB: Border Gateway Protocol (algorithm DV).
31
Routing Information Protocol (RIP)
RIP: Routing Information Protocol
– Uses Distance Vector routing
– Unit: Number of Hops
– Infinite is limited to 16 hop
– Still being used in small networks
– Easy configuration
32
Physical address versus IP address
Translate physical address with IP address.
This task is executed by ARP (Address Resolution
Protocol).
If the IP address of the destination machine is within the
same subnet, ARP is used to find the Machine physical
address, otherwise the physical address of the gateway is
used.
33
Address Resolution Protocol (ARP)
IP address and physical address matching
– Destination machine
– Next router on the path
ARP
– Stores the IP and physical address matching.
– If the IP is not found in its table, it broadcast the ARP
message to retrieve the physical address.
– The correspondent machine replies with its physical
address.
– The table rows are deleted if not refreshed (every 20
minutes).
34
Reverse Address Resolution Protocol (RARP)
Used for machines with low memory.
The server holds a table with all the addresses of the
machines connected to it.
When a new machine is connected, it sends an RARP
message to the server with its own physical address.
The server reply with an RARP message providing it with
its own IP address.
35
BOOTP
RARP variant
– RARP uses a fixed table for physical address and IP address.
BOOTP uses dynamic tables.
– BOOTP assign a free IP address for the requesting station (it
selects the address out of a list of addresses allocated to it).
– BOOTP checks all reserved IPs to see if they are still in use or if
they become free (machine is out of service).
– BOOTP is mostly used when the number of machine is high
with a limited number of IP addresses.
– Class C networks (256 Address) use BOOTP for the IPs
management.
36
Internet Control Message Protocol (ICMP)
Used by hosts & routers to communicate network-level
information:
– error reporting: unreachable host, network, port, protocol
– echo request/reply (used by ping)
Network-layer “above” IP:
– ICMP msgs carried in IP datagram's.
ICMP message: type, code plus first 8 bytes of IP
datagram causing error.
37
Internet Control Message Protocol (ICMP)
ICMP protocol exchange error, control and management
messages between routers.
ICMP messages are encapsulated in IP packets.
ICMP has the following tasks:
– Error summary (Undelivered packets)
– Fragmentation or reassembling problems
– TTL reached 0
– Accessibility test
– Congestion control
– Route modification notification
– performance
– Subnet addressing
38
Internet Control Message Protocol (ICMP)
Flow control
Detect inaccessible destination
Routing redirection
Destination Source Type (0800) Data CRC
IP header IP Data
ICMP
Type Code ...
39
Internet Control Message Protocol (ICMP)
Type Message type Description
0 Echo Reply PING command (system alive)
3 Destination unreachable The destination is unreachable
4 Source quench Bottom neck packet
5 Redirect Routing change indicator
8 Echo request Reply to the ping message
9 Router adv. Routing table updated
10 Router solicit. Request routing table from router
11 Time exceeded TTL has reached 0
12 Parameter problem Header format error
13 Timestamp request Request router time
14 Timestamp reply Answer to timestamp request
17 Address mask request Request of the router subnet
18 Address mask reply Answer of the address mask request 40
TCP/IP Model
Application Message
TCP UDP Segment
ICMP
IP Datagram
ARP RARP
Data link Frame
Physical Bit 41
TCP/IP over Ethernet
Destination Source Type (0800) Ethernet Data CRC
IP header IP Data
TCP header TCP Data
FTP header FTP Data
42
TCP/IP Architecture
OSI Model TCP/IP
Layers Protocol TCP/IP
Architecture Protocol Suite
Application Layer Layers
Presentation Layer Application Telnet DNS
FTP SMTP RIP SNMP
Layer
Session Layer Host To Host
Transport TCP UDP
Transport Layer Layer
Internet IGMP ICMP
Network Layer IP
Layer ARP
Data Link Layer Network Token Frame
Ethernet ATM
Interface Ring Relay
Physical Layer Layer
43
IPv6 motivation
Initial motivation: 32-bit address space soon to be
completely allocated.
IPv6 datagram format:
– fixed-length 40 bytes header
ver pri flow label
payload len next hdr hop limit
source address
(128 bits)
destination address
(128 bits)
data
44
IPv6 addresses
IPv6 Works with 128-bit numbers.
IPv6 address notation represents the 128 bits as 32
hexadecimal digits.
Subdivided into eight groups of four hexadecimal digits,
using colons as delimiters.
An example would be:
3ffe:1900:4545:3:200:f8ff:fe21:67cf
fe80::200:f8ff:fe21:67cf (:0: ::)
45
IPv6-IPv4 translating
To convert an IPv4 to an IPv6, we add 96 leading 0’s to the
32 bit IP address
Example: Convert 192.168.25.234 to IPv6 address:
192 ÷ 16 = 12 remainder 0 192 = C0
168 ÷ 16 = 10 remainder 8 168 = A8 A = 10
B = 11
25 ÷ 16 = 1 remainder 9 25 = 19 C = 12
234 ÷ 16 = 14 remainder 10 234= EA D = 13
E = 14
F = 15
192.168.25.234 0:0:0:0:0:0:C0A8:19EA
192.168.1.2 :0:0:0:0:0:0:C0A8:0102
72.212.2.1 :::::::48D4:0201
46