Sei sulla pagina 1di 105

Private Network Address Ranges in each Class

NNNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH – Class A, 8 network bits


NNNNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH – Class B, 16 network bits
NNNNNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH – Class C, 24 network bits
A supernetwork, or supernet, is an Internet Protocol (IP) network that is
formed, for routing purposes, from the combination of two or more networks
(or subnets) into a larger network. The new routing prefix for the combined
network represents the constituent networks in a single routing table entry.
Example: Suppose we want to connect 1000 computer in Class C network.
As we know that we can connect 254 computers in Class C network. For
connecting 1000 computers we will have to convert network bits into host bits.
IP address = 192.68.1.1
Default Subnet mask = 255.255.255.0

Natural Subnet mask 11111111.11111111.11111111.00000000


11111111.11111111.11111100.00000000 (conversion of network bits into host bits)
The Internet Protocol version 4 (IPv4) is the delivery
IPV4 mechanism used by the TCP/IP protocols.

20.56
Position of IPv4 in TCP/IP protocol
suite

20.57
IPv4 datagram format

20.58
IPv4 Header
• Variable length: 20-60 byte (multiple of 4)
• Contains routing information

20.59
IPv4 Datagram

IPv4 datagram format


20-65,535 bytes

60
IPv4 Format
• Version (4-bit): currently 4.
• Header length (4-bit): the length of the IP header in 4-byte unit.
• Type of Services(TOS):
– This field was not used earlier because of the lack of standard
– DiffServ uses this field for differentiate packet types.

• Total length
– to defines the total length of the datagram including the header in
bytes.
– 16-bit number, the maximum IP size is limited to 216 bytes, or 64
Kbytes.

20.61
IPv4 Format
• Identification
– A source node gives a unique ID to each packet.
– Identification, Flags, Fragmentation offset fields are used for fragmentation (will be covered
later)
• Time to Live (TTL)
– A packet has a limited lifetime in the network to avoid zombie packets.
– Designed to hold a timestamp, and decreased by each router. A packet is discarded by a
router if TTL is zero.
– Revised to hold the maximum number of hops the packet can travel thru the network. Each
router decrements it by one.
• Protocol
– To define payload protocol type
– 1 for ICMP
– 2 for IGMP
– 6 for TCP
– 17 for UDP
– 89 for OSPF

20.62
IPv4 Format
• Header checksum
– Refer RFC 1071
– An IP header is slightly modified by each router. At least TTL field.
– The checksum must be re-calculated by routers which is a kind of
general compuers with more than one network interface.
– The checksum must be efficiently calculated with no need of special
hardware.
• Source IP address and Destination IP address
• Options
– Variable length
– For new protocols
• Padding
– To make the header a multiple of 32-bit words

20.63
VER (4 bits) : defines the Total Length (16 bits) : defines
version of IP, current the total datagram length
version is (IPv4) IPv4 Datagram up to 65,535 bytes

IPv4 datagram format


HLEN (4 bits) : defines the header length, multiple of 4 bytes
max length = (1111)2 X 4 = 60 bytes
min length = (0101)2 X 4 = 20 bytes

Differentiate Service types defines the class of datagram for quality-of-service purpose. E.g. min.
delay, max. throughput, max. reliability, min. cost. (Not look into detail).
Identification (16 bits) Protocol (8 bits) : defines Fragmentation offset (13 bits) :
: sequence number the higher layer protocol pointer to show the offset of
(TCP or UDP) TCP = 6,
used in fragmentation ICMP = 1, UDP = 17… the data in the original
More fragments datagram

Do not fragment !

Time to Live (8 bits) : # of the hops a


datagram can be travel before it is Header checksum(16 bits):
discarded. Must be decremented Ensures some degree of header integrity
at each router Packets with TTL=0 are thrown Relatively weak – only 16 bits
away
Types of service

20.66
Default types of service

20.67
Values for codepoints

20.68
Example .1
An IP packet has arrived with the first 8 bits as shown:

The receiver discards the packet. Why?

Solution
There is an error in this packet. The 4 left-most bits
(0100) show the version, which is correct. The next 4
bits (0010) show the wrong header length (2 × 4 = 8).
The minimum number of bytes in the header must be 20.
The packet has been corrupted in transmission.
Example .2
In an IP packet, the value of HLEN is 1000 in binary. How many
bytes of options are being carried by this packet?

