Вы находитесь на странице: 1из 63

Chapter 6

Internetworking Protocol

1
Main reference: Copyright © The McGraw-Hill Companies.
Part 1

6.1 Internetworking
6.2 Internet Protocol
6.3 IPv4 vs.IPv6

2
6.1: INTERNETWORKING

Internetworking is connecting networks together to


make an internetwork or an internet.

3
Links between two hosts

Physical & data link layers operate locally

Problem: When data arrive at the interface f1 of S1, how does S1 know that
Interface f3 is the outgoing interface?
To solve this problem, the network layer was designed.
4
Network layer in an internetwork

The network layer is responsible for host-to-host delivery and for routing the packets
through the routers or switches.
5
Network layer at the source, router, and destination

Creating a packet from the data coming Address verification: ensure the destination
from another protocol. address on the packet is the same in the host.
Checking its routing to find the routing Fragmentation: waits for all fragments,
information. reassembles them and then delivers the
reassembled packet to the transport layer.
6
Network layer at the source, router, and destination (continued)

 Responsible for routing the packet

The internet, at the network layer is a switched-packet network.

7
Note

Switching at the network layer in the Internet uses


the datagram approach to packet switching.

8
Note

Communication at the network layer in the


Internet is connectionless.

9
6.2: Internet Protocol

The ISO adopted a connectionless internet service which


is based on the internet protocol developed for
ARPANET, which grows steady into its existing shape
today: Internet.

The internet protocol is one of the protocol associated


with the complete protocol suite used with the Internet
:TCP/IP, which includes transport and application
protocols used for commercial and research works.

IP provides a connectionless, or datagram service


between end systems.
10
The Internet Protocol version 4 (IPv4) is the
delivery mechanism used by the TCP/IP protocols.

11
Position of IPv4 in TCP/IP protocol suite

Unreliable – a best-effort delivery service: provides no error control or flow control.


If reliability if important, it must be paired with a reliable protocol s.a. TCP.

Connectionless protocol for packet switching network that uses datagram approach.
Each datagram is handled independently and it can follow different route to a destination.
12
IP Addressing: IPv4

An IP address is a numeric identifier that uniquely defines a host on the


Internet.
It consists of 32 bits [in IPv4], normally written as 4 octets [dotted decimal
format], and composed of a network identifier [netid] and a host identifier
[hostid].

A router is connected to more than one network, hence it needs one IP


address for each interface, as shown below:

13
Network Address Classes

There are 5 different IP address classes: A, B, C, D and E as shown below

14
Network Classes

Address is coded to allow a variable allocation of bits to specify network


and host.

This allows flexibility in assigning addresses to hosts and allows a mix of


network sizes on an internet.

Three principles network classes:


Class A: Few network, each with many hosts
Class B: Medium number of networks, each with medium no. of hosts
Class C: Many networks, each with few slots

It is possible to mix all three classes of addresses on the same internetwork.

15
Class A

The first bit of zero defining the class as A.


The first byte is the netid, defining 27 - 2 reserved addresses = 126
networks [network addresses with a first byte of 0 (binary
00000000) and 127 (01111111) are reserved].

The other 3 bytes [24 bits] gives the hostid.


Hence, each network can have up to 224 - 2 reserved addresses =
16,777,214 hosts

ARPANET and only few large commercial networks are given


these Class A addresses.
For normal organization, Class B addresses are used.

16
Class B

The two leftmost bits are 10 to identify the class as B.


The first 2 bytes define the netid and the remaining 2 bytes for hostid.
Since class B network addresses begin with a binary 10, the range of
The 1st byte number is 128 to 191 [binary 10000000 to 10111111].
Combining with the 2nd byte number, there are a total of 214 = 16,384
possible Class B addresses.
Each network can have up to 216 - 2 reserved addresses = 65,534 hosts

17
Class C

The first three bits of 110 indicates the address class as C.


First three octets are assigned for netid and the last octet for hostid.
The first decimal number ranges from 192 to 223 [binary 11000000 to
11011111].

The total number of Class C network is thus 221 = 2,097,152.


However, each of the network can only have a maximum of 28 – 2
reserved address = 254 host addresses.

18
Class D and E

There is no netid or hostid in both classes.


Class D is used for multicasting.
Class E is reserved by Internet for special use.

19
Network Classes

Classes can also be distinguished in decimal notation by observing the first byte:
1 to 126 Class A address
128 to 191 Class B address
192 to 223 Class C address
224 to 239 Class D address
240 to 255 Class E address

Generally, addresses should never begin with 0, 127 or any number above 223
(reserved).

Addresses violating these rules are sometimes known as Martian Address, since
these addresses are not used on earth.

20
Special Addresses

