8-Network Layer
8-Network Layer
Computer Networks
7. Network Layer :
Logical Addressing
Background
Switching
RQ 3
Switched Network
RQ 4
Circuit Switching
uses a dedicated set up (connection)
path between two takes time
stations inefficient
channel capacity
once connected, dedicated for
duration of
transfer is
connection
transparent if no data, capacity
wasted
RQ 5
Public Circuit Switched Network
RQ 6
Packet Switching
circuit switching was designed for voice
packet switching was designed for data
transmitted in small packets
packets contains user data and control info
user data may be part of a larger message
control info includes routing (addressing) info
Advantage: line efficiency
single link shared by many packets over time
RQ 7
Packet Switching
RQ 8
Switching Techniques
station breaks long message into
packets
packets sent one at a time to the
network
packets can be handled in two ways
virtual circuit
datagram
RQ 9
Virtual
Circuit
Approach
RQ 10
Datagram
Approach
RQ 11
Virtual Circuits vs. Datagram
virtual circuits
network can provide sequencing and error
control
packets are forwarded more quickly
less reliable
datagram
no call setup phase
more flexible
more reliable
RQ 12
Links
The physical and data link layers deliver
data within a network.
RQ 13
Network Layer
Network layer is responsible for host-to-host
delivery of data across networks
RQ 14
Network Layer
RQ 15
IPv4 Addresses
Network layer addressing
An Internet address or IP address
uniquely identifies a device connected
to the Internet at the network layer
IP = Internet Protocol
IP is the base protocol at network layer
in the Internet model or the TCP/IP
protocol suit
RQ 17
IPv4 address
An IPv4 address is a 32-bit address
The address space of IPv4 is 232 or
4,294,967,296.
Represented in 4 blocks of 1 byte each
RQ 18
Example
Change the following IPv4 addresses from binary
notation to dotted-decimal notation.
Solution
We replace each group of 8 bits with its equivalent
decimal number and add dots for separation.
RQ 19
Example
Change the following IPv4 addresses from dotted-
decimal notation to binary notation.
Solution
We replace each decimal number with its binary
equivalent.
RQ 20
Classful Addressing
In classful addressing, the address space
is divided into five classes:
A
B Unicast communication
C
D Multicast communication
E Reserved for special use
RQ 21
Network ID and Host ID
RQ 22
Finding the class in dotted-
decimal notation
RQ 23
Finding the class in binary
notation
RQ 24
Network Address
Anetwork address is different
Network address is an from a netid. A network
address that defines the address has both netid and
network itself; it cannot hostid, with 0s for the hostid.
be assigned to a host.
RQ 25
Mask
Although the length of the netid and hostid
(in bits) is predetermined in classful
addressing, we can also use a mask
The mask can help us to find the netid and
the hostid
RQ 26
Sample Internet
RQ 27
Subnetwork
Q. What if an organisation wants to
arrange its hosts into groups?
break its large network into smaller
networks?
RQ 28
Subnets and Subnet Masks
host portion of address partitioned into
subnet number and host number
local routers route within subnetted network
subnet mask indicates which bits are subnet
number and which are host number
RQ 29
Subnet Masks
Routers outside a subnetted
organisation use default masks
Routers inside the organisation use
subnet masks
RQ 30
Subnetworks
RQ 31
Supernetting
In supernetting several blocks of
addresses (networks) are combined to
create a supernetwork of large address
range
e.g. an organisation with 1000 computers
can be allocates four class C network
addresses to satisfy its needs
254 x 4 >1000
RQ 32
Classless Addressing
Problem with classful addresses
wastage due fix blocks of addresses
Solution: Classless addressing
Variable length address blocks
No classes
CIDR = Classless Inter-Domain Routing
Classful addressing is almost obsolete
and replaced with classless addressing.
RQ 33
Classless address blocks
An entity is granted a block (range) of addresses
The size of the block (the number of addresses)
varies based on the nature and size of the entity
Restrictions:
1. The addresses in a block must be contiguous, one
after another.
2. The number of addresses in a block must be a power
of 2 (1, 2, 4, 8, ... ).
3. The first address must be evenly divisible by the
number of addresses.
RQ 34
Mask in Classless Addressing
In IPv4 addressing, a block of addresses
can be defined as 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).
The first address in the block can be found
by setting the rightmost 32-n bits to 0s.
RQ 35
Subnetted
Network
RQ 36
Example 1
A block of addresses is granted to a small
organization. We know that one of the addresses is
205.16.37.39/28. What is the first address in the
block?
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 00100000
or
RQ 205.16.37.32. 37
Example 2
An ISP is granted a block of addresses starting with
190.100.0.0/16 The ISP needs to distribute these
addresses to three groups of customers as follows:
a) 1st group has 64 customers; each needs 256 addresses.
b) 2nd group has 128 customers; each needs 128 addrs.
c) 3rd group has 128 customers; each needs 64 addresses.
RQ 38
Example 2
RQ 39
Network Address Translation
IP addresses are scarce.
The long-term solution is for the whole
Internet to migrate to IPv6
128-bit addresses
The quick fix is NAT (Network Address
Translation)
described in RFC 3022
RQ 40
NAT – basic idea
Assign each company a single IP
address (or at most, a small number of
them) for Internet traffic.
Within the company, every computer
gets a unique IP address (private)
When a packet exits the company and
goes to the Internet, an address
translation takes place.
(private -> global)
RQ 41
Private addresses
12 bits in common
10101100 . 00010000 . 00000000 . 00000000 – 172.16.0.0
10101100 . 00011111 . 11111111 . 11111111 – 172.31.255.255
-------------------------------------------------------------
10101100 . 00010000 . 00000000 . 00000000 – 172.16.0.0/12
RQ 42
NAT
Private network uses private addresses
NAT router translates private addresses
to global address
The private network is transparent to
the rest of the Internet
RQ 43
Address Translation
RQ 44
Translation table
RQ 45
NAT
Using one IP address
1 private host can access an external host at a
time
Using a pool of IP addresses
N global addresses = N private hosts can access
same external host at a time
Using both IP addresses and port numbers
many private hosts can access many external
host at a time
RQ 46
PAT – Port Address Translation
NAT/PAT table
maintains translation
of:
DA, SA, SP
DA SA DP SP DA SA DP SP
DA SA DP SP DA SA DP SP
RQ 49
IPv6 Addresses
IPv6 Addresses
Despite all short-term solutions (e.g.
NAT/PAT), address depletion is still a
problem for the Internet.
This and other problems in the IP
protocol itself have been the
motivation for designing IPv6.
RQ 51
IPv6 Addresses
128 bits long
assigned to interface
single interface may have multiple unicast
addresses
three types of addresses:
unicast - single interface address
anycast - one of a set of interface addresses
multicast - all of a set of interfaces
RQ 52
IPv6 address structure
An IPv6 address is 128 bits long
It is usually presented in hexadecimal
colon notation
RQ 53
Abbreviated IPv6 addresses
RQ 54
Type prefixes for IPv6 addresses
RQ 55
Multicast address in IPv6
RQ 56
Reserved addresses in IPv6
RQ 57
Local addresses in IPv6
RQ 58