Data Communications and Networking
Network Layer
Internet Protocol (IP) layer
Introduction
© Janice Regan, CMPT 128, 2007-2012
0
Communications Network: Facility that provides data transfer service between devices attached to the network
internet: Collection of communications networks interconnected by bridges, level 2 switches (bridges), level 3 switches (routers)
The Internet: The global collection of thousands of individual machines and networks
Intranet: Corporate internet operating within a single organization and using Internet (TCP/IP and http) technology to deliver documents and resources and sometimes connectivity to the Internet
© Janice Regan, 2007-2012
1
Supports end-user applications or services
Performs relaying and routing functions
Provides a communication path between end stations on the connected networks
2 © Janice Regan, 2007-2012
Repeater or Hub: physical/data link layer device
Provide no intelligent forwarding
Forward every frame (unicast, multicast, broadcast) out every port except the port it arrived on
Half duplex, may either transmit or receive
© Janice Regan, 2007-2012
3
Switch: An IS used to connect two LANs within the data link layer (layer 2) (cut through, store+forward)
both LANS are in the same broadcast domain. Forwards broadcast packets
When powered on acts like a hub. Then builds MACaddress (Ethernet address) forwarding tables by examining the source MAC address in each frame passing through the switch
Forwards based on destination MAC address.
Sends frames out through selected interfaces only
Does not modify the contents of the frames
© Janice Regan, 2007-2012
4
Router: An IS connecting two (possibly dissimilar) networks within the network layer (Layer 3)
Connects different broadcast domains. Does not forward broadcast packets
Uses internet protocol in each router and end system
Forwards based on IP destination address
Builds/updates forwarding tables based on information gathered using a routing protocol
Sometimes called a layer 3 switch
5
© Janice Regan, 2007-2012
A host is a source or destination of IP packets.
A host usually has 1 network interface (IPv4 address)
A host does not forward packets it receives from other hosts (act as a router)
Hosts must make some routing decisions
A host must decide which router, directly attached to their own network, to send a particular packet to
© Janice Regan, 2007-2012
6
A multi-homed host is a host connected to multiple networks. Each network is accessed using a different network interface
A multi homed host may forward packets.
Packets may arrive at one interface and leave by a different interface
A multi homed host may act as a (slow) router.
Forwarding must be enabled on a multi homed host if that multi homed host is to function as a router
7
© Janice Regan, 2007-2012
Provides linkage between networks
Provides routing and delivery of data between processes on different networks
Provides accounting services and maintains status information
Provides these services independent of individual network architectures, and must accommodate differences between networks
8
© Janice Regan, 2007-2012
Routing
Determining a path through the Internet through a series of hosts/routers to the destination
Addressing/ Forwarding
Sending packets along the determined path
Datagram lifetime
Removing packets that are ‘lost’ or ‘damaged’
Fragmentation and re-assembly
Dealing with networks having different maximum datagram sizes
9
© Janice Regan, 2007-2012
Two major components are required to determine a path through the internet
Routing: Building a forwarding table for each host and router. The entries in a forwarding table are determined statically (input by administrator) or dynamically based on time varying routing data sent from one router to another
Forwarding: Using the forwarding tables at a single router (IS) to determine packet’s next hop on its path toward the destination.
.
10
© Janice Regan, 2007-2012
An IP routing algorithm uses the information supplied by the routing protocol to build, and for dynamic routing update, the forwarding table at each router. The IP routing algorithm will run on each router to update (as necessary) the forwarding table on that router
An IP forwarding algorithm uses the information in the forwarding table to determine which interface of the router to transmit the IP packet through to efficiently deliver the packet to its destination (determines the direction of the best next hop)
© Janice Regan, 2007-2012
11
Routing protocols
specify how information about current conditions in the network will be transferred between routers (for the purpose of updating forwarding tables)
Specify how such information will be used to update the receiving routers forwarding table
For dynamic routing (changing over time)
Each router will receive information from other routers via the routing protocol
Each router will use the routing protocol to send information
(periodically and/or when the local conditions or the local forwarding table changes)
Each router will use the information supplied to it using the routing protocol to create / update it forwarding tables
12
© Janice Regan, 2007-2012
A router is a system that routes and forwards packets
normally has a processor, network interfaces and a high speed switching matrix will not normally be the source or destination of packets (except routing information packets transmitted using a dynamic routing protocol)
will forward packets using a forwarding (routing) table
For dynamic routing will regularly update the forwarding table
The processor of a router will normally run a protocol stack that includes the network layer and below
The network layer implements the routing protocol and the IP routing algorithm and the IP forwarding algorithm
13
© Janice Regan, 2007-2012
Direct delivery occurs when a datagram is delivered from one host to another on the same physical network.
It is not necessary for the packet to pass through a router
If the network specific portion of a packets destination IP address and source IP address are the same then the packet can usually be delivered directly
Direct delivery is also the last step of the delivery of any
IP datagram. Once the datagram has reached a router connected to the same physical network as the destination the datagram is encapsulated in a local data link layer packet and directly delivered
© Janice Regan, 2007-2012
14
If the final destination of the IP datagram is not on the local physical network
The datagram must be encapsulated in a link layer frame and sent to a router connected to the local physical network.
That router will extract the datagram from the link layer frame and use it routing capabilities to find another router on an efficient path to the final destination to send the datagram to.
The router then encapsulates the datagram in a link layer frame and transmits it to the next router.
This process continues until the packet reaches a router directly connected to the same local physical network as the destination host.
The datagram can then be directly delivered to the destination.
© Janice Regan, 2007-2012
15
host
NETWORK
Data link physical
NETWORK
Data link physical application transport
NETWORK
Data link physical application transport
NETWORK
Data link physical
Data link physical
NETWORK
Data link physical
Multi homed host (router) application transport
NETWORK
Data link physical router
NETWORK
Data link physical application transport
NETWORK
Data link physical
© Janice Regan, 2007-2012
16
application transport network
Data link
Physical
Network
Data link
Physical
Janice Regan © Sept. 2007-2013 application transport network
Data link
Physical
17
application transport network
Data link
Physical
Data link
Physical application transport network
Data link
Physical
Janice Regan © Sept. 2007-2013
18
Data is transferred in blocks called Protocol
Data Units (PDU)
Each PDU contains control information and sometimes data
Control Information includes
Address
Error Detection code (checksums)
Protocol Control
The addition of control information to data is referred to as Encapsulation
© Janice Regan, 2007-2012
19
application transport network
Data link
Physical
TCP/UDP
IP TCP/UDP
Ethernet IP TCP/UDP
Application data
Application data
Application data
Application data
TCP segment
IP datagram
Ethernet frame
Janice Regan © Sept. 2007-2013
20
If it has been determined that the datagram cannot be delivered directly then
If the datagram originates on the present host then choosing the next hop means choosing a router, attached to the same physical network as the host, that is an acceptable next hop in the path to the final destination
If the datagram has arrived at the router from another host or router then an efficient next hop in the path to the destination must be found
The next hop (for both cases) is determined by consulting a forwarding table. That table will indicate where a datagram destined for a particular IP address should be sent to reach that destination efficiently
© Janice Regan, 2007-2012
21
Each entry in the forwarding table includes
An address prefix (Destination) and mask (Genmask) which indicate a particular network or networks
The IP address of the next router or host along the path to the final destination (called the first hop router or gateway)
The network interface that should be used to transmit the packet so it can reach the next hop address
A metric that can be used to compare the relative
“goodness” of alternate routes.
Possible implementation specific additional information
© Janice Regan, 2007-2012
22
Destination
172.17.1.253
172.16.1.253
172.16.0.0
172.17.0.0
172.18.0.0
172.19.0.0
127.0.0.0
224.0.0.0
0.0.0.0
© Janice Regan, 2007-2012
*
*
Gateway
*
*
172.16.1.254
172.17.1.2
*
*
172.16.1.1
Genmask
255.255.255.255
255.255.255.255
255.255.0.0
255.255.0.0
255.255.0.0
255.255.0.0
255.0.0.0
240.0.0.0
0.0.0.0
1
1
0
0
0
0
0
Metric Iface
0 Eth1
0 Eth0
Eth0
Eth1
Eth0
Eth0
Lo
Eth0
Eth0
23
Extract the IP destination address from the packet
If the destination address is on the local network directly deliver the datagram
OTHERWISE
For each forwarding table entry check to see if the
IP destination address is part of the indicated network.
If it is send the packet through the interface for that network
If there is no match send a routing error back to the source and/or drop the packet
24
© Janice Regan, 2007-2012
Datagrams could loop indefinitely
Problems with routing or addressing can cause datagrams to travel in circles or on circuitous paths rather than reach their destination promptly
Consumes resources
Internet protocol may need upper bound on datagram life
Datagram marked with lifetime
Time To Live field in IP
Once lifetime expires, datagram discarded (not forwarded)
Hop count
Decrement time to live on passing through a each router
Time count
Need to know how long since last router
© Janice Regan, 2007-2012 25
Different packet sizes for different networks (can be set by administrator)
The data in the PDU must be broken into smaller pieces or fragmented if the PDU is too large for any network it passes through
Results in a possibility that packets get smaller as a datagram is transmitted from its source through the Internet to its destination
The data in the fragmented PDU is reassembled , usually at the receiver. Why not reassemble at IS?
Need large buffers at intermediate routers which may fill and overflow
All fragments must exit the network through same router. Places difficult to define constraints on an otherwise simple dynamic routing forwarding algorithm
© Janice Regan, 2007-2012
26
32 bit global internet (IP) address is used to uniquely identify a particular network interface connected to a particular host as a destination for communication
Each IP address is split into two parts (netid, hostid) to identify the host and the network to which the host is connected
The netid (network address or prefix) identifies the network to which the host belongs.
The hostid identifies the particular host (network interface for a multi homed host)
© Janice Regan, 2007-2012
27
Each Internet Protocol address (IP address) must be globally applicable and globally unique
Must have global nonambiguity, must uniquely identify the host and interface globally
Must have global applicablity , must be accessible via address from any other node on the Internet
IP addresses are used to route PDU from the destination through ISs to the destination.
Routes the PDU through the internet or
Internet.
© Janice Regan, 2007-2012
28
Unicast:
uses an address referring to a single system, sending only to that system
Broadcast:
Uses an address indicating all entities within a particular domain or network as recipients of the data
Multicast
uses an address that identifies multiple simultaneous recipients for data
© Janice Regan, 2007-2012
29
Advantages
Flexible and Robust(failure of single router does not cause failure of transmission as for connection orientented system)
Minimal overhead (no connection overhead)
Disadvantages
Delivery not guaranteed
Order of delivery not guaranteed
Reliability is responsibility of next layer up (e.g. TCP, transport layer)
Support for quality of service is difficult
increased probability of congestion
© Janice Regan, 2007-2012
30
Also need to consider connection management in a circuit switched or virtual circuit type network.
IP (not connection oriented) is not the only available protocol for the network layer. IP grew from the need to transfer information between computers, a task that does not require continuous transmission and is well suited to a datagram network model
Other network layer protocols like ATM, frame relay and X.25 originated in the world of telephony. They were originally designed to carry continuous voice transmission a task more suited to circuit switching or virtual circuit networks. These protocols are connection oriented (do not provide datagram service)
© Janice Regan, 2007-2012
31
Do NOT use IP or other connectionless network layer service
Have connections that are established within the network layer (not the transport layer) by the network layer protocol
Network layer connection oriented service is implemented both by edge systems and routers in the network core. (Not just the end systems as is transport layer connection oriented systems like TCP)
© Janice Regan, 2007-2012
32
Support for quality of service much easier
Delivery susceptible to failure of router in circuit
Path setup overhead
Reduced addressing overhead per connection , identifier shorter than full address but router table space needed for ever connection passing through the router
© Janice Regan, 2007-2012
33
IP best effort delivery
Other protocols: Network service model (may include)
Guaranteed delivery
Guaranteed delivery with bounded delay
In order delivery
Guaranteed minimum bandwidth
No packet lost, all packets arrive within a specified host to host delay IF transmission of data uses no more that the minimum bandwidth
Guaranteed maximum jitter
The time delay between packets at the destination will not vary from the time delay between packets at the source by more than the maximum value of jitter
© Janice Regan, 2007-2012
34