Unit 3
Unit 3
Computers communicate through the Internet. The packet(data) transmitted by the sender
computer may pass through several LANs or WANs before reaching the destination computer.
For this level of communication, we need a global addressing scheme what we call logical
addressing. An IP address is used globally to refer to the logical address in the network layer of
the TCP/IP protocol.
The Internet addresses are 32 bits in length; this gives us a maximum of 232 addresses. These
addresses are referred to as IPv4 (IP version 4) addresses or popularly as IP addresses.
The need for more addresses ,in addition to other concerns about the IP layer, led to a new design
of the IP layer called IPv6.In this version the internet uses 128bit addresses.
IPV4 ADDRESSES
An IPv4 address is a 32-bit address that uniquely and universally defines the connection of a
device (for example, a computer or a router) to the Internet.
Address Space
IPv4 has a certain address space. An address space is the total number of addresses used by the
protocol. If a protocol uses N bits to define an address, the address space is 2N
IPv4 uses 32-bit address format, which means that the address space is 232 or 4,294,967,296
Notations
There are two notations to show an IPv4 address:
1. Binary notation
2. Dotted decimal notation
1) Binary Notation
In binary notation, the IPv4 address is displayed as 32 bits. Each octet is often referred to as a
byte. So ,IPv4 address is referred to a 4-byte address. The following is an example of an IPv4
address in binary notation:
11011101 00101101 01001110 00111000
2) Dotted-Decimal Notation
IPV4 addresses are usually written in decimal form with a decimal point (dot) separating the
bytes since it’s more compatible. The following is an example:
221.45.78.56
Classful Addressing
IPV4 used the concept of classes. This architecture is known as classful addressing. In the
classful addressing, there are 5 classes in which the address space is divided: A, B, C, D,
and E.
We can find the class of an address when given the address in binary notation or dotted-decimal
notation by checking the first few bits or first byte.
Mask
In class A,1 byte is reserved for network address and 3 bytes are reserved for host address.
In class B,2 bytes are reserved for network address and 2 bytes are reserved for host address
In class C,3 bytes are reserved for net id and 1 byte for host id.
Subnetting & Supernetting: Dividing a large block of addresses into several contiguous sub-
blocks and assigning these sub-blocks to different smaller networks is called subnetting. In
Supernetting, multiple networks are combined into a bigger network termed as a Supernetwork
or Supernet. There is a problem with the classful addressing that is "each class is divided
into a fixed number of blocks with each block having a fixed size".
Classless Addressing
Classful addressing leads to address depletion. That's the big issue for this schema and that's why
it's not used nowadays.To overcome the problem of address depletion and to give more
organizations access to the Internet, the classless addressing was designed and implemented. In
this scheme of classless addressing, there are no classes, but the addresses are still granted in
blocks.
Three restrictions on classless address blocks:
1. The addresses in a block must be contiguous that means one after another.
2. The number of classless addresses in a block must be a power of 2.
3. The first address must be evenly divisible by the number of addresses.
In IPv4 addressing, a block of address can be defined as x.y.z.t/n in which x.y.z defines one of
the address and the /n define the mask.
Ipv4 is the delivery mechanism used by TCP/IP protocols. It is an unreliable and connection less.
IPV6 ADDRESSING
IPV6 address uses 128bit address. It uses Hexadecimal Colon Notation in which 128 bits are
divided in to eight sections, each 2 bytes in length.
IPV6 address in binary and hexadecimal colon notation.
Abbreviated address
Address Space
IPV6 has a much larger address space; 2128 address are avaliable.IPv6 offers several types of
modes. They are:1.Unicast Addresses.
2.Multicast Addresses.
3.Anycast Addresses.
4.Reserved Addresses.
5.Local Addresses.
1.Unicast Addresses
It defines a single computer.The Packet sent to a unicast address must be delivered to that
specific computer.
2.Multicast Addresses
It is used to define a group of hosts instead of just one.A packet sent to a multicastaddress
must be delivered to each member of the group.
3.Anycast Addressess
An anycast address,like a multicast address,also defines a group of nodes.A Packet
destined for an anycast address is delivered to only one of the members of the anycast group,the
nearest one.
4.Reserved Addressess
These Addresses starts with eight 0s.These Addressess are reserved.
An Unspecified addresses are used when a host doesnot know its own IP address and sends an
inqury to find its.
A Loop back addresses are used by the host to test itself without going to network.
A Compatible addresses are used during the transition from IPV4 to IPv6.
A Mapped addresses are also used during transition i.e.a host migrated to IPv6 want to send a
packet to IPv4 host.
INTERNETWORKING
The physical and data link layers of a network operate locally. These two layers are jointly
responsible for data delivery on the network from one node to the next. This internetwork is
made of five networks: four LANs and one WAN. If host A needs to send a data packet to host
D, the packet needs to go first from A to Rl (a switch or router), then from Rl to R3, and finally
from R3 to host D.
The network layer at the source is responsible for creating a packet from the data coming from
another protocol (such as a transport layer protocol or a routing protocol). The header of the
packet contains, among other information, the logical addresses of the source and destination.
The network layer is responsible for checking its routing table to find the routing information
(such as the outgoing interface of the packet or the physical address of the next node). If the
packet is too large, the packet is fragmented.
IPV4 DATAGRAM FORMAT
The Internet Protocol version 4 (IPV4)is the delivery mechanism used by the TCP/IP protocols
DATAGRAM
A Datagram is a variable length packet consisting of two parts: header and data. The header is 20
to 60 bytes in length and contains information essential to routing and delivery. The encapsulated
data is referred as Payload.
1. VER .It is a 4-bit field that defines the version of the IPV4 protocol. Currently the
version is 4.
2. Header length (HLEN).It is a 4bit field that defines the total length of the datagram
header .The minimum value for this field is 5 (20 bytes) and the maximum is 15 (60
bytes).
3. Services The type of service (TOS) bits were included in the IPv4 header to allow
different types of IP datagrams.
1.Service Type
In this interpretation the first 3bits are called precedence bits. The next 4 bits are
called type of services.
With 1 bit set a time we can have five different types of services.
Description
In this interpretation the first 6 bits make up the codepoint subfied and last 2 bits are not used.
4. Total length. This is a 16bit field that defines the total length of the IPV4 datagram in
bytes.(header plus data).
5. Time to live The time-to-live (TTL) field is included to ensure that datagrams do not
circulate forever in the network. This field is decremented by one each time the datagram
is processed by a router. If the TTL field reaches 0, the datagram must be dropped.
6. Protocol.This is a 8bit field that defines the higher level protocols that uses the services
of the ipv4 layer.
7. Checksum.The header checksum helps a router in detecting bit errors in received IP
datagram.
8. Source Address.This is a 32 bit field that defines the ipv4 address of the source.
9. Destination Address.This is a 32 bit field that defines the ipv4 address of the destination.
Fragmentation
IP fragmentation is an Internet Protocol (IP) process that breaks packets into smaller pieces
(fragments), so that the resulting pieces can pass through a link with a smaller maximum
transmission unit (MTU) than the original packet size. The fragments are reassembled by the
receiving host.
It is a 13bit field shows the relative position of the fragment with respect to the whole datagram.
IPV6
IPv4 provides the host-to-host communication between systems in the Internet. Although IPv4 is
well designed, data communication has evolved since the inception of IPv4 in the 1970s. IPv4
has some deficiencies that make it unsuitable for the fast-growing Internet. Despite all short-term
solutions, such as subnetting, classless addressing, and NAT, address depletion is still a long-
term problem in the Internet. The Internet must accommodate real-time audio and video
transmission. This type of transmission requires minimum delay strategies and reservation of
resources not provided in the IPv4 design.
Advantages
The next-generation IP, or IPv6, has some advantages over IPv4 that can be summarized as
follows:
Larger address space
Better header format
New options
Allowance for extension
Support for resource allocation
Support for more security
Version: This 4-bit field defines the version number of the IP. For IPv6, the value is 6.
Priority: The 4-bit priority field defines the priority of the packet with respect to traffic
congestion.
Flow label: The flow label is a 3-byte (24-bit) field that is designed to provide special handling
for a particular flow of data.
Payload length: The 2-byte payload length field defines the length of the IP datagram excluding
the base header.
Next header: The next header is an 8-bit field defining the header that follows the base header in
the datagram. The next header is either one of the optional extension headers used by IP or the
header of an encapsulated packet such as UDP or TCP. Each extension header also contains this
field.
Hop limit: This 8-bit hop limit field serves the same purpose as the TIL field in IPv4.
Source address: The source address field is a 16-byte (128-bit) Internet address that identifies
the original source of the datagram.
Destination address. The destination address field is a 16-byte (128-bit) Internet address that
usually identifies the final destination of the datagram. However, if source routing is used, this
field contains the address of the next router.
Priority: The priority field of the IPv6 packet defines the priority of each packet with respect to
other packets from the same source. For example, if one of two consecutive datagrams must be
discarded due to congestion, the datagram with the lower packet priority will be discarded. IPv6
divides traffic into two broad categories: congestion-controlled and non congestion-controlled.
Address Mapping
An internet is made of a combination of physical networks connected by internetworking
devices such as routers. A packet starting from a source host may pass through several different
physical networks before finally reaching the destination host. The hosts and routers are
recognized at the network level by their logical (IP) addresses. However, packets pass through
physical networks to reach these hosts and routers. At the physical level, the hosts and routers are
recognized by their physical addresses.
A physical address is a local address. Its jurisdiction is a local network. It must be unique
locally, but is not necessarily unique universally. It is called a physical address because it is
usually (but not always) implemented in hardware. An example of a physical address is the 48-
bit MAC address in the Ethernet protocol, which is imprinted on the NIC installed in the host or
router.
Mapping Logical to Physical Address: ARP
Anytime a host or a router has an IP datagram to send to another host or router, it has the logical
(IP) address of the receiver. The logical (IP) address is obtained from the DNS if the sender is
the host or it is found in a routing table if the sender is a router. But the IP datagram must be
encapsulated in a frame to be able to pass through the physical network. This means that the
sender needs the physical address of the receiver. The host or the router sends an ARP query
packet. The packet includes the physical and IP addresses of the sender and the IP address of the
receiver. Because the sender does not know the physical address of the receiver, the query is
broadcast over the network
Using ARP is inefficient if system A needs to broadcast an ARP request for each IP packet it
needs to send to system B. It could have broadcast the IP packet itself. ARP can be useful if the
ARP reply is cached because a system normally sends several packets to the same destination. A
system that receives an ARP reply stores the mapping in the cache memory and keeps it for 20 to
30 minutes unless the space in the cache is exhausted. Before sending an ARP request, the
system first checks its cache to see if it can find the mapping.
2. Packet Format
The fields are as follows:
Hardware type: This is a 16-bit field defining the type of the network on which ARP is
running. Each LAN has been assigned an integer based on its type. For example, Ethernet is
given type 1. ARP can be used on any physical network
Protocol type: This is a 16-bit field defining the protocol. For example, the value of this field for
the IPv4 protocol is 080016, ARP can be used with any higher-level protocol.
Hardware length: This is an 8-bit field defining the length of the physical address in bytes. For
example, for Ethernet the value is 6.
Protocol length: This is an 8-bit field defining the length of the logical address in bytes. For
example, for the IPv4 protocol the value is 4.
Operation: This is a 16-bit field defining the type of packet. Two packet types are defined: ARP
request (1) and ARP reply (2).
Sender hardware address: This is a variable-length field defining the physical address of the
sender. For example, for Ethernet this field is 6 bytes long.
Sender protocol address: This is a variable-length field defining the logical (forexample, IP)
address of the sender. For the IP protocol, this field is 4 bytes long.
Target hardware address: This is a variable-length field defining the physical address of the
target. For example, for Ethernet this field is 6 bytes long. For an ARP request message, this
field is alI Os because the sender does not know the physical address of the target.
Target protocol address: This is a variable-length field defining the logical (forexample, IP)
address of the target. For the IPv4 protocol, this field is 4 bytes long.
3. Encapsulation
2. IP asks ARP to create an ARP request message, filling in the sender physical address, the
sender IP address, and the target IP address. The target physical address field is filled with 0s.
3. The message is passed to the data link layer where it is encapsulated in a frame by using the
physical address of the sender as the source address and the physical broadcast address as the
destination address.
4. Every host or router receives the frame. Because the frame contains a broadcast destination
address, all stations remove the message and pass it to ARP. All machines except the one
targeted drop the packet. The target machine recognizes its IP address.
5. The target machine replies with an ARP reply message that contains its physical address. The
message is unicast.
6. The sender receives the reply message. It now knows the physical address of the target
machine.
7. The IP datagram, which carries data for the target machine, is now encapsulated in a frame
and is unicast to the destination.
Proxy ARP
A technique called proxy ARP is used to create a subnetting effect. A proxy ARP is an ARP that
acts on behalf of a set of hosts. Whenever a router running a proxy ARP receives an ARP request
looking for the IP address of one of these hosts, the router sends an ARP reply announcing its
own hardware (physical) address. After the router receives the actual IP packet, it sends the
packet to the appropriate host or router. Let us give an example.
However, a diskless machine is usually booted from ROM, which has minimum booting
information. The ROM is installed by the manufacturer. It cannot include the IP address because
the IP addresses on a network are assigned by the network administrator.
The machine can get its physical address (by reading its NIC, for example), which is unique
locally. It can then use the physical address to get the logical address by using the RARP
protocol. A RARP request is created and broadcast on the local network. Another machine on the
local network that knows all the IP addresses will respond with a RARP reply. The requesting
machine must be running a RARP client program; the responding machine must be running a
RARP server program.
There is a serious problem with RARP: Broadcasting is done at the data link layer. The physical
broadcast address, all is in the case of Ethernet, does not pass the boundaries of a network. This
means that if an administrator has several networks or several subnets, it needs to assign a RARP
server for each network or subnet. This is the reason that RARP is almost obsolete. Two
protocols, BOOTP and DHCP, are replacing RARP
BOOTP
DHCP
The Dynamic Host Configuration Protocol (DHCP) has been devised to provide static and
dynamic address allocation that can be manual or automatic. DHCP provides static and dynamic
address allocation that can be manual or automatic. Static Address Allocation In this capacity
DHCP acts as BOOTP does. It is backward compatible with BOOTP, which means a host
running the BOOTP client can request a static address from a DHCP server. A DHCP server has
a database that statically binds physical addresses to IP addresses.
Dynamic Address Allocation: DHCP has a second database with a pool of available IP
addresses. This second database makes DHCP dynamic. When a DHCP client requests a
temporary IP address, the DHCP server goes to the pool of available (unused) IP addresses and
assigns an IP address for a negotiable period of time. When a DHCP client sends a request to a
DHCP server, the server first checks its static database. If an entry with the requested physical
address exists in the static database, the permanent IP address of the client is returned. On the
other hand, if the entry does not exist in the static database, the server selects an IP address from
the available pool, assigns the address to the client, and adds the entry to the dynamic database.
The Internet Control Message Protocol (ICMP)
ICMP
The IP provides unreliable and connectionless datagram delivery. It was designed this way to
make efficient use of network resources. The IP protocol is a best-effort delivery service that
delivers a datagram from its original source to its final destination. However, it has two
deficiencies: lack of error control and lack of assistance mechanisms.
The IP protocol also lacks a mechanism for host and management queries. A host sometimes
needs to determine if a router or another host is alive. And sometimes a network administrator
needs information from another host or router. The Internet Control Message Protocol (ICMP)
has been designed to compensate for the above two deficiencies. It is a companion to the IP
protocol.
1. Types of Messages
ICMP messages are divided into two broad categories: error-reporting messages and query
messages.
2. Message Format
An ICMP message has an 8-byte header and a variable-size data section. Although the general
format of the header is different for each message type, the first 4 bytes are common to all. As
the first field, ICMP type, defines the type of the message. The code field specifies the reason for
the particular message type. The last common field is the checksum field (to be discussed later in
the chapter). The rest of the header is specific for each message type. The data section in error
messages carries information for finding the original packet that had the error. In query
messages, the data section carries extra information based on the type of the query.
3.Error Reporting
One of the main responsibilities of ICMP is to report errors. ICMP always reports errors to the
original source
Destination un-reachable :
Destination unreachable is generated by the host to inform the client that the
destination is unreachable for some reason.
Parameter problem :
Whenever packets come to the router then calculated header checksum should be
equal to recieved header checksum then only packet is accepted by the router. If there
is mismatch packet will be dropped by the router.
ICMP will take the source IP from the discarded packet and informs to source by
sending parameter problem message.
Redirection message :
Redirect requests data packets be sent on an alternate route. The message informs to a
host to update its routing information (to send packets on an alternate route).
4.Query
The four query messages types in ICMP are:
1.Echo-request and echo-reply
2.Timestamp request and reply
3.Address mask request and reply
4.Router solicitation and advertisement.