0% found this document useful (0 votes)
2 views

Chapter_4 Network Layer-IP Datagram and Addressing Copy

The document discusses the network layer of the OSI model, focusing on the encapsulation of transport segments into datagrams and the role of routers in forwarding packets without maintaining state about end-to-end connections. It explains IP addressing, including the structure of IP datagrams, fragmentation, and the transition from classful to classless addressing (CIDR). Additionally, it covers how hosts obtain IP addresses through manual configuration or DHCP.

Uploaded by

najiwo70
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Chapter_4 Network Layer-IP Datagram and Addressing Copy

The document discusses the network layer of the OSI model, focusing on the encapsulation of transport segments into datagrams and the role of routers in forwarding packets without maintaining state about end-to-end connections. It explains IP addressing, including the structure of IP datagrams, fragmentation, and the transition from classful to classless addressing (CIDR). Additionally, it covers how hosts obtain IP addresses through manual configuration or DHCP.

Uploaded by

najiwo70
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Network layer

application

 transport segment from transport


network

sending to receiving host data link


physical
network network

 on sending side network


data link
data link
physical
data link
physical

encapsulates segments physical network


data link
network
data link

into datagrams physical physical

 on receiving side, delivers network


data link
network
data link

segments to transport we
physical physical
network
data link

layer network
physical
application
transport
 network layer protocols network
data link
physical
network
data link
network
data link

in every host, router data link


physical
physical physical

 router examines header


fields in all IP datagrams
‫يقوم جهاز التوجيه بفحص‬
‫حقول الرأس في جميع‬
‫ التي تمر‬IP ‫مخططات بيانات‬
passing through it ‫عبرها‬

Network Layer: Addressing 4-3