Solution
The HLEN value is 8, which means the total number of bytes
in the header is 8 × 4 or 32 bytes. The first 20 bytes are the
base header, the next 12 bytes are the options.
Example .3
In an IP packet, the value of HLEN is 516 and the value of the
total length field is 002816. How many bytes of data are being
carried by this packet?

Solution
The HLEN value is 5, which means the total number of bytes in
the header is 5 × 4 or 20 bytes (no options). The total length is 40
bytes, which means the packet is carrying 20 bytes of data (40 −
20).
Example .4
An IP packet has arrived with the first few hexadecimal digits as
shown below:

How many hops can this packet travel before being dropped?
The data belong to what upper layer protocol?

Solution
To find the time-to-live field, we skip 8 bytes (16 hexadecimal
digits). The time-to-live field is the ninth byte, which is 01. This
means the packet can travel only one hop. The protocol field is
the next byte (02), which means that the upper layer protocol is
IGMP (see Table 7.2)
Example .5
A packet has arrived with an M bit value of 0. Is this the first
fragment, the last fragment, or a middle fragment? Do we know
if the packet was fragmented?

Solution
If the M bit is 0, it means that there are no more fragments; the
fragment is the last one. However, we cannot say if the original
packet was fragmented or not. A non fragmented packet is
considered the last fragment.
Fragmentation Related Fields
• Length
– Length of IP fragment

• Identification
– To match up with other fragments

• Fragment offset
– Where this fragment lies in entire IP datagram

• Flags
– “More fragments” flag
– “Don’t fragment” flag

74
IP datagram

Header MTU Trailer


Maximum length of data that can be encapsulated in a frame
Frame

Only data in a datagram is fragmented.


MTU

• Maximum Transmission Unit (MTU)


– Largest IP packet a network will accept
– Arriving IP packet may be larger
MTU

IP Packet
IP Fragmentation
• If IP packet is longer than the MTU, the router
breaks packet into smaller packets
– Called IP fragments
– Fragments are still IP packets
– Earlier in Mod A, fragmentation in TCP

MTU

IP Packet 3 2 1

IP Packets
Fragmentation
IP Fragmentation
• What is Fragmented?
– Only the original data field
– New headers are created

MTU

IP Packet 3 2 1

IP Packets
Fragmentation
IP Fragmentation
• What Does the Fragmentation?
– The router
– Not the subnet

MTU

IP Packet 3 2 1

IP Packets
Fragmentation
Multiple Fragmentations

• Original packet may be fragmented


multiple times along its route

Source Destination
Host Host
Internet Internet
Process Process

Fragmentation
Defragmentation

• Internet layer process on destination host


defragments, restoring the original packet
• IP Defragmentation only occurs once
Source Destination
Host Host
Internet Internet
Process Process

Defragmentation
Fragmentation and IP Fields
• More Fragments field (1 bit)
– 1 if more fragments
– 0 if not
– Source host internet process sets to 0
– If router fragments, sets More Fragments
field in last fragment to 0
– In all other fragments, sets to 1

0 0 1 1

Original IP Packet Fragments


Identification Field
• IP packet has a 16-bit Identification field

Version Hdr Len


(4) (4)
TOS (8) Total Length in bytes (16)
Indication (16 bits) Flags (3) Fragment Offset (13)

Time to Live (8) Protocol (8) Header Checksum (16)

Source IP Address
Destination IP Address

Options (if any) PAD

Data Field
Identification Field
• IP packet has a 16-bit Identification field
– Source host internet process places a random
number in the Identification field
– Different for each IP packet

Version Hdr Len


(4) (4)
TOS (8) Total Length in bytes (16)
Indication (16 bits) Flags (3) Fragment Offset (13)

Time to Live (8) Protocol (8) Header Checksum (16)


Identification Field
• IP packet has a 16-bit Identification field
– If router fragments, places the original
Identification field value in the Identification field
of each fragment

47 47 47 47

Original IP Packet Fragments


