Networks and
Communication
Module 4 Network Layer
Contents
• IP Address Space • IPV4
• Classful addressing • IPV6
• Routing in classtype • IPV6 – Flow label
• Address conversion • IPV6 – Next Address
• CIDR • IPV6 - CIDR
• Subnet • Anycast
• Subnet mask • IPV6 Address
• Supernet • IPV6 to IPV4
• NAT • IPV6 to IPV4
• Special IP Address
IP Address Space
An IP Address consists of 32 bits
An IP prefix / a subnet mask.
TCP IP Protocol Suite - Behrouz A. Forouzan
IP Address Space
Each 32 bit IP address
consists of two-level
1. To whom does the IP
address belong?? hierarchical structure
2. How do we know the Network - the leftmost
network part in an IP n bits (prefix)
Address? Host - the rightmost 32 − n bits
Classful addressing
In classful addressing, the
address space is
Divided into five classes:
A, B, C, D, and E
Classful addressing
Class A – Prefix – 8 bits
Starts with 0
Class B – Prefix – 16 bits
Starts with 10
TCP IP Protocol Suite - Behrouz A. Forouzan
Classful addressing
Class C – Prefix – 24 bits
Starts with 110
Class D -Starts with 1110
28 bit Multicast address
Class E – Starts with 1111
- Reserved
TCP IP Protocol Suite - Behrouz A. Forouzan
Routing in class type
IP address
When packet arrives
destination address is
looked at
• 28 bits shift to get 4 bit
class value (A,B,C,D..)
• 4 bits will have 16 values
Routing in class type
IP address
8 Values (0000 – 0111) class A
4 values (1000 – 1011) class B
2 values (1100 – 1101) class C
1 values (1110, 1111 ) each
for class D,E
By knowing class - You know
the network bits/ Prefix
Routing in class type
IP address
By Knowing network bits you
can find the network address
from IP address.
Class A – 8 bits – FF000000
Class B – 16 bits – FFFF 0000
Class C – 24 bits – FFFFFF00
Routing in class type
IP address
Specific routing table for
each class – A, B, C
• The interface is looked at in
the table
• The packet is sent to the
destination address using
specified interface.
Address conversion
Binary to Hex
a. 1000 0001 00001011
0000 1011 11101111
b. 1100 0001 1000 0011
0001 1011 11111111
Address conversion
Decimal to Binary
a. [Link]
b. [Link]
Hex to decimal/Binary
a. C8 56 BB AA
b. 79 C9 52 DD
Error in IP Address
a. [Link]
b. [Link].20
c. [Link]
d. 11000010.23.15.123
Classless Inter
Domain Routing -
CIDR
In classless addressing
RFC 4632 • Variable-length address
It works with subnets blocks are assigned that
Pronounced ‘‘cider,’’ as belong to no class
in the drink. • What was the number of
addresses in class A, B?
CIDR
Entire address space (232
addresses)
• Divided into blocks of
One subnet consists of different sizes
• Networks with blocks of IP
a block of IP address
address
with power of 2n. • Address blocks in power of
n = 0, 1, 2 .. 31 2n. Such as 2,4,8 ..1024…
CIDR
In classless addressing The
prefix defines the network –>
n bits
• n=0 … 32
A.B.C.D/n
• A small n means a larger
Classful address is possible with
block of IP address
specific rule in classless
• a large n means a small
addressing n = 8,16,24,4,4
block of IP address
The suffix defines the number of
host 32-n bit
CIDR
In classless addressing, we
• Number of addresses need to know
• Start address • One of the addresses in
AND subnet mask with given the block
IPA • The prefix length
• End address
OR complement of subnet
• How do we define CIDR
mask with given IPA (network block of IP Address?
address)
[Link]/27 ??
Subnets
Company with 60 departments
Multiple locations,
Each having 30 – 50 hosts.
Class C network will not suffice. University with 30 departments.
Class B has 64K hosts and very Each department needs 30-90 IPA
large for their needs.
Putting all hosts in one network How many IP address they need?
is not possible. Which class of IP network you will
So we create subnets. How? assign?
Subnets
For class B – 16 bit host
address
Few bits are taken away to
create subnet number
• If we take 4 bits from host How do we know what is the
part, we can create 16
subnet from IP address?
subnet.
• If we take 10 bits from host What is subnet mask?
part, we can create 1024 AND subnet mask with IPA to
subnets find the network address.
Subnets
• If we take 4 bits from host
part, we can create 16
subnet.
• If we take 10 bits from host
part, we can create 1024
subnets
TCP IP Protocol Suite - Behrouz A. Forouzan
Subnet
TCP IP Protocol Suite - Behrouz A. Forouzan
Subnet mask
Network Prefix can not be
derived from IP address.
Hence, network prefix should
All computer connected to be specified exclusively
one subnet must use one Network prefix number of 1’s
network address. is called subnet mask
Logical AND of subnet [Link]/16
mask with IP address gives [Link]/18
network address.
Subnet
The IP address [Link]
can belong to many blocks
TCP IP Protocol Suite - Behrouz A. Forouzan
Supernet
Effective distribution of IP address
using CIDR
University with class B
Class B can accommodate address
~65000 computers [Link]
Waste of IP address with 40 departments x 50
class approach computers per dept.
[Link]/21 2000 computers
Growth of Internet need more IP
addresses
Deeper hierarchy Short term -
Country, State, CIDR
District/city, Lan, NAT Network address
host translation
Requires more Long term - IPV6
than 32 bits of
address
Network address Translation - NAT
• The ISP may not be able to grant
the demand
• If the business grows or • Because the addresses before
• The household needs a and after the range may have
larger range already been allocated to other
In most situations, however, networks
only a portion of computers in • The distribution of addresses
a small network need access to through ISPs has created a new
the Internet simultaneously. problem.
NAT
A technology that can help in
these cases is NAT
• Address Translation
• Translation Table
• Private IP address
• Routable IP address
TCP IP Protocol Suite - Behrouz A. Forouzan
NAT
A technology that can help in
these cases is NAT
• Address Translation
• Translation Table
TCP IP Protocol Suite - Behrouz A. Forouzan
Network address
Translation - NAT
Private IP address
172.18.x.y
Routable IP address
[Link]
IPV4
TCP IP Protocol Suite - Behrouz A. Forouzan
IPV4
Fragment flag – 3 bits
Reserve – one bit
Do not fragment = 1
Fragment allowed = 0
More fragments = 1,
Last fragment = 0
IPV4
Fragmentation offset
13bits?
To assemble the fragmented
packets sequentially –
relative to first packet
Multiple of 8 bytes
Measured in units of 8 bytes
IPV4
• Time to Live – 8 bits
Decremented at each
router
Packet dropped at 0
Prevents recirculation in
internet
• Header checksum
TCP IP Protocol Suite - Behrouz A. Forouzan
IPV4
Protocols
Multiplexing/Demultiplexing
ICMP = 01,
IGMP = 02,
TCP = 6,
UDP = 17,
OSPF = 89
TCP IP Protocol Suite - Behrouz A. Forouzan
IPV4
• Options
Source routing
Tracerouting
Timestamp
Many more
[Link]
Options
• IPV4 follows BigEndian
system.
Largest value first
IPV4
An IPv4 packet has arrived
with the first 8 bits as
shown: 0100010.
Analyze validity of IP
Packet
IPV4
In an IPv4 packet, the
value of HLEN is 1001 in
binary.
Find if option field is
occupied or not?
IPV4
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?
Reasons for IPV6
• Depletion of address in IPv4
• Larger address space
• The need for new options • The slowness of the process due
New options for new to some unnecessary processing
additional functionality IPv6 header separates base
• Support for multimedia header and options
• Addition of flow label, • The desperate need for security
• Traffic class for resource confidentiality and integrity of
allocation the packet by encryption and
authentication options
IPV6
• The planet earth is • 128 Bits address
approximately 260 • If we can build a high-rise
square meters. building over the land and
• Still there are enough sea to accommodate 268
addresses to connect computers in each square
all computers to the meter of the earth.
Internet.
TCP IP Protocol Suite - Behrouz A. Forouzan
IPV6
• If we assign 260 addresses
to the users each year
Almost one billion each
second
It will take 268 years to
deplete addresses.
TCP IP Protocol Suite - Behrouz A. Forouzan
IPV6
Zero Compression in IPV6
TCP IP Protocol Suite - Behrouz A. Forouzan
IPV6
Show abbreviations for the following addresses:
a. 0000:0000:FFFF:0000:0000:0000:0000:0000
b. 1234:2346:0000:0000:0000:0000:0000:1111
c. 0000:0001:0000:0000:0000:0000:1200:1000
Solution
a. 0:0:FFFF:: d. 0000:0000:0000:0000:0000:FFFF:[Link]
b. 1234:2346::1111
c. 0:1::1200:1000
d. ::FFFF:[Link]
IPV6
Ver – 4 bits - 0110
Traffic Class. QOS
This 8-bit field is used to
distinguish different
payloads with different
delivery requirements.
It replaces the service
class field in IPv4.
TCP IP Protocol Suite - Behrouz A. Forouzan
• Hop Limit = TTL
IPV6
time to live
• Next Header = Options
field
• Payload – 16 bits –
65535 bytes
• Source address – 16
bytes
• Destination Header –
16 bytes
IPv6 header - 40 Bytes
TCP IP Protocol Suite - Behrouz A. Forouzan
IPV6
• To a router, a flow is a
sequence of packets
sharing same
characteristics,
• The flow label is a 20-bit field The same source,
that is designed to provide same destination,
special handling for a same priority, and
particular flow of data. same options.
Random number 1 to 220 -1 Traveling the same path,
To allow us to use IPv6 as a Using the same resources
connection-oriented protocol Same kind of security
TCP IP Protocol Suite - Behrouz A. Forouzan
IPV6 Flow Label
Router has a flow table
• An entry for each active flow label
• Each entry defines the services, QOS,
required by the corresponding flow label
• It consults its flow label table to find The
corresponding entry for the flow label
value defined in the packet.
• It then provides the packet with the
services mentioned in the entry
IPV6 Flow Label
• A flow label can be used to Speed up the
processing of a packet by a router
Need not look at Routing table
Going through a routing algorithm to find next
hop address
Used to support the transmission of Real-time
audio and video
Normally it requires high bandwidth, large
buffers, long processing time.
IPV6 Flow Label
• The use of real-time data
requires
A process can make a The reservation of resources
reservation for Resources Require other protocols
beforehand to guarantee that RTP - Real-Time Protocol RSVP -
real-time data will not be Resource Reservation Protocol in
delayed due to a lack of addition to IPv6
resources.
IPV6 Flow Label
• If a router does not support the
flow label, It simply ignores it
• If a host does not support the flow
label,
It sets this field to zero.
• A source must not reuse a flow
label for a new flow while the
existing flow is still alive
IPV6 Next Header
The header length
defines the number of
bytes in the header
Including the next header
field.
TCP IP Protocol Suite - Behrouz A. Forouzan
IPV6 Next Header
TCP IP Protocol Suite - Behrouz A. Forouzan
IPV6 Next Header
• Source routing
Strict source route and the
Loose source route options
• Destination option pass
• Fragmentation,
information to the
• Authentication,
destination.
Intermediate routers are • Encrypted security payload
• Hop by Hop
not permitted to access
Management, debugging, or
this information
control functions
• Payload length more than 65535
IPV6 vs IPv4
• No header length - HLEN
Fixed header
• Total length field • No service type field
Replaced by payload Flow label
length field. • No identification, flag, and offset
• TTL -> Hop limit fields
• Protocol -> Next header Included in the
• Option field -> Next fragmentation extension header
Header • No Checksum
-> Extension header
IPV6 Next Header
Source routing
Strict source route and the
Loose source route options
Fragmentation,
Destination option Authentication,
Pass information to the Encrypted security payload
destination. Hop by Hop
Intermediate routers are Management, debugging, or
not permitted to access control functions
this information Payload length more than 65535
IPV6 CIDR
A destination address can be
Unicast
Multicast
Anycast
TCP IP Protocol Suite - Behrouz A. Forouzan
IPV6 Unicast/Multicast
• Unicast
• A block of address assigned by
IPv6
• Multicast
• Each member of the group
receives a copy
• A block is assigned by IPv6
• No broadcast in IPv6
• Special case of multicast
IPV6 Anycast
• A group of computers that all share a single address.
• A packet with an anycast address is delivered to only
one member of the group, the most reachable one
• An anycast communication is used when there are
several servers that can respond to an inquiry.
• The request is sent to the one that is most reachable.
• The addresses are assigned from the unicast block not
from IPv6.
IPV6 Address
a. An address with 64 0s followed by 64 1s.
b. An address with 128 0s.
c. An address with 128 1s.
d. An address with 128 alternative 1s and 0s.
Abbreviated Address
Unabbreviated Address
a. :: FFFF:FFFF:FFFF:FFFF
a. 0000:0000:0000:0000:FFFF:FFFF:FFFF:FFFF
b. ::
b. 0000:0000:0000:0000:0000:0000:0000:0000
c. FFFF:FFFF:FFFF:FFFF:FFFF
c. FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF
:FFFF:FFFF:FFFF
d. AAAA:AAAA:AAAA:AAAA:AAAA:AAAA:AAAA:
d. AAAA:AAAA:AAAA:AAAA:
AAAA
AAAA:AAAA:AAAA:AAAA