Packet (Datagram ( ‫÷ ال يوجد إعداد مكاملة في طبقة الشبكة‬

‫ ال توجد حالة حول االتصاالت من البداية إلى النهاية‬:‫÷ أجهزة التوجيه‬

‫• ال يوجد مفهوم "اتصال" على مستوى الشبكة‬

 no call setup at network layer ‫يتم إعادة توجيه الحزم باستخدام عنوان مضيف الوجهة‬

 routers: no state about end-to-end connections


 no network-level concept of “connection”
 packets forwarded using destination host address

application application
transport transport
network 1. send packets 2. receive packets network
data link data link
physical physical

Network Layer: Addressing 4-4


IP datagram format
IP protocol version 32 bits musise
number total datagram
length (bytes)
joint header length ver head. type of length
(bytes) len service for
“type” of data fragment fragmentation/
i.IE 16-bit identifier flgs
offset reassembly
max number time to upper header
sense
remaining hops live layer checksum
(decremented at
32 bit source IP address
each router)
32 bit destination IP address
upper layer protocol
c to deliver payload to options (if any) e.g. timestamp,
record route
how much overhead? data taken, specify
(variable length, list of routers
 20 bytes of TCP
typically a TCP to visit.
 20 bytes of IP
or UDP segment)
 = 40 bytes + app
layer overhead

Network Layer: Addressing 4-5


IP fragmentation, reassembly
- (‫ )الحد األقصى لحجم النقل‬MTU ‫تحتوي روابط الشبكة على‬

 network links have MTU


‫نك‬

‫أكبر إطار ممكن على مستوى االرتباط‬


(max.transfer size) -
5
1 largest possible link-level fragmentation:
frame


in: one large datagram
• different link types, out: 3 smaller datagrams
different MTUs
 large IP datagram divided
(“fragmented”) within net reassembly
• one datagram becomes
several datagrams
• “reassembled” only at …
final destination
• IP header bits used to
identify, order related
fragments
Network Layer: Addressing 4-6
IP addressing: introduction
223.1.1.1
 IP address: 32-bit 223.1.2.1
identifier for host, router
interface 223.1.1.2
223.1.1.4 223.1.2.9
 interface: connection
between host/router and
physical link 223.1.1.3 10 223.1.3.27 223.1.2.2
• router’s typically have pro
multiple interfaces
• host typically has one or
223.1.3.1 223.1.3.2
two interfaces (e.g., wired
Ethernet, wireless 802.11)
 IP addresses associated 8 8 8
with each interface 223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 1 1

Network Layer: Addressing 4-8


IP addressing: introduction
223.1.1.1
Q: how are interfaces 223.1.2.1
actually connected?
A: we’ll learn about that 223.1.1.2
223.1.1.4 223.1.2.9

in chapter 5, 6.
223.1.3.27
223.1.1.3
223.1.2.2

A: wired Ethernet interfaces


connected by Ethernet switches
223.1.3.1 223.1.3.2

39
A: wireless WiFi interfaces
connected by WiFi base station

Network Layer: Addressing 4-9


Notes

An IPv4 address is 32 bits long.

The IPv4 addresses are unique and


universal.

The address space of IPv4 is


232 or 4,294,967,296.

Network Layer: Addressing 4-10


Example 4.1

Change the following IPv4 addresses from binary


notation to dotted-decimal notation.
728643211 84 2 8 9 21
129 11 11

Solution
We replace each group of 8 bits with its equivalent
decimal number (see Appendix B) and add dots for
separation.

Network Layer: Addressing 4-12


Example 4.2

Find the error, if any, in the following IPv4 addresses.

Solution
a.There must be no leading zero (045)
b.There can be no more than four numbers.
c.Each number needs to be less than or equal to 255
d.A mixture of binary notation and dotted-decimal
notation is not allowed .
Network Layer: Addressing 4-13
Note

In classful addressing, the address


space is divided into five classes: A,
B, C, D, and E.

Network Layer: Addressing 4.14


Figure 4.2 Finding the classes in binary and dotted-decimal notation

Network Layer: Addressing 4.15


Example 2.4

Find the class of each address.


a. 00000001 11101111 00001011 00001011
b. 11000001 11111111 00011011 10000011
c. 14.23.120.8
d. 252.5.15.111

Solution
a.The first bit is 0 . This is a class A address.
b.The first 3 bits are 110 ;the class is C.
c.The first byte is 14 ;the class is A.
d.The first byte is 252 ; the class is E.

Network Layer: Addressing 2.16


Table 4.1 Number of blocks and block size in classful IPv4 addressing

Network Layer: Addressing 4.17


Example 4.4

Figure 4.3 shows a block of addresses, in both binary and


dotted-decimal notation, granted to a small business that
needs 16 addresses. IP 205.16.37.32

Figure 4.3 A block of 16 addresses granted to a smallorganization

Network Layer: Addressing 4.18


Table 4.2 Default masks for classful addressing

CIDR : Classless inter-domain routing

Network Layer: Addressing 4.19


Notes
e

In classful addressing, a large part of the


available addresses were wasted.

Classful addressing, which is almost


obsolete, is replaced with classless
addressing.

Network Layer: Addressing 4-20.


Notes
441 9124
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.

Network Layer: Addressing 4.21


Note

The first address in the block can be


found by setting the rightmost
− 32n bits to 0s.

The last address in the block can be


found by setting the rightmost
− 32n bits to 1s.
Network Layer: Addressing
4.22
Example 4.5

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 teg ew ,0
00100101 00010000 11001101 00100000
or .205.16.37.32
This is actually the block shown in Figure 4..3

Network Layer: Addressing 4.23


Example 4.6

Find the last address for the block in Example 4.5

Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 28 −32 rightmost bits to teg ew ,1
11001101 00010000 00100101 00101111
or 205.16.37.47
This is actually the block shown in Figure 4.3

Network Layer: Addressing 4..24


Note

The number of addresses in the block


can be found by using the formula
32 - n
2 .
0

Network Layer: Addressing 4. 25


Example 2.8

Find the number of addresses in Example 2.6.

Solution
The value of n is 28 , which means that
number of addresses is 232-28 = 16

Network Layer: Addressing 2.26


Figure 4.4 A network configuration for the block 205.16.37.32 /28

Network Layer: Addressing 4.27


Figure 4.5 Configuration and addresses in a subnetted network

Network Layer: Addressing 4.28


Subnets IP: 223.1.1.0

 IP address: 223.1.1.1
• subnet part - high order
bits 223.1.1.2 223.1.2.1
223.1.1.4 223.1.2.9
• host part - low order
bits 223.1.2.2
223.1.3.27
 what’s a subnet ? 223.1.1.3

• device interfaces with subnet


same subnet part of IP
223.1.3.2
address 223.1.3.1
• can physically reach
each other without
intervening router network consisting of 3 subnets

Network Layer: Addressing 4-29


Subnets IP: 223.1.1.0
Netmask: 11111111.11111111.11111111.00000000
SubNet Host
223.1.1.0/24
recipe 223.1.2.0/24
223.1.1.1
 to determine the
subnets, detach each 223.1.1.2 223.1.2.1
interface from its host 223.1.1.4 223.1.2.9
or router, creating 223.1.2.2
islands of isolated 223.1.1.3 223.1.3.27
networks subnet
 each isolated network
is called a subnet 223.1.3.1 223.1.3.2

223.1.3.0/24

Network Layer: Addressing 4-30


Subnets 223.1.1.2

how many? 223.1.1.1 223.1.1.4

223.1.1.3

223.1.9.2 223.1.7.0

223.1.9.1 223.1.7.1
223.1.8.1 223.1.8.0

223.1.2.6 223.1.3.27

223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2

Network Layer: Addressing 4-31


IP addressing: CIDR
CIDR: Classless InterDomain Routing
• subnet portion of address of arbitrary length
• address format: a.b.c.d/x, where x is # bits in
subnet portion of address

subnet host
part part
11001000 00010111 00010000 00000000

I
200.23.16.0/23

Network Layer: Addressing 4-32


IP addressing: CIDR

Network size ______________________Net Mask ‫____________قناع الشبكة‬


22= 4 ( 11111111.11111111.11111111.11111100) 255.255.255.252 /30
23= 8 ( 11111111.11111111.11111111.11111000) 255.255.255.248 /29
24= 16 ( 11111111.11111111.11111111.11110000) 255.255.255.240 /28
25= 32 ( 11111111.11111111.11111111.11100000) 255.255.255.224 /27
26= 64 ( 11111111.11111111.11111111.11000000) 255.255.255.192 /26
27= 128 ( 11111111.11111111.11111111.10000000) 255.255.255.128 /25
28 =256 ( 11111111.11111111.11111111.00000000) 255.255.255.0 /24
29= 512 ( 11111111.11111111.11111110.00000000) 255.255.254.0 /23
210= 1024 ( 11111111.11111111.11111100.00000000) 255.255.252.0 /22
211= 2048 ( 11111111.11111111.11111000.00000000) 255.255.248.0 /21
212= 4096 ( 11111111.11111111.11110000.00000000) 255.255.240.0 /20
..
.. Network Layer: Addressing 4-33
IP addresses: how to get one?
w

Q: How does a host get IP address?

 hard-coded by system admin in a file


• Windows: control-panel->network->configuration-
>tcp/ip->properties
• UNIX: /etc/rc.config
 DHCP: Dynamic Host Configuration Protocol:
dynamically get address from as server
• “plug-and-play”

Network Layer: Addressing 4-34

You might also like