Network-Layer
Network
Layer_Logical
Logical-Addressing
Addressing
Links between two hosts
Communication at Network layer
Host to Host (Computer to Computer)
Usually computers communicate through internet
This needs a global addressing scheme
Logical Addressing
or IP address in TCP/IP protocol suite
IPv4 and IPv6
IPv4 (IP version 4)
An IPv4 address is 32 bits long
IPv4 addresses are unique
and universal
The address space of IPv4 is
232 or 4,294,967,296
4 294 967 296
IPv4 Notations
Binary
Dotted-decimal notation
Base 256 : IP Addresses
Classful Addressing
IPv4 addressing
addressing, at its inception
inception, used the
concept of classes
In classful addressing
addressing, the address space
is divided into five classes:
A,
A B,
B C,
C D,
D and
dE
Finding the classes in binary and
d
dotted-decimal
d d i l notation
i
Netid
Hostid
Netid and Hostid concept does not apply to clases D and E
Drawbacks: Classful addressing
In Class A, block is too large
most of addresses were wasted and were not
in use
Block in Class B is also too large
Block of Class C is probably too small for
many organizations
Class
ass D: multicast
u t cast ---- Thee internet
te et aut
authorities
o t es wrongly
o gy
C
predicted a need for 268, 435, 456 groups. This never happened
Class E: were reserved for future use -----only few were used
Classless Addressing
No classes
classes, but addresses are still granted
in blocks
Restriction:
The addresses in a block must be contiguous
The
Th number
b off addresses
dd
iin a bl
block
k mustt b
be
a power of 2 (1,2,4,8 ,)
The
Th first
fi t address
dd
mustt be
b evenly
l di
divisible
i ibl b
by
the number of addresses
Example: 01
The above figure shows a block of addresses,
in both binary and dotted-decimal notation,
granted to a small business that needs 16
addresses
Example: 01
Contd
Contd
We can see that the restrictions are applied to this
block
The addresses are contiguous
The number of addresses is a power of 2
and the first address is divisible by 16
(16 = 24 )
The first address, when converted to a decimal number, is
3 440 387 360 which when divided by 16 results in 215,024,210
3,440,387,360,
215 024 210
MASKING
In IPv4 addressing,
addressing a block of
addresses can be defined as:
x.y.z.t
x y z t /n
in which x.y.z.t defines one of the addresses
and the /n defines the mask
The address and the /n notation
completely define the whole block
the first address
the last address
and the number of addresses
MASKING Contd..
Contd
The first address in the block can be found by
y setting
g the
rightmost
32 n bits to 0s
The last address in the block can be found by setting the
rightmost
32 n bits to 1s
The number of addresses in the block can be found by
y
using the formula
232-n
Example 02
Example-02
A block of addresses is granted to a small
organization. We know that one of the
addresses is [Link]/28.
205 16 37 39/28 What are
the first address, last address and number
of addresses in the block?
Example-02
Example
02
Contd
Contd.
The first address:
The binary representation of the given
address ([Link]
(205 16 37 39 )is
11001101 00010000 00100101 00100111
If we set 3228
32 28 rightmost bits to 0, we get
11001101
00010000
00100101 00100000
or
o
[Link].
Example-02
Example
02
Contd
Contd.
The last address:
The binary representation of the given
address ([Link]
(205 16 37 39 )is
11001101 00010000 00100101 00100111
If we set 3228
32 28 rightmost bits to 1, we get
11001101
or
o
[Link]
00010000
00100101 00101111
Example-02
Example
02
Contd
Contd.
The number of addresses:
23228 = 16
Another solution of Example-02
Example 02
The first address can be found by ANDing
g
the given addresses with the mask. ANDing
here is done bit by bit. The result of ANDing
2 bits is 1 if both bits are 1s; the result is 0
otherwise.
Another solution of Example-02
Example 02
The last address can be found by
y ORing
g the g
given
addresses with the complement of the mask. ORing
here is done bit by bit. The result of ORing 2 bits is 0
if both bits are 0s;; the result is 1 otherwise. The
complement of a number is found by changing each
1 to 0 and each 0 to 1
Another solution of Example-02
Example 02
The last address can be found by
y ORing
g the g
given
addresses with the complement of the mask. ORing
here is done bit by bit. The result of ORing 2 bits is 0
if both bits are 0s;; the result is 1 otherwise. The
complement of a number is found by changing each
1 to 0 and each 0 to 1
Another solution of Example-02
Example 02
The number of addresses can be found by
complementing the mask, interpreting it as a
decimal number, and adding 1 to it
Network Address
Three level Hierarchy: Subnetting
Example: An organization takes a
block of addresses starting with
17 12 14 0/26 from an ISP.
[Link]/26
ISP Design three
subnets of 32, 16 and 16 addresses.
Solution: The organization has its own
mask and each subnet must also have
its own.
own
Suppose mask for first, second and third
subnets are n1,
n1 n2 and n3 respectively
Network Address
Three level Hierarchy: Subnetting
Then n1=27
n2 = 28
n3 = 28
Thi
This means th
thatt we h
have th
the masks
k
27,28,28 with the organization mask
b i 26
being
Network Address Contd
Three level Hierarchy: Subnetting
Network Address Contd
Three level Hierarchy: Subnetting
Example -03
03
An ISP is g
granted a block of addresses starting
g with
[Link]/16 (65,536 addresses). The ISP needs to
distribute these addresses to three groups of
customers as follows:
a) The first group has 64 customers; each needs 256
addresses.
b) The second group has 128 customers; each needs 128
addresses.
c) The third group has 128 customers; each needs 64
addresses.
Design the subblocks and find out how many
addresses are still available after these allocations.
Address allocation and distribution
b an ISP
by
Network Address Translation (NAT)
NAT enables a user to have a large set of
addresses internally
and one address,, or small set of addresses
externally
Addresses for private networks reserved by internet authorities
A NAT implementation
Addresses in a NAT
NAT address translation
An Example: ISP and NAT
100,000 dialup Customers
Network layer at the source, router, and destination
Network layer at the source
source, router
router, and destination (continued)
IPv6
An IPv6 address is 128 bits long
IPv6 address in binary and hexadecimal
colon notation:
Abbreviated IPv6 addresses
Position off IPv4 in TCP/IP pprotocol suite
Protocol field and encapsulated data
Maximum transfer unit (MTU)
IPv4 datagram format
Transition strategies from IPv4 to
IP 6
IPv6
Dual Stack
A station must run IPv4 and IPv6 simultaneously until all
the Internet uses IPv6.
Which version supposed to be used to send a packet will
be decided by DNS.
Tunneling
Two computers
p
using
g IPv6 want to communicate
And the packet must pass through a region that
uses IPv4.
Header Translation
The sender wants to use IPv6 but receiver does
not understand IPV6
In this case, tunneling will not work. Therefore
the header of the IPv6 packet is converted to an
IPv4 header.
Simplified forwarding module in classless address
Configuration for Example
Configuration for Example
R i table
Routing
bl for
f router R1
Hierarchical routing with ISPs
Advantage of Hierarchical routing