Title: ISAT224
1ISAT-224 Lecture 04 The Network Layer
2Network Layer The network layers purpose is
to get packets all the way from the source to
their destination. The data link layer is
concerned with moving data from one end of a wire
to another. The network layer has to worry about
hopping through multiple routers along the path.
3This implies that the network layer must have
some prior knowledge of the topology of the
communication subnet (other routers) so that it
can provide an appropriate path through it. It
must also choose paths to prevent overloading
communication lines.
4Services provided to the Transport Layer The
network layer provides services to the transport
layer at the network layer/transport layer
interface. This interface is often the boundary
of the subnet. The network layer must perform 3
goals
51) The services should be independent of the
networking technology. 2) The transport layer
should be shielded from the number, type, and
topology of the subnets present. 3) The network
addresses should use a uniform numbering plan,
even across LANs and WANs.
6To better present the material for the network
layer, we will divide the lecture into three
general areas 1) networking at the
workstation level 2) networking at the LAN
level 3) networking at the internet level
7Networking at the Workstation Level A
workstation utilizing the network layer is
primarily concerned with 1) an Internet
Protocol (IP) address 2) an Internet Protocol
Format a) IPv4 b) IPv6 3) a subnet
mask (LAN separator)
8IP Addresses An IP address is a 32-bit code.
The code is subdivided into 4 groups of 8 bits.
Each byte (8 bits) contains a unique number. Each
byte contains specific information regarding a
users location. (There are 4.3 billion possible
addresses). We are very concerned with the value
of each byte. In fact, it is desirable to express
each of these numbers in their decimal equivalent
forms (octets).
9Expressing the IP address as a series of
hexadecimal numbers ..... msb C0 A2 5A 01
lsb Each byte can be converted into decimal ...
192 168 90 1 An IP address separates
each number with a decimal point. The result is
called dotted decimal notation.
192.168.90.1 (This is an IP address)
10IPv4 Protocol
Figure 4.1
An IP datagram consists of a header and text. The
header has a fixed 20-byte part and an optional
variable-length part.
11Version field keeps track of the protocol used
to create the datagram. IHL field describes the
length of the header field, in 32-bit words.
Minimum value of 5. Maximum of 15. Type of
Service field allows host to tell the subnet
the types of delivery, accuracy, and reliability
it wants. ( Delay, Throughput, Reliability) Total
Length field includes everything in the
datagram. Both header and data. Maximum of 65,535
bytes.
12Identification field needed to allow a
destination to determine which datagram a newly
arrived fragment belongs to. All fragments of a
datagram contain the same identification
value. DF Dont Fragment. This orders routers
not to fragment the message, since the
destination is incapable of reassembling it. MF
More Fragments. Indicates that more fragments
are being transmitted after this. This bit is
zero for the final fragment.
13Fragment Offset tells where in the current
datagram this fragment belongs. Allows the
receiver to reassemble the entire datagram from
its parts. Time to Live field a counter used
to limit packet lifetimes. Allows for a maximum
lifetime of 255 hops. It is decremented by a
router after each hop. When it hits zero, the
packet is discarded and a warning is sent back to
the sender. Prevents datagrams from wandering
around the internet forever.
14Protocol field tells the network layer what to
do with the completely reassembled datagram.
Which transport process does this go to ? TCP or
UDP are possibilities. Header Checksum field
verifies the header only, not the frame data.
This can detect errors that sometimes occur due
to router problems. The header checksum is
recomputed after each hop. Source Destination
Address fields uses IP addresses, 32 bits (4
bytes) for each address.
15Options field shown below.
Figure 4.2
16IPv6 This is a newer version of IP which,
hopefully, will never run out of addresses.
Figure 4.3
17In IPv6, the dotted decimal addresses are
considerably longer. For example, 105.100.215.50.
255.255.255.255.0.0.32.136.150.5.255.255 (There
are 3.8x1038 possible IPv6 addresses.)
18Networking at the LAN Level IP addresses do not
have to be arbitrary numbers. Imagine 2 letters
with similar addresses Illinois, Chicago,
23rdStreet, Apt107 Illinois, Chicago, 23rdStreet,
Apt 112 You would expect both locations to be
relatively close together.
19Similarly, IP addresses can be assigned that
group similar networks together.
Fig 4.4
87.134.92.xxx Widget Inc, Accounting 87.134.93.x
xx Widget Inc, Sales 87.134.94.xxx Widget
Inc, Managers There are 768 possible addresses
here.
20IP addresses are purchased, leased, or assigned
by 2 methods 1) directly through a government
or international agency. 2) through an Internet
Service Provider (ISP), who has obtained their
set of IP addresses by method 1. This is the most
common method.
21IP Address Formats
Figure 4.5
Unique addresses are assigned by the Network
Information Center (NIC). These addresses are
usually written in dotted decimal notation.
22A class A network can actually assign addresses
0.0.0.0 to 126.255.255.255. The address
127.xxx.xxx.xxx are used for special purposes
such as local hosting or loopback
addressing. Every IP address is separated into a
network part and a host part.
23The chief difference between class A, B, C
networks is the relationship between the number
of possible hosts (users) and the possible number
of networks. This is indicated by the number of
bits allocated for the network address and the
number of bits allocated for the host address.
24A class A network (0 prefix) has 7 bits allocated
for the network address. There are 126 possible
class A networks. A class B network (10 prefix)
has 14 bits allocated for the network addresses.
There are 16,384 possible class B networks. A
class C network (110 prefix) has 21 bits
allocated for the network addresses. There are
2,097,152 possible class C network addresses.
25A class A network has 24 bits allocated to the
host address. There are 16,777,216 possible class
A host addresses. A class B network has 16 bits
allocated to the host address. There are 65,536
possible class B host addresses. A class C
network has 8 bits allocated to the host address.
There are 256 possible class C host
addresses. (Not all possible host addresses are
useable.)
26A network administrator typically acquires a
contiguous block of IP addresses. Generally,
there is a need (by the LAN administrator) for
only a few different network addresses, but many
host addresses.
27Figure 4.6
28Looking at the network addresses for figure 4.6,
it is plainly seen that all of the hosts have the
same 199.34.89 in their addresses. These numbers
represent the network address. The last octet
represents the host address. The NETWORK address
would therefore be written as 199.34.89.0 (note
the trailing zero). While it is visually simple
to separate the network host addresses in this
example, there is a software/hardware technique.
29Default Masking Masking is a simple (for a
computer) technique used to separate the network
host addresses from an entire IP address. The
process compares an IP address with a MASK, and
uses a logical AND comparison.
30An AND gate compares 2 single bits, and gives a
1 if both input bits are 1. Otherwise, the output
is zero (0).
Figure 4.7
31For a class A address, 8 bits represents the
network address, and 24 bits represents the host
address. A class A address of 83.115.24.171 would
look like the following dotted binary number
01010011.01110011.00011000.10101011 A default
mask for class A networks is 11111111.00000000.0
0000000.00000000 Now comes the AND operation...
3201010011.01110011.00011000.10101011 11111111.00000
000.00000000.00000000 01010011.00000000.00000000.0
0000000 Turning this back into dotted-decimal
notation gives is the network address
83.0.0.0 Similarly, we can write the default
mask we used in dotted-decimal notation
255.0.0.0
33A class B address of 137.96.117.211 contains 16
bits for the network address and 16 bits for the
host address. The network address is 137.96.0.0 .
The default mask necessary to obtain this is
255.255.0.0 . 10001001.01100000.01110101.11010011
11111111.11111111.00000000.00000000 10001001.01100
000.00000000.00000000 137.96.0.0
34A class C address of 233.9.52.116 contains 24
bits of network address and 8 bits of host
address. The network address is 233.9.52.0. The
default mask for class C networks is
255.255.255.0 . 11101001.00001001.00110100.0111010
0 11111111.11111111.11111111.00000000 11101001.000
01001.00110100.00000000 233.9.52.0
35There is a hidden implication to these network
addresses. Since 83.0.0.0 , 137.96.0.0 , and
233.9.52.0 represent NETWORK addresses (Network
IDs), they cannot be used as HOST addresses. This
means that the maximum number of possible hosts
for 233.9.52.0 is NOT 256 hosts, but must be no
more than 255 hosts.
36What if you wanted to send a message to all hosts
on the 233.9.52.0 network? By using 255 in the
last octet, a message would be sent to ALL hosts
on the 233.9.52.0 network. This means that there
are only 254 possible hosts available for the
233.9.52.0 network ID.
37Figure 4.8
38What happens when a router receives an IP packet
that is NOT addressed to it ? For example
233.9.52.0 is the network ID with default
mask 137.96.117.211 is the incoming
packet 10001001.01100000.01110101.11010011 1111111
1.11111111.11111111.00000000 10001001.01100000.011
10101.00000000 137.96.117.0 Since this does NOT
match the NID, its ignored.
39Virtual LANs Switching at the data link layer
required a switch (or bridge) to compare the MAC
address of an incoming frame to a list of
addresses in the switchs memory to determine the
switching path. For a small LAN, this is
perfectly acceptable. For a large LAN with
hundreds or even thousands of hosts, this method
is no longer practical (it takes too long).
40A layer 3 switch or router could forward packets
based upon the IP address. Since IP addresses are
assigned by an administrator, it should be
possible to group a series of host addresses
together to form a smaller subnetwork attached to
a larger network. This is a virtual LAN, or VLAN.
It is merely a subdivision of a larger LAN into
smaller LANs.
41There are several reasons why VLANs are often
created 1) to reduce traffic on a LANs
backbone 2) to separate traffic between
different departments 3) to separate areas that
have sensitive data from the rest of the
network The technique used to create a subnet is
called subnet masking.
42The basic principle behind subnet masking is to
take one or more bits that would normally belong
to a host address and assign them to the tail end
of the network address. A default class B network
has 16,384 possible networks, with 65,534
possible hosts per network. If you own a class B
network ID, you can subdivide it into smaller
networks, but at the expense of having fewer
hosts per subnet.
43Subnetting The first step required to create
subnets is to determine the number of subnets you
require. These fall into fixed amounts depending
on the network class. Once the number of required
subnets is determined, check that the number of
hosts per subnet is sufficient. Then choose the
appropriate subnet mask.
44Figure 4.9
45A class C network has a maximum of 254 hosts.
Each subnet created reduces the amount of
available hosts per subnet. Once the number of
required subnets is determined, check that the
number of hosts per subnet is sufficient. Then
choose the appropriate subnet mask.
46Figure 4.10
add missing zero (8 bits)
47If you do not happen to have the previous tables
handy, there is a simple method to determine the
subnet mask. 1) Determine if the NID is class A,
B, or C. 2) The location of the subnet octet is
A W.x.Y.Z B W.X.y.Z C W.X.Y.z
48 3) Write the number of subnets you desire as a
binary number. For example, 12 subnets becomes
1100 in binary. 4) Count the total number of
bits used for this number. ( 4 in this example )
5) The subnet mask contains this number of
leading 1s ( 4 in this case ) in the correct
octet location. For example (class
C) 11011000.1001010.00010110.11110000
49Example A local community college has acquired
a class C network address of 217.101.34.0 . The
network administrator desires to subdivide this
network into at least 8 subnets, shown in figure
4.11 . 1) Determine the necessary subnet mask.
50switch
host
Figure 4.11
51A binary 8 is 1000 which is a total of 4 bits.
The class C network ID is 217.101.34.0 . The
subnet mask contains 217.101.34.z, where the 4th
octet needs to be determined. In binary, the 4th
octet will be 11110000, which in decimal is 240.
The subnet mask is 217.101.34.240
52 2) Determine the HOST addresses that belong to
each subnet. We only need be concerned with the
octet that is being manipulated. For this
example, it is the 4th or final octet. Lets look
at the result of applying our subnet mask to a
variety of host addresses.
53 00000001 00000010 00000100 11110000
11110000 11110000 00000000 00000000
00000000 00001000 00010000 00100000
11110000 11110000 11110000 00000000
00010000 00100000
54In 4 of the 6 examples, the end result was the
network ID. In fact, there are 16 possible binary
numbers that when applied to the subnet mask will
ALWAYS result in the network ID which is not a
useable host address (last 4 bits) 0000
0001 0010 0011 0100 0101 0110 0111
1000 1001 1010 1011 1100 1101 1110
1111 (non-useable addresses)
55In decimal, the unusable range of host addresses
are 0 through 15.
56Similarly, there are several host addresses that
will end up with 00010000 when applied to the
subnet mask. Looking at only the last 5 bits
10000 10001 10010 10011 10100 10101 10110
10111 11000 11001 11010 11011 11100 11101
11110 11111 In decimal, these are 16 through
31. The first and last numbers are not useable.
There are 14 allowable numbers.
57In fact, a subnet mask with 4 ones can provide 16
possible outputs after masking. Considering ONLY
the 4 msbs
not valid
This leaves 14 possible subnets, each with 14
allowable addresses.
not valid
58(No Transcript)
59Since the first number and the last number in
each subnet is not useable, the host addresses
that belong to each subnet are shown in the
following table.
60Figure 4.12
61The switches (layer 3) act like filters, allowing
only the proper masked outputs to pass through
them.
62Figure 4.13
host 217.101.34.24 receives packet
switch passes packet if subnet mask output is
00010000 (subnet1)
63Example Knowing your network address of
192.168.90.36 and your subnet mask of
255.255.255.224 , find 1) your network class
2) your network ID 3) the size of your subnet
4) the range of your subnet addresses
64192 is network class C. Note that the last mask
octet is consistent with class C subnets. (Both
must be true for your subnet to work
properly). Therefore, your NID is 192.168.90.0 In
binary, the last octet of your subnet mask is
1110 0000 . Three mask bits are 1. The total
number of subnets can be determined by the
following equation 2N 2 23 2 8 2 6
subnets
65Your host address (last octet) of 36 can be
written in binary as 0010 0100 . When this is
applied to the subnet mask, the result is as
follows 0010 0100 1110 0000 0010 0000 32
in decimal This means the next allowable starting
address is 33.
66The next sequential mask output after 0010 0000
would be 0100 0000. Remember that the sequence
for the 3 mask bit outputs would be 001, 010,
011, 100, 101, 110. So, 0100 0000 is a decimal
64. The last useable address prior to this would
be 62. The useable size of your subnet is
(62-33)130 The range is 192.168.90.33 thru
62 .
67Networking at the Internet Level This section
is primarily concerned with routing packets over
long distances across multiple networks. The
network layer can provide connectionless service
or connection-oriented service. Packets of data
in a connectionless service are often called
datagrams.
68Physical circuits connect telephones. For
subnets, we do not have an actual hard-wired
pathway. Therefore, subnets are considered to be
connected together through a virtual
circuit. Virtual circuits in subnets are
usually concerned with connection-oriented
service.
69In a virtual circuit, a pathway is developed
between sender and receiver when a connection is
established. This pathway is used for all packets
between the two machines. When communication is
complete, the virtual circuit is terminated.
70For connectionless service, no routes are
developed in advance. A datagram subnet packet is
routed without any regard as to how the previous
packet was routed. Sequential packets may take
different routes to their destination. Datagram
subnets are less efficient, but extremely robust
and adaptable.
71If packets travel through a virtual circuit along
a known route, then each router along the path
must remember where to forward packets for every
currently open virtual circuit. When a network
connection is initiated, a virtual circuit number
not already in use on that machine is chosen as a
connection identifier. This identifier is only
valid locally. It is not a global identifier.
72For connectionless service (datagrams), routers
have a table containing information about which
outgoing line to use to reach each possible
destination router. Each datagram must contain
the full destination address. Routers compares
the destination to a table in order to send the
packet to the next router. A comparison between
datagram subnets and virtual circuit subnets are
shown in the following table.
73Figure 4.14
74Routing Principles Most packet transmissions
will require multiple hops across the subnet.
Routing algorithms fall into one of 2 categories
1) Nonadaptive algorithms (Static) 2)
Adaptive algorithms (Dynamic)
75Static routing computes the path between 2 points
in advance. All routers located within a network
are provided with this information when the
system is booted up. Dynamic routing changes the
routing paths due to constant testing of current
topology and traffic congestion. Routers obtain
their information by monitoring other nearby
routers.
76Distance Vector Routing Most networks use
adaptive (dynamic) routing methods. One of the
two most popular methods is distance vector
routing. In this method, each router maintains a
table (vector) giving the best-known distance to
each destination and which line to use to get
there. These tables are updated by exchanging
information with its neighbors. Each router
contains a routing table containing an entry for
every other router in the subnet.
77Each entry contains 1) the preferred outgoing
line to use for that destination 2) an
estimate of the time or distance to that
destination The distance is not really
distance. In this case, distance means the number
of hops.
78Once every so often, each router sends to each
neighbor a list of estimated delays to each
destination. It also receives similar lists from
its neighbors. The router then calculates the new
distance to each neighbor and update its routing
table accordingly. Two common distance vector
protocols are RIP and IGRP. RIP maintains a table
of routers that it can reach within 16 hops. RIP
sends its ENTIRE routing table to each of its
neighbors periodically so that its neighbors can
update their routing tables.
79- Link State Routing
- The other type of dynamic routing is link state
routing. Using this method, each router will - discover its neighbors network addresses
- measure the delay to each of its neighbors
- construct a packet containing this information
- send this packet to other routers
- compute the shortest path to each router
80Figure 4.15
When a router is booted, it first learns about
its neighbors by sending a special HELLO packet
on each point-to-point line. Other routers on the
line will respond by identifying themselves. The
router identifiers must be globally unique, just
like NIC MAC addresses.
81Measuring the line cost (delay) requires a
choice. Do you measure the delay when the line is
not busy ? Or do you measure the line when it is
heavily congested ? The first inclination is to
measure during congestion. After all, congestion
is a legitimate factor. Remember that the line
cost information will eventually end up in the
router tables. Consider the following subnet.
82Figure 4.16
Suppose the line from C to F is heavily
congested, but the line from E to I is lightly
trafficked. If the line cost includes congestion,
then all of the routers will update their tables
to favor path E to I. Suddenly, E to I will
become congested, while C to F will become
uncongested. This problem will repeat itself over
and over again.
83Once the neighbors are located and the line costs
have been calculated, the next step is for a
router to create a packet containing this
information. The packet begins with the identity
of the sender. It then adds a sequence number,
its age, a list of neighbors, and the delay to
each neighbor.
Figure 4.17
84One unanswered question is when to build these
link state packets. They are built periodically
(every 10 seconds), or after a major event has
occurred (a link goes down). The link packets
are then distributed by flooding. If a router
receives a link state packet, it checks the
sequence number. If the sequence number is higher
than the last sequence number from the sender,
the router keeps the packet and updates its
tables accordingly.
85If a router goes down or fails, when it is booted
up again its sequence number will start at zero.
When it floods its neighbors, the neighbors will
ignore it since the sequence number is lower than
the last one. To prevent this event from
happening, we must return to the age part of a
link state packet. When a packet is accepted by a
router, it is given an age (say 10 minutes).
After each minute, the age is decremented. When
the age reaches zero, the data in the table is
updated by the next packet, regardless of the
sequence number.
86Hierarchical Routing As networks grow, so does
the number of routers. And so also does the size
and complexity of routing tables. Eventually, it
is no longer practical for every router to have
an entry for every other router. Instead, a
router hierarchy can be developed. With
hierarchical routing, the routers are divided
into regions. Each router knows how to route
packets to every other router in its region. But
it knows nothing outside of its region.
87Figure 4.18
CONGESTION CONTROL
When too many packets are present on a part of
the subnet, congestion can occur. This severely
limits the amount of packets delivered.
88If a stream of packets suddenly arrives on
several input lines, and all need the same output
line, a queue will develop. If there is
insufficient memory, packets will be lost. If
more memory is added, the problem becomes worse.
The size of the queue increases, but eventually
transmitter machines timeout without receiving an
acknowledgement. The transmitters response to
timeouts is to send the packet again. The router
memory will then become clogged with multiple
copies of packets.
89Slow routers can also cause congestion. Queues
continue to get larger. Again we have time out
problems. Congestion control deals with ensuring
that the subnet is able to carry the desired
traffic. It is a global issue and involves ALL
hosts, routers, and store-and-forward processes
within routers. Flow control, however, is
primarily a data link issue. It is concerned with
point-to-point traffic between a given sender and
receiver. Flow control requires direct feedback
from the receiver. Congestion control does not.
90General Principles of Congestion Control There
are 2 approaches to congestion control 1) open
loop control (no feedback) 2) closed loop
control (feedback) Open loop control consists of
methods such as deciding which packets a router
accepts and which packets a router discards. The
current state of the network is not an issue for
open loop control.
91Closed loop control uses feedback. It is
therefore necessary to 1) monitor the subnet
and detect when congestion occurs. 2) pass this
information to places where action can be
taken 3) adjust system operation to correct the
problem
92One method for monitoring congestion is to
calculate the percentage of all packets that are
discarded due to lack of buffer memory space, or
the average queue length, or the number of
packets that timeout and are retransmitted, or
the average packet delay. If the capacity cannot
be increased by adding new lines, then the only
alternative to correct congestion is to decrease
the load by either denying access to some users
or by degrading service to some users.
93Policies that Affect Congestion
Figure 4.19
94Internetworking Devices 1) Hubs/Repeaters
amplify or regenerate weak signals. Used with
long-distance cables. 2)Bridges/Switches
store-and-forward forward devices. 3)
Multiprotocol routers found in the network
layer. Takes packets from one line and forward
them to another. Similar to bridges, except that
these routers can handle the multiple protocols
found on different networks. 4) Transport
gateway make a connection between to networks
at the transport layer.
95 5) Application gateway connect application
layers together.
Network Differences
Figure 4.20
96Connectionless Networking An alternative method
of networking is the datagram method (IP). Here,
the only service the network layer provides to
the transport layer is to inject datagrams into
the subnet and hope they get to their destination.
Figure 4.21
97The common thread for all internet networks is
the network layer protocol, Internet Protocol
(IP). This protocol was designed from the start
with the internet in mind. The purpose of IP is
to transport datagrams from source to
destination, regardless of any other networks
that lie in between. The process begins with the
transport layer taking a data stream and breaking
it up into datagrams up to 64 kb in size. Each
datagram is transmitted through the internet to
the destination. Then the datagrams are
reassembled and given to the transport layer.
98Packets can take any number of paths. Routers
along the way will forward packets in the general
direction of the receiver. There is no guarantee
that the packets will arrive in their correct
sequence. Since different networks have different
protocols, there will be different delay times
along different paths. An advantage of this
method is that no virtual circuit is required. It
can be used over subnets that do not use virtual
circuits, like mobile networks.
99Tunneling Although many different types of
networks and protocols can be found on an
internetwork, there is a common special case
where the source and destination are on similar
networks, but there is a different network in
between. Figure 4.22
100The sender constructs an IP packet to the
destination, containing the destinations
address. This packet is inserted into an Ethernet
frame addressed to a multiprotocol router. The
router removes the IP packet and inserts it into
the payload field for a WAN network layer packet.
The payload address field is the multiprotocol
router closest to the destination. This router
removed the IP packet from the payload, and then
sends it to the destination. The WAN acts like a
tunnel between points.
101Within each network an interior gateway protocol
is used. Between these networks, an exterior
gateway protocol is used. A typical internet
packet starts on a LAN addressed to the local
multiprotocol router (in the MAC layer header).
Then the network layer decides which
multiprotocol router to forward the packet, using
its own routing tables.
102If that router can be reached using the packets
original network protocol, it is immediately
forwarded there. Otherwise, the packet is
tunneled to its destination. If a packet is too
large for a particular gateway, it is chopped
into smaller fragments. It is reattached after it
travels through that gateway.
103The common thread for all internet networks is
the network layer protocol, Internet Protocol
(IP). This protocol was designed from the start
with the internet in mind. The purpose of IP is
to transport datagrams from source to
destination, regardless of any other networks
that lie in between. The process begins with the
transport layer taking a data stream and breaking
it up into datagrams up to 64 kb in size. Each
datagram is transmitted through the internet to
the destination. Then the datagrams are
reassembled and given to the transport layer.
104Read text chapters 6 7. Complete Quiz 3 Next
Lecture Transport Application
Layers After lecture 5, we will have covered
most of chapters 1-7, with parts of chapter 11.