Professional Documents
Culture Documents
Lecture 3 - Internet Layer
Lecture 3 - Internet Layer
Internet Layer
HEDSPI Project
Hanoi University of Technology
by
Ngo Hong Son
This course materials contains charts and texts provided by Keio University, Japan
1
Content
Introduction of Internet Protocol
IP address
IP packet format
Internet Control Message Protocol - ICMP
2
Introduction to
Internet Layer
Basic concepts
Store-and-forward mechanism
Internet Protocol
3
Internet Protocol
IP is a network layer protocol
Two key functions of network layer:
Routing: Determine route from source to destination
Forwarding: Move packet from input to output
application
application
TCP/UDP
TCP/UDP
IP
1. Send data 2. Receive data IP
data link
data link
physical
physical
4
Packet forwarding and Routing
of Internet Protocol
IP packet Ver IHL TOS Packet length
Identification Flag Fragment Offset
Source IP address
payload IP header Destination IP address
Host
Router
•Where is destination
point? Router
•Data must to be forwarded
to whom next?
Router
5
Host
Characteristics of Internet
Protocol
Unreliable/ Light overhead
Best effort delivery
IP doesn’t have error recovery or tracking
Use other layer to provide reliable data transfer (TCP)
Connectionless datagram protocol
Each datagram handled independently
6
IP address
Classfull IP addressing
Classless Inter Domain Routing
Reserved addresses
7
IP Address (IPv4)
IP address: 32-bit
223.1.1.1
identifier for host,
router interface 223.1.1.2
223.1.2.1
223.1.1.4 223.1.2.9
IP addresses
associated with each 223.1.1.3 223.1.3.27
223.1.2.2
interface
IP address is unique
223.1.3.1 223.1.3.2
223 1 1 18
Dotted-Decimal Notation
Example:
203.178.136.63 o
259.12.49.192 x
133.27.4.27 o
8 bits
0 – 255 integer
3417476964
1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0
1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0
Class A 0 7bit H H H
Class B 1 0 6bit N H H
Class C 1 1 0 5bit N N H
Class D 1 1 1 0 Multicast
Class E 1 1 1 1 Reserve for future use
# of network # of hosts
Class A 128 2^24
Class B 16384 65536
Class C 2^21 256 11
Disadvantage of classful IP
addressing
Wasteful
Classful addressing scheme (A, B, C, D, E) can
be an obstacle to fully utilized IP address space
13
How to describe netmask
255.255.255.224 Check only these No.
/27 0 248
0xFFFFFFe0 128 252
192 254
224 255
240
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0
(bit)
27
AND
203 . 178 . 142 . 128
11001011 10110010 10001111 10000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0
133 27 4 160
10000101000110110000010010100000
11111111111111111111111111000000
10000101000110110000010010000000
133 27 4 128
17
The way to think (2)
133 27 4 160
10000101000110110000010010100000
11111111111111111111111111100000
10000101000110110000010010100000
133 27 4 160
18
Network and IP address
Three type of address also exist
Network address
IP address which describe network itself
Broadcast address
IP address which can be used to send a data to all nodes
Host address
Normal host ID which is assign to interface
19
IP address and netmask
Host, network or broadcast address?
20
Subnet
Subnet is sub-
223.1.1.1
network of assigned
223.1.2.1
network 223.1.1.2
ISP usually assigned 223.1.1.4 223.1.2.9
one address block
223.1.2.2
223.1.1.3 223.1.3.27
Several subnets can
be create from one subnet
block
223.1.3.1 223.1.3.2
How to create small
subnet
Use longer netmask network consisting of 3 subnets
21
Example: 1 to 2 subnets
22
Example: 1 to 4 subnets
Network /24 is assigned
Need to create 4 networks
Network with 14 computer /28
Network with 30 computer /27
Network with 31 computer /26
Network with 70 computer /25
/24 23
IPv4 address space
IP address in theory
It is possible to use 0.0.0.0 ~ 255.255.255.255
There are some addresses that are reserved
IP addresses reserved for special utilization (RFC1918)
10.0.0.0/8
Private address 172.16.0.0/12 ~ 172.31.0.0/12
192.168.0.0/16
Loopback address 127.0.0.0
224.0.0.0
Multicast address
~ 239.255.255.255
Local link address: 169.254.0.0/16
24
Note on IP address
Internet currently uses IPv4: 32 bits
133.113.215.10 (IPv4)
IPv6: 128bits
2001:200:0:8803::53 (IPv6)
Topic of IPv6 will be covered later.
25
IP datagram format
26
IP header
total datagram
length (words)
IP protocol version 32 bits
number
ver head. DS length
header length len for
(bytes) fragment
16-bit identifier flgs fragmentation/
offset reassembly
QoS support time to upper header
live layer checksum
max number 32 bit source IP address
remaining hops
32 bit destination IP address
(decremented at
each router) Options (if any) E.g. timestamp,
record route
data taken, specify
upper layer protocol (variable length, list of routers
to deliver payload to typically a TCP to visit.
or UDP segment)
27
IP header (1)
Version (4 bits)
IPv4
IPv6
Header Length : 4bits
Total length of header in 4 bytes words
If there is no option, this value will be 5
So Maximum header length will be 60
28
IP header (2)
DS (Differentiated Service : 8bits)
Previously this field is called service type
Precedence (3bits) and TOS field (4bits)
Currently this field is used to provide QoS
Diffserv
29
IP header (3)
Total length (16 bits)
Total length is described in bytes
Maximum total length will be 65536
Header length inclusive
Identification
Find a series of IP datagram which is fragmented
Flag
Fragmentation offset
30
IP header (4)
Time to live (8 bits) -TTL
The span of the IP packet life
The router subtract 1 from this field
Maximum Internet diameter is 255
Packet is thrown away when this field reaches 0
Protocol
Data type of payload
Not only the IP , ICMP, IGMP and OSPF use this value
31
IP header (4)
Checksum
Source IP address
32-bit IP address of sender
Destination IP address
32-bit IP address of receiver
32
Fragmentation (1)
Network links have
MTU (max. transfer fragmentation:
unit) in: one large datagram
out: 3 smaller datagrams
Different link types,
different MTUs
Large IP datagram is reassembly
divided
One datagram becomes
several datagrams
“reassembled” only at
final destination
33
Fragmentation (2)
Identification field
ID is used to find the fragmented IP packet
Flags (3 bits)
Reserved
Don’t fragment
IP packet will not be fragmented
ICMP error will be sent to source host
More fragment
Destination IP processor can recognize
34
Fragmentation (3)
Fragmentation offset
The offset information of fragmented packet is stored
In units of 8 bytes
0 1399
Offset = 0/8 = 0
2800 3999
Offset = 2800/8 = 350
35
Checksum
Header Checksum
At sender side
Checksum must be set 0
Add up all 16 bits
Then the sum is complemented
At receiver side
Add up all 16 bits
The sum must be all 1
If it is not all 1, the IP header corrupted
36
Options
New function can be added by using option field
Up to 40 Bytes
Code (8) Length (8) Data (Variable length)
Copy:
0: copy only in first fragment Number:
1: copy into all fragment 00000: End of option
00001: No operation
Class: 00011: Loose source route
00: Datagram control 00100: Timestamp
01: Reserved 00111: Record route
10: Debugging and measurement 01001: Strict source route 37
11: Reserved
Internet Control Message Protocol
Overview
Packet format
Ping and Traceroute
38
ICMP Overview (1)
39
ICMP Overview (2)
ICMP message
Data
42
ICMP message types
3 Destination Unreachable
4 Source quench
Error-reporting
ICMP Message Type
5 Redirection
messages
11 Time exceeded
12 Parameter problem
43
ICMP and debugging tools
ICMP works usually but quietly
Users can use ICMP as debugging tools
ping
traceroute
44
Ping and ICMP
ping
Ping can be used to check connectivity
Sender send ICMP echo request
Receiver reply ICMP echo reply
Ping sets the sequence number to Identifier
field
Ping sets the sending time in the data field
RTT (round-trip time) can be calculated
45
Ping: An example
46
Traceroute and ICMP
Source sends packet to dest
First has TTL =1
47
Traceroute and ICMP
Stopping criterion
Packet eventually arrives at destination host
3 probes 3 probes
3 probes
48
Traceroute: An example
C:\Documents and Settings\hongson>tracert www.jaist.ac.jp
Trace complete.
49
Summary
Internet protocol
IP address and IP packet format
ICMP
Ping
Traceroute
50
Next week
Routing problem
Objective & mechanism
Router & routing table
Static and dynamic routing
51