Identification Field
• Purpose
– Allows receiving host’s internet layer process
know what fragments belong to each original
packet
– Works even if an IP packet is fragmented
several times

47 47 47 47

Original IP Packet Fragments


Fragment Offset Field

• Fragment offset field (13 bits) is used to reorder


fragments with the same Identification field
• Contains the data field’s starting point (in octets)
from the start of the data field in the original IP
packet

Version Hdr Len


(4) (4)
TOS (8) Total Length in bytes (16)
Indication (16 bits) Flags (3) Fragment Offset (13)
Fragment Offset Field
• Receiving host’s internet layer process
assembles fragments in order of increasing
fragment offset field value
• This works even if fragments arrive out of
order!
• Works even if fragmentation occurs multiple
times
Fragment Offset Field

730 212 0
Fragmentation: Recap

• IP Fragmentation
– Data field of a large IP packet is fragmented
– The fragments are sent into a series of
smaller IP packets fitting a network’s MTU
– Fragmentation is done by routers
– Fragmentation may be done multiple times
along the route
IP Fragmentation
• What if the size of an IP datagram exceeds the MTU?
IP datagram is fragmented into smaller units.

• What if the route contains networks with different MTUs?

Ethernet
FDDI
Ring
Host A Router Host B
MTUs: FDDI: 4352 Ethernet: 1500

• Fragmentation:
• IP router splits the datagram into several datagram
• Fragments are reassembled at receiver

90
Where is Fragmentation done?

• Fragmentation can be done at the sender or at


intermediate routers
• The same datagram can be fragmented several times.
• Reassembly of original datagram is only done at
destination hosts !!

IP datagram H Fragment 2 H2 Fragment 1 H1

Router

91
What’s involved in Fragmentation?
• The following fields in the IP header
are involved:
header
version
length
DS ECN total length (in bytes)
DM
Identification 0 Fragment offset
F F
time-to-live (TTL) protocol header checksum

Identification When a datagram is fragmented, the


identification is the same in all fragments
Flags
DF bit is set: Datagram cannot be fragmented and must
be discarded if MTU is too small
MF bit set: This datagram is part of a fragment and an
additional fragment follows this one

92
What’s involved in Fragmentation?
• The following fields in the IP header
are involved:
header
version
length
DS ECN total length (in bytes)
DM
Identification 0 Fragment offset
F F
time-to-live (TTL) protocol header checksum

Fragment offset Offset of the payload of the current


fragment in the original datagram
Total length Total length of the current fragment

93
IP Fragmentation Example #1

router
host
MTU = 4000

Length = 3820, M=0

IP IP
Header Data

94
IP Fragmentation Example #2
MTU = 2000

router
router
Length = 2000, M=1, Offset = 0
Length = 3820, M=0
IP IP
IP IP Header Data
Header Data

1980 bytes
3800 bytes
Length = 1840, M=0, Offset = 1980

IP IP
Header Data

1820 bytes

95
IP Fragmentation Example #3
Length = 1500, M=1, Offset = 0

host IP IP
router
MTU = 1500 Header Data

Length = 2000, M=1, Offset = 0


1480 bytes
IP IP Length = 520, M=1, Offset = 1480
Header Data
IP IP
Header Data

1980 bytes
Length = 1500, M=1, Offset = 1980
500 bytes
Length = 1840, M=0, Offset = 1980 IP IP
Header Data
Length = 360, M=0, Offset = 3460
IP IP
Header Data IP IP
1480 bytes Header Data

1820 bytes
96
340 bytes
Example of Fragmentation
• A datagram with size 2400 bytes must be fragmented according to an MTU
limit of 1000 bytes

Header length: 20 Header length: 20 Header length: 20 Header length: 20


Total length: 2400 Total length: 448 Total length: 996 Total length: 996
Identification: 0xa428 Identification: 0xa428 Identification: 0xa428 Identification: 0xa428
DF flag: 0 DF flag: 0 DF flag: 0 DF flag: 0
MF flag: 0 MF flag: 0 MF flag: 1 MF flag: 1
Fragment offset: 0 Fragment offset: 244 Fragment offset: 122 fragment offset: 0

IP datagram Fragment 3 Fragment 2 Fragment 1

MTU: 4000 MTU: 1000


Router
97
IP Reassembly
• Fragments might arrive out-of-order
Length = 1500, M=1, Offset = 0 – Don’t know how much memory required
until receive final fragment
IP IP
Header Data

Length = 520, M=1, Offset = 1480 • Some fragments may never arrive
– After a while, give up entire process
IP IP
Header Data

Length = 1500, M=1, Offset = 1980

IP IP
Header Data

Length = 360, M=0, Offset = 3460 IP IP IP IP


Data Data Data Data
IP IP
Header Data

98
Fragmentation and Reassembly
• Demonstrates many Internet concepts
– Decentralized
• Every network can choose MTU
– Connectionless
• Each fragment contains full routing information
• Fragments can proceed independently and along different routes
– Complex endpoints and simple routers (david clark paper)
• Reassembly at endpoints

• Uses resources poorly


– Forwarding, replication, encapsulations costs
– Worst case: packet just bigger than MTU
– Poor end-to-end performance
• Loss of a fragment

• How to avoid fragmentation?


– Path MTU discovery protocol  determines minimum MTU along route
– Uses ICMP error messages

99
Motivation for Change from IPv4 to IPv6
- Current version of IPv4 - is more than 30 years old
- IPv4 has shown remarkable success !!!
- Then why change?

 Address space
- 32 bit address space allows for over a million networks
- But...most are Class C and too small for many organizations
- 214 = 16384 Class B network addresses already almost exhausted

 Type of service
- Different applications have different requirements for delivery reliability & speed
- Current IPv4 has type of service that's not often implemented
- Effective multimedia communication
- Data encryption and authentication

 Multicast

 One next version is called IPv6 !


New Features in IPv6
- Large address size – 128 bits = 16 bytes
- Better header format - entirely different
- Base header – 40 bytes
- Extension headers - Additional information stored in optional extension headers
- Support for resource allocation (QoS) - flow labels and quality of service allow
audio and video applications to establish appropriate connections
- Support for more security
- Extensible - new features can be added more easily
- No checksum field - to reduce processing time in a router
- No fragmentation - to reduce load of routers
- Potential for the Internet of Things (IoT)

40 bytes
IPv6 Base Header Format

It contains less information than IPv4 header


- VERS = 6 for IPv6
- PRIORITY (8 bits) for traffic classes, such as delay, jitter, reliability requirements
- PAYLOAD LENGTH (16 bits): Length excluding the base header
- NEXT HEADER points to first extension header
- HOP LIMIT (8 bits) same as TTL in IPv4
- FLOW LABEL (20 bits)
- used to associate datagrams belonging to a flow or communication
between two applications
- Specific path
- Routers use FLOW LABEL to forward datagrams along prearranged path
IPv6 Next Header
Purpose of multiple headers: economy and extensibility

Next header codes


 0 - Hop-by-hop option
 2 - ICMP
 6 - TCP
17 - UDP
43 - Source routing
44 - Fragmentation
50 - Encrypted security payload
51 - Authentication
59 - Null (no next header)
60 - Destination option
IPv6 Addressing

- 128-bit addresses: Type + Rest of address


- Groups of 16-bit numbers in hex separated by colons - colon hexadecimal (or colon hex)
69DC:8864:FFFF:FFFF:0:1280:8C0A:FFFF
- Special types of addresses: unicast, multicast, anycast - collection of computers with same prefix
- Type:
0000 0000 - Reserved
0000 000 - ISO network addresses
0000 010 - IPX (Novell)
010 - Provided-based unicast addresses
100 - Geographic unicast addresses
1111 1111 - Multicast address
- Provider-based unicast addresses for normal host
--------------------------------------------------------------------------------------------------------------
| 010 | RegID(5) | ProviderID(16) | SubscriberID(24) | SubnetID(32) | HostID(48) |
--------------------------------------------------------------------------------------------------------------
- Register ID: 11000 - INTERNIC for North America
01000 - RIPNIC for European countries
10100 - APNIC for Asian and Pacific countries
- Address hierarchy
- Reserved addresses
- Loopback address: 000...0001
- IPv4 address: 000...000+IPv4 address = Ipv6 address

Potrebbero piacerti anche