You are on page 1of 26

CIS344 Computer Networks

Week 7
Lecture Outline
TCP/IP Network Layer
Delivery and Routing of IP Packets

Note: There will be a lot of material


presented on the whiteboard during this
lecture. If you miss class, you will need to
get notes from someone!
The TCP/IP Network Layer
Network Layer main goals:
Provides host-to-host delivery
Application (source computer to
destination computer)
Transport
Duties:
Network Addressing
Routing
Data Link
Packetizing
Physical Fragmenting
Network Layer - Connection
Network layer may utilize either connectionless
or connection-oriented services
Connection-oriented:
Network layer makes an initial connection with
network layer at remote site before sending
packets
After connection, packets are sent dependent
on one another (i.e. order matters).
Connectionless:
Each packet treated independently
Each packet may travel a different route to the
destination
Network Layer - Delivery
Direct Delivery
Destination is a host connected to the same
physical network as the source
How can we tell if delivery is direct?
Extract network address of destination packet (we
know how to do this )
If our netid = that netid, then it is the same network!
Mapping the IP address to the physical address:
Sender uses destination IP address to find the
destination physical address then passed on the
Data Link layer for delivery
Network Layer - Delivery

Direct Delivery
Network Layer - Delivery
Indirect Delivery
Destination is a host is NOT connected to the
same physical network as the source
Packet will jump from router to router until it
reaches the same physical network as the
destination computer then it proceeds with a
direct delivery
Sender uses destination IP address and routing
table to find IP address of the next router in
route to the final destination.
ARP protocol used to find physical address of the
next router
Network Layer - Delivery
Indirect Delivery
Network Layer Routing Methods
Routing requires a routing table to be
present at a router or host
Routing table
A table of routes to final destinations
Impractical for use on the internet (too many
entries in the table)
Size of routing table must be kept manageable
There are several techniques to do this
Next-Hop Routing
Routing table only holds the address of the next hop
(rather than the details of the complete route)
Network-Specific Routing
Treats all hosts connected to the same network as
one single entity
i.e. only one entry in routing table (identifying network
itself)
Host-Specific Routing
Inverse of network-
specific routing
destination host
address is given in the
routing table.
Network administrators
may force all packets to
go to a specific router
Maybe for security
reasons, or traffic
concerns
Default Routing
When multiple routers are in use, a default router may be set.
Example: If no entry for destination address in table, go to
router R2
Static vs. Dynamic Routing
Static Routing Table
Contains information entered manually
Dynamic Routing Table
Updated periodically using one of the dynamic
routing protocols (RIP, OSPF, or BGP)
Routing Table & Routing Module
For the following examples, we will use a
simplified routing module with the following
hierarchy in place:
Router must check for:
1. Direct Delivery
2. Host-Specific Delivery
3. Network-Specific Delivery
4. Default-Delivery
Routing Table & Routing Module
The module consults with routing table to find the
best route for the packet, then the packet is sent
along with the next-hop address to the fragmentation
module
Routing Table
Organized in hierarchical scheme
Usually 7 fields:
Mask mask applied to destination IP address to find
network or subnet address of the destination
Destination Address - either the destination host
address (netid and hostid) or destination network
address (only address of network, host id all zeros)
Next-hop Address Address of next-hop router to
which packet is delivered
Routing Table
(7 fields continued)
Flags on/off switches (presence/absence):
U The router is up and running.
G The destination is in another network.
H Host-specific address.
D Added by redirection.
M Modified by redirection.
Reference Count Number of users currently
using this route
Use Number of packets transmitted through
this router for the corresponding destination
Interface Name of the interface
Routing Module
Receives IP packet from IP processing module (we will
see later)
Pseudo-code for Routing Module:

1. For each entry in the routing table


1. Apply the mask to packet destination address
2. If (the result matches value in destination field)
1. If (the G flag is present)
1. Use the Next-hop entry in the table as next-hop
address
2. If (the G flag is missing)
1. Use packet destination address (direct delivery)
3. Send packet to fragmentation module with next-hop
address
4. Stop
2. If no match is found, send an ICMP error message
3. Stop
Example 4

Make the routing table for router R1 in the


following network:
Solution

Mask Destination Next Hop I.


255.255.0.0 134.18.0.0 -- m0
255.255.0.0 129.8.0.0 222.13.16.40 m1
255.255.255.0 220.3.6.0 222.13.16.40 m1
0.0.0.0 0.0.0.0 134.18.5.2 m0
Example 5
Make the routing table for router R1 in following
network:
Solution
Mask Destination Next Hop I.
255.255.255.0 200.8.4.0 ---- m2
-----------------------------------------------------------------------------
255.255.255.0 80.4.5.0 201.4.10.3 m1
or 200.8.4.12 or m2
------------------------------------------------------------------------------
255.255.255.0 80.4.6.0 201.4.10.3 m1
or 200.4.8.12 or m2
-------------------------------------------------------------------------------
0.0.0.0 0.0.0.0 ???????????? m0
Example 6

The routing table for router R1 is given below.


Draw its topology.
Mask Destination Next Hop I.
255.255.0.0 110.70.0.0 - m0
255.255.0.0 180.14.0.0 - m2
255.255.0.0 190.17.0.0 - m1
255.255.0.0 130.4.0.0 190.17.6.5 m1
255.255.0.0 140.6.0.0 180.14.2.5 m2
0.0.0.0 0.0.0.0 110.70.4.6 m0
Solution
Buatlah routing table untuk R4 !

You might also like