Sie sind auf Seite 1von 8

Internet Packets

Packets at the network layer level are called


datagrams
They are encapsulated in frames for delivery
across physical networks
Frames are packets at the data link layer
Datagrams are formed by header and payload
Datagrams can have different sizes
Header is fixed (20 bytes)
Data area can contain between 1 byte and 65 KB

CMPE 80N - Introduction to Networks and the Internet

Forwarding Datagrams
Header contains all information needed to deliver
datagrams to destination computer
Destination address
Source address
Identifier
Other delivery information
Router examines header of each datagram and
forwards datagram along path to destination

CMPE 80N - Introduction to Networks and the Internet

1
Networks and IP addressing
IP address: 223.1.1.1
Network part + Host part
223.1.1.2 223.1.2.1
Network: 223.1.1.4 223.1.2.9
Any host can physically 223.1.1.3 223.1.2.2
be reached by any other 223.1.3.27
host without intervening
router
223.1.3.1 223.1.3.2
All hosts in the same
network have the same
network number
network consisting of 3 IP networks
(for IP addresses starting with 223,
first 24 bits are network address)

CMPE 80N - Introduction to Networks and the Internet

Routing
Routing means finding a suitable path for a
packet from sender to destination
A possible route

Another possible route

CMPE 80N - Introduction to Networks and the Internet

2
Routing (contd)
A router must choose between two or more paths
that lead to the destination.
Choosing the shortest path
Typically, there are multiple hops to make the
journey
Unless the hosts are on the same network
The routing algorithm is the part of a network
layer software responsible
for deciding which output line a
packet should be transmitted on

CMPE 80N - Introduction to Networks and the Internet

Routing Table
Each router stores information about
forwarding in a routing table
Initialized at system initialization
Must be updated as network topology changes
A routing table contains a list of destination
networks and next hop for each destination
Note that a router has several IP addresses!
One IP address per interface

CMPE 80N - Introduction to Networks and the Internet

3
Routing Table (contd)
Each table contains information to deliver a packet
to the next hop
Each table entry has two parts
First part: Network segment (prefix) of IP address
of the packet destination
No need for the host segment (suffix)
Router only delivers across networks; each network
takes care of in-network delivery to host
Second part: IP address of next router interface
Specifies where the packet should go
If one more hop is needed, we write here the IP address of
the next router interface

CMPE 80N - Introduction to Networks and the Internet

Example of Routing Table


routing table in A
Dest. Net. next router Nhops
223.1.1 1
IP datagram: 223.1.2 223.1.1.4 2
223.1.3 223.1.1.4 2
misc source dest
fields IP addr IP addr data
A 223.1.1.1

datagram remains 223.1.2.1


223.1.1.2
unchanged, as it travels 223.1.1.4 223.1.2.9
source to destination B
223.1.2.2
223.1.1.3 223.1.3.27 E

223.1.3.1 223.1.3.2

CMPE 80N - Introduction to Networks and the Internet

4
Routing Example 1
misc Dest. Net. next router Nhops
fields 223.1.1.1 223.1.1.3 data
223.1.1 1
223.1.2 223.1.1.4 2
IP datagram from A,
223.1.3 223.1.1.4 2
addressed to B:
look up net. address of B
A 223.1.1.1
find B is on same net. as A 223.1.2.1
link layer will send datagram
directly to B inside link-layer frame 223.1.1.2
223.1.1.4 223.1.2.9
B and A are directly connected
B
223.1.2.2
223.1.1.3 223.1.3.27 E

223.1.3.1 223.1.3.2

CMPE 80N - Introduction to Networks and the Internet

Routing Example 2
misc Dest. Net. next router Nhops
fields 223.1.1.1 223.1.2.2 data
223.1.1 1
223.1.2 223.1.1.4 2
IP datagram from A,
223.1.3 223.1.1.4 2
addressed to E
look up network address of E
E on different network A 223.1.1.1

A, E not directly attached 223.1.2.1


routing table: next hop router to E 223.1.1.2
223.1.1.4 223.1.2.9
is 223.1.1.4
link layer sends datagram to B
223.1.2.2
router 223.1.1.4 inside link-layer 223.1.1.3
223.1.3.27
E
frame
223.1.3.1 223.1.3.2
datagram arrives at 223.1.1.4
continued..

CMPE 80N - Introduction to Networks and the Internet

5
Routing Example 2 (contd)
Dest. next
misc network router Nhops interface
fields 223.1.1.1 223.1.2.2 data
223.1.1 - 1 223.1.1.4
Arriving at 223.1.4, destined 223.1.2 - 1 223.1.2.9

for 223.1.2.2 223.1.3 - 1 223.1.3.27

look up network address of E


E on same network as routers A 223.1.1.1

interface 223.1.2.9 223.1.2.1


router, E directly attached 223.1.1.2
link layer sends datagram to 223.1.1.4 223.1.2.9

223.1.2.2 inside link-layer frame B 223.1.2.2


via interface 223.1.2.9 223.1.1.3 223.1.3.27 E
datagram arrives at 223.1.2.2!!!
223.1.3.1 223.1.3.2
(hooray!)

CMPE 80N - Introduction to Networks and the Internet

Internet Protocol (IP)


IP (Internet Protocol) is the network layer
protocol for the Internet
It is responsible for datagram routing
Important: each datagram is routed
independently!
Two different datagrams in the same connection
can take different routes!
This can determine different delay for different
packets within the same connection

CMPE 80N - Introduction to Networks and the Internet

6
IP (contd)
IP provides a best effort delivery mechanism
Does not guarantee to prevent duplicate
datagrams, delayed and out-of-order delivery,
corruption of data or datagram loss
Reliable delivery is provided by the transport
layer, not the network layer (IP)
Network layer (IP) can detect and report errors
without actually fixing them

CMPE 80N - Introduction to Networks and the Internet

Datagram Header Format


Header
Payload

CMPE 80N - Introduction to Networks and the Internet

7
Address Resolution
Remember, once a packet is in a network, the IP
address in the packet needs to be translated to a
MAC address
This is called address resolution
A host or a router uses address resolution only
when it needs to send a packet to another
computer (host or router) in the same network
A computer never resolves the address of a
computer that attaches to a remote network!

CMPE 80N - Introduction to Networks and the Internet

Das könnte Ihnen auch gefallen