Some addresses are reserved for special purposes.


A network defines itself by a network address in which the hostid is set to all
zeroes.
The IP address of 0.0.0.0 is used for default network.
IP address with netid of 127 is used as the loopback address [used by the
host computer to send a message back to itself].

The hostid with all 1s is used to broadcast


message to all hosts on a specific network.
In addition, the IP address of 255.255.255.255 8
can also be used for broadcasting on the local
network.

21
Special Addresses (cont …)

These special addresses are summarized in the table below:

22
Subnetting

Subnetting is a process of dividing a large network into smaller


subnetworks or subnets connected together by routers.

If an organization has a large number of computers, it would be more


convenient to implement subnetting.

23
Subnetting (cont …)

Benefits
 Reduced network traffic: most traffic will stay on the local network,
only packets destined for other networks will pass through routers; this
will optimize the network performance.
 Simplified management: it is easier to identify and isolate network
problems in a group of smaller networks than within a large one.

Example: A network with Class B address of 158.108.X.X

24
Subnetting (cont …)

An organization has been given a Class C address of 198.228.120.X


Part of the fourth octet can be used to indicate the subnetwork and the host

This division has no significance outside of the organization; an outsider


would treat all datagrams addressed to 198.228.120.X the same way.
Outside networks will not look at the fourth octet of the address.

25
Subnetting (cont …)

There is only one gateway attached to the local site network that performs
internet-wide routing (communicate with outside networks).

For a single netid with a number of associated subnetworks, the hostid part
consists of 2 subfieds: subnetid and hostid,
In subnetting, bits are stolen from the hostid to create the subnetid, as shown
below.

26
Subnetting (cont …)

In the example, 6 bits are stolen from the hostid for the subnetid
 Netid - defines a site
 Subnetid - defines a subnetwork within a site
 Hostid - identifies a host in the subnetwork

27
Masking

Masking is a process of extracting subnetwork address from an IP address


using a 32-bit mask.

The part of the mask containing 1s represents the netid and subnetid
 The part of the mask containing 0s identifies the hostid.
 To obtain the subnet address, a bitwise-AND operation on the IP address
and the subnet mask is performed.
 The effect of the subnet mask is to erase the portion of the host field that
refers to an actual host on the subnet.
 What remains is the network number and the subnet number.

28
Masking (cont ..)

Consider a local complex consisting of 3 LANs and 2 routers

To the rest of the internet, this complex is a single network


with Class C address of 192.228.17.X

29
Masking (cont ..)

30
Masking (cont ..)

Both routers R1 and R2 are configured with a subnet mask of


255.255.255.224. If a datagram with the destination address 192.228.17.57
arrives at R1, R1 applies the subnet mask to determine the destination subnet
address and the host:

Hence, the datagram will be routed to LAN X which has subnet no. 1
(192.228.17.32) and received by station B (host number 25).

31
Masking (cont ..)

Maximum number of subnets in a site-wide network:


2 no. of masked bits corresponding to the subnetid - 2 special address

Maximum number of hosts per subnet:


2 no. of unmasked bits - 2 special addresses

For each of the subnetid and hostid, all zeroes and all ones is not allowed
[reserved]

32
Masking (cont ..)

Subnet interpretation:

IP address 130.122.34.3 10000010.01111010.00100010.00000011


Subnet mask 255.255.255.192 11111111.11111111.11111111.11000000
Bitwise AND of IP address and
subnet mask (resultant network / 10000010.01111010.00100010.00000000
subnet number )
= 130.122.34.0
Subnet number 10000010.01111010.00100010.00000000 136
Host number 00000000.00000000.00000000.00000011 3
33
IPv4 datagram format

Packets in the IPv4 layer are called datagrams.

A variable length packet consists of header and data.


The header contains information essential to routing and delivery.
It is a customary in TCP/IP to show the header in 4-byte sections. 34
Service type or differentiated services

1) Precedence 1) Codepoint
 A 3-bit subfield (0-7)  When the 3 rightmost bits are 0s,
 Defines the priority of the the 3 leftmost are interpreted as
datagram in issues such as the precedence bits.
congestion  When the 3 rightmost bits are not
all 0s, the 6 bits define 64 services
based on the priority assignment
2) TOS bits by the Internet or local authorities.
 A 4-bit subfield with each bit
having a special meaning.
 Only 1 bit is set at a time

35
Note

The precedence subfield was part of version 4,


but never used.

36
Types of service

Bit patterns and their interpretations for 5 different type of services

37
Default types of service

Application programs can request a specific type of service. 38


Values for codepoints

Category Codepoint Assigning Authority


1 XXXXX0 Internet
2 XXXX11 Local
3 XXXX01 Temporary or experimental

39
Note

The total length field defines the total length of the


datagram including the header.

40
Encapsulation of a small datagram in an Ethernet frame

There are occasions in which the datagram is not the only thing encapsulated
in a
frame; it may be that padding has been added.

E.g.:

41
Protocol field and encapsulated data

The 8-bit field defined the higher-level protocol that uses the services of the IPv4 layer.

A IPv4 datagram can encapsulate data from several higher-level protocol s.a TCP,
UDP etc.

Since the IPv4 protocol carriers data from different other protocols, the value of
this field helps in receiving network layer know to which protocol the data belong.

42
Protocol values

43
Example 1

An IPv4 packet has arrived with the first 8 bits as shown:


01000010
The receiver discards the packet. Why?

Solution
There is an error in this packet. The 4 leftmost bits
(0100) show the version, which is correct. The next
4 bits (0010) show an invalid header length (2 × 4 =
8). The minimum number of bytes in the header
must be 20. The packet has been corrupted in
transmission.
44
Example 2

In an IPv4 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.

45
Example 3

In an IPv4 packet, the value of HLEN is 5, and the value of


the total length field is 0x0028. 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).
Note: Length of data = total length - header length
46
Example 4
An IPv4 packet has arrived with the first few hexadecimal
digits as shown.
0x45000028000100000102 . . .
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. 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.
47
Fragmentation

A datagram can travel through different networks.

Each router decapsulates the IPv4 datagram from the frame it receives, process it
and then encapsulates it in another frame.

Maximum Transfer Unit (MTU) is the maximum number of bytes that a data
link protocol can encapsulate. MTUs vary from protocol to protocol.

Fragmentation is the division of a datagram into smaller units to accommodate


the MTU of a data link protocol.

48
Maximum transfer unit (MTU)

Maximum Transfer Unit (MTU) is the maximum number of bytes that


a data link protocol can encapsulate.

49
MTUs for some networks

MTUs vary from protocol to protocol.


50
Fields related to fragmentation

Identification: identifies a datagram originating from the source host.

Fragmentation offset: shows the relative position of this fragment


with respect to the whole datagram.

Flags
51
Flags used in fragmentation

1st bit : reserved bit


D or 2nd bit: do not fragment bit
M or 3rd bit: the more fragment bit

52
Fragmentation example

53
Detailed fragmentation example

54
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.

55
Example 6

A packet has arrived with an M bit value of 1. 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 1, it means that there is at least one
more fragment. This fragment can be the first one
or a middle one, but not the last one. We don’t
know if it is the first one or a middle one; we need
more information (the value of the fragmentation
offset).
56
Example 7

A packet has arrived with an M bit value of 1 and a


fragmentation offset value of 0. Is this the first fragment,
the last fragment, or a middle fragment?

Solution
Because the M bit is 1, it is either the first fragment
or a middle one. Because the offset value is 0, it is
the first fragment.

57
Example 8

A packet has arrived in which the offset value is 100. What


is the number of the first byte? Do we know the number of
the last byte?

Solution
To find the number of the first byte, we multiply the
offset value by 8. This means that the first byte
number is 800. We cannot determine the number of
the last byte unless we know the length.

58
Example 9

A packet has arrived in which the offset value is 100, the


value of HLEN is 5, and the value of the total length field is
100. What are the numbers of the first byte and the last
byte?

Solution
The first byte number is 100 × 8 = 800. The total
length is 100 bytes, and the header length is 20
bytes (5 × 4), which means that there are 80 bytes in
this datagram. If the first byte number is 800, the
last byte number must be 879.

59
6.3: IPv6 vs IPv4

The network layer protocol in the TCP/IP protocol


suite is currently IPv4. Although IPv4 is well
designed, data communication has evolved since
the inception of IPv4 in the 1970s.

60
IPv4 vs. IPv6

IPv4 has some deficiencies that make it unsuitable for the


fast-growing Internet:
 Long term problem in the Internet: address depletion

 The Internet must accommodate real-time audio and video transmission.


It requires minimum delay strategies and reservation of resources not
provided in the IPv4 design.

 The Internet must accommodate encryption and authentication of data


for some application. No encryption or authentication is provided by
IPv4.

61
IPv4 vs. IPv6

IPv6 has some advantages over IPv4:


 Larger address space
 Better header format
 New options
 Allowance for extension
 Support for resource allocation.
 Support for more security

62
Transition From IPv4 to IPv6

Because of the huge number of systems on the Internet, the


transition from IPv4 to IPv6 cannot happen suddenly. It
takes a considerable amount of time before every system in
the Internet can move from IPv4 to IPv6. The transition
must be smooth to prevent any problems between IPv4 and
IPv6 systems.

63

Вам также может понравиться