Data Communications: Network Layer
Data Communications: Network Layer
Network layer
Reference Books
• Data and Computer Communications by William
Stallings , Sixth Edition , Publisher Prentice Hall
• Data Communications and Networking by
Behrouz A Forouzan, Behrouz Forouzan, 4th
Edition
• Andrew S. Tanebaum, Computer networks 5th
Ed(2011), Prentice Hall
Topics
• What is an IP address ?
• Types of IP addressing
• Classes of IP address
• Networks & subnetworks
• IP addresses and routing
Network layer duties
• Internetworking
• Addressing
• Routing
• Packetizing
• Fragmenting
Figure 2.18 Relationship of layers and addresses in TCP/IP
2.5
Internet Addressing
• IPv4: is a 32-bit global internet address
• IPv6: is a 128-bit internet address, however it is not widely
implemented yet as IPv4. An IPv6 address consists of 128 bits
written in a hexadecimal notation and grouping 16 bits separated
by colons. 2001:db8::/32
• Includes network and host identifiers (unique &
universal)
• Dotted decimal notation
— 11000000 11100100 00010001 00111001 (binary)
— 192.228.17.57 (decimal)
6
Internet Addresses
• The Internet is quickly running out of addresses.
Although there are more than 4 billion possible
addresses, the fact that they are assigned in
sets (or groups) significantly restricts the
number of usable addresses.
• The IP address shortage was one of the reasons
behind the IPv6, providing in theory, 3.2 x 1038
possible addresses.
How to apply for IP address?
7
Addressing
• The network layer determines the best route through the network to
the final destination.
• Based on this routing, the network layer identifies the data link layer
address of the next computer to which the message should be sent.
• In general, the data link layer address is permanently encoded in
each network card, and as part of the hardware that cannot be
changed.
• Network layer addresses are generally assigned by software. Every
network layer software package usually has a configuration file that
specifies the network layer address for that computer.
• An address fulfills the functions of identifying the host and locating it
on the network.
Assigning Addresses
• Application layer addresses (or server
addresses) are also assigned by a software
configuration file. Virtually all servers have an
application layer address, but most client
computers do not.
• Network layer addresses and application layer
addresses go hand in hand.
(ruby.bus.utexas.edu - means 146.6.44.95 at
the network layer.)
Types of addresses
10
*How IP Addresses Distributed
11
IP Address Allocation
IANA
National
Regional
Consumer
12
Three RIRs
• American Registry for Internet Numbers (ARIN)
• Reseaux IP Europeen (RIPE)
• Asia Pacific Network Information Centre (APNIC)
13
Network Layer
• Concerned with getting packets from source to
destination.
• The network layer must know the topology of the
subnet and choose appropriate paths through it.
• When source and destination are in different
networks, the network layer (IP) must deal with
these differences.
* Key issue: what service does the network layer
provide to the transport layer (connection-
oriented or connectionless).
14
What is an IP address?
• What if the size of an IP datagram exceeds the MTU (maximum transmission unit)?
IP datagram is fragmented into smaller units.
Ethernet
FDDI
Ring
Host A Router Host B
MTUs: FDDI: 4352 Ethernet: 1500
• Fragmentation:
• IP router splits the datagram into several datagram
• Fragments are reassembled at receiver
17
Where is Fragmentation done?
Router
18
IP Service
• Consequences:
• Higher layer protocols have to deal with losses or with duplicate
packets
29
Classless addressing
• Although the long-range solution has already been
devised and is called IPv6 (discussed later), a short-term
solution was also devised to use the same address space
but to change the distribution of addresses to provide a
fair share to each organization.
• The short-term solution still uses IPv4 addresses, but it is
called classless addressing.
• In other words, the class privilege was removed from the
distribution to compensate for the address depletion.
Internet Service Provider
• An ISP is an organization that provides Internet access for
individuals, small businesses, and midsize organizations that do not
want to create an Internet site and become involved in providing
Internet services (such as electronic mail) for their employees.
• An ISP can provide these services.
• An ISP is granted a large range of addresses and then subdivides
the addresses (in groups of 1, 2, 4, 8, 16, and so on), giving a
range of addresses to a household or a small business.
• The customers are connected via a dial-up modem, DSL, or cable
modem to the ISP. However, each customer needs some IPv4
addresses.
Classless addressing
• Unlike classful addressing, the prefix length in classless addressing is
variable.
• We can have a prefix length that ranges from 0 to 32.
• The size of the network is inversely proportional to the length of the
prefix. A small prefix means a larger network; a large prefix means a
smaller network.
• We need to emphasize that the idea of classless addressing can be easily applied to
classful addressing. An address in class A can be thought of as a classless address in
which the prefix length is 8. An address in class B can be thought of as a classless
address in which the prefix is 16, and so on. In other words, classful addressing is a
special case of classless addressing.
Subnetting benefits
• The benefits of subnetting an existing network vary with each
deployment scenario.
• In the address allocation architecture of the Internet using
Classless Inter-Domain Routing (CIDR, pronounced
cider) and in large organizations, it is necessary to allocate address
space efficiently.
• It may also enhance routing efficiency, or have advantages in
network management when subnetworks are administratively
controlled by different entities in a larger organization.
• Subnets may be arranged logically in a hierarchical architecture,
partitioning an organization's network address space into a tree-
like routing structure.
CIDR notation
• CIDR (Classless Inter-Domain Routing)
• The net id may be expressed in CIDR notation
written as the first address of a network, followed
by a slash character (/), and ending with the bit-
length of the netid.
• Example, 192.168.1.0/24 is the net id of the IPv4
network starting at the given address, having 24
bits allocated for the network id, and the
remaining 8 bits reserved for host addressing.
Exctracting information from an address
Example
Address mask
Example 2
• The first address, the network address, is particularly important because it is used in
routing a packet to its destination network.
• The network address is actually the identifier of the network; each network is identified
by its network address.
Designing subnets
Example 3
Example 3 solution
IP addresses and routing
• routing tables
• Identifying source and destination
• IP packet routing
• Routing tables
—created by router, held in memory, constantly updated
• based on cross-referencing
—IP packet source address, and port on which received
Identifying source and destination
—as part of a layer 3 packet, IP header contains
source and destination address
—each address is 32 bits long, and unique to device or
port
—router reads destination IP address, checks against
routing tables
Default mask
49
why subnet
—reduce broadcast domain, improve network efficiency
—Subnet masks
– extend NETWORK portion, borrow from HOST portion
– allow external networks to route packets direct to subnet
Addresses with and without Subnetting
Figure 24-12
Masking
examples
Network Address Translation (NAT)
• a translation table has only two columns: the private address and
the external address (destination address of the packet).
• When the router translates the source address of the outgoing packet, it
also makes note of the destination address where the packet is going.
• When the response comes back from the destination, the router uses the
source address of the packet (as the external address) to find the private
address of the packet.
NAT
Routing
• there are several routes that a packet can travel from the source to the
destination; what must be determined is which route the packet should take.
• To find the best route, an internet can be modeled as a graph
• A graph in computer science is a set of nodes and edges (lines) that connect
the nodes.
• To model an internet as graph, we can think of each router as a node and
each network between a pair of routers as an edge. An internet is, in fact,
modeled as a weighted graph, in which each edge is associated with a cost.
• we assume that there is a cost associated with each edge.
Least cost routing
• In Least cost routing: the source router chooses a route
to the destination router in such a way that the total
cost for the route is the least cost among all possible
routes
Distance vector routing
Figure 21-14