Datalinklayer Intro DLC
Datalinklayer Intro DLC
• The source and destination IP addresses define the two ends but
cannot define which links the datagram should pass through.
• The IP addresses in a datagram should not be changed. If the
destination IP address in a datagram changes, the packet never
reaches its destination;
• if the source IP address in a datagram changes, the destination host or
a router can never communicate with the source if a response needs
to be sent back or an error needs to be reported back to the source
• => we need another addressing mechanism in a connectionless
internetwork: the link-layer addresses of the two nodes.
• A link-layer address is sometimes called a link address, sometimes a
physical address, and sometimes a MAC address.
• Since a link is controlled at the data-link layer, the addresses need to belong
to the data-link layer.
• When a datagram passes from the network layer to the data-link layer, the
datagram will be encapsulated in a frame and two data-link addresses are
added to the frame header.
• These two addresses are changed every time the frame moves from one
link to another.
• three links and two routers and 2 hosts in the example Alice (source)
and Bob (destination)
• For each host, we have shown two addresses, the IP addresses (N)
and the link-layer addresses (L).
• Note that a router has as many pairs of addresses as the number of
links the router is connected to. We have shown three frames, one in
each link.
• Each frame carries the same datagram with the same source and
destination addresses (N1 and N8), but the link-layer addresses of the
frame change from link to link. In link 1, the link-layer addresses are
L1 and L2.
• In link 2, they are L4 and L5. In link 3, they are L7 and L8.
• Note that the IP addresses and the link-layer addresses are not in the
same order
• For IP addresses, the source address comes before the destination
address; for link-layer addresses, the destination address comes
before the source. Few queries ….
• If the IP address of a router does not appear in any datagram sent
from a source to a destination, why do we need to assign IP addresses
to routers? The answer is that in some protocols a router may act as a
sender or receiver of a datagram
• Why do we need more than one IP address in a router, one for each
interface?
• The answer is that an interface is a connection of a router to a link.
We will see that an IP address defines a point in the Internet at which
a device is connected.
• A router with n interfaces is connected to the Internet at n points.
This is the situation of a house at the corner of a street with two
gates; each gate has the address related to the corresponding street.
• How are the source and destination IP addresses in a packet
determined?
• The answer is that the host should know its own IP address, which
becomes the source IP address in the packet.,
• the application layer uses the services of DNS to find the destination
address of the packet and passes it to the network layer to be
inserted in the packet.
• Again, each hop (router or host) should know its own link-layer
address, as we discuss later in the chapter.
• The destination link-layer address is determined by using the Address
Resolution Protocol, which we discuss shortly.
• What is the size of link-layer addresses?
• The answer is that it depends on the protocol used by the link.
• Although we have only one IP protocol for the whole Internet, we
may be using different data-link protocols in different links.
• This means that we can define the size of the address when we
discuss different link-layer protocols.
Three Types of addresses
• Unicast Address
• Each host or each interface of a router is assigned a unicast address.
Unicasting means one-to-one communication. A frame with a unicast
address destination is destined only for one entity in the link.
A3:34:45:11:92:F1
• Multicast Address
• Some link-layer protocols define multicast addresses. Multicasting
means one-to-many communication. However, the jurisdiction is local
(inside the link). The second digit, however, needs to be an even
number in hexadecimal.
• A2:34:45:11:92:F1
• Broadcast Address
• Some link-layer protocols define a broadcast address.
• Broadcasting means one-to-all communication. A frame with a
destination broadcast address is sent to all entities in the link.
• Ethernet, are 48 bits, all 1s, that are presented as 12 hexadecimal
digits separated by colons.
• FF:FF:FF:FF:FF:FF
Address Resolution Protocol (ARP)
• Anytime a node has an IP datagram to send to another node in a link,
it has the IP address of the receiving node.
• The source host knows the IP address of the default router.
• Each router except the last one in the path gets the IP address of the
next router by using its forwarding table.
• The last router knows the IP address of the destination host.
• However, the IP address of the next node is not helpful in moving a
frame through a link; we need the link-layer address of the next node.
• This is the time when the Address Resolution Protocol (ARP) becomes
helpful.
• The ARP protocol is one of the auxiliary protocols defined in the
network layer,
• Anytime a host or a router needs to find the link-layer address of
another host or router in its network, it sends an ARP request packet.
• The packet includes the link-layer and IP addresses of the sender and
the IP address of the receiver.
• Because the sender does not know the link-layer address of the
receiver, the query is broadcast over the link using the link-layer
broadcast address, which we discuss for each protocol late
ARP operation
• Every host or router on the network receives and processes the ARP
request packet, but only the intended recipient recognizes its IP
address and sends back an ARP response packet.
• The response packet contains the recipient’s IP and link-layer
addresses. The packet is unicast directly to the node that sent the
request packet.
• In Figure 9.7a, the system on the left (A) has a packet that needs to be
delivered to another system (B) with IP address N2.
• System A needs to pass the packet to its data-link layer for the actual
delivery, but it does not know the physical address of the recipient.
• It uses the services of ARP by asking the ARP protocol to send a
broadcast ARP request packet to ask for the physical address of a
system with an IP address of N2.
• This packet is received by every system on the physical network, but only
system B will answer it, as shown in Figure 9.7b. System B sends an ARP reply
packet that includes its physical address. Now system A can send all the
packets it has for this destination using the physical address it received
12.
73
Figure 12.2 Taxonomy of multiple-access protocols discussed in this
chapter
12.
74
12-1 RANDOM ACCESS
In random access or contention methods, no station is
superior to another station and none is assigned the
control over another.
No station permits, or does not permit, another station
to send..
At each instance, a station that has data to send uses
a procedure defined by the protocol to make a
decision on whether or not to send.
Topics discussed in this section:
ALOHA
Carrier Sense Multiple Access
Carrier Sense Multiple Access with Collision Detection
Carrier Sense Multiple Access with Collision Avoidance
12.
75
Figure 12.3 Frames in a pure ALOHA
network
12.
76
Figure 12.4 Procedure for pure ALOHA
protocol
12.
77
Example
12.1
The stations on a wireless ALOHA network are a
maximum of 600 km apart. If we assume that signals
propagate at 3 × 108 m/s, we find
Tp = (600 × 105 ) / (3 × 108 ) = 2 ms.
Now we can find the value of TB for different values of K .
12.
78
Example 12.1
(continued)
b. For K = 2, the range is {0, 1, 2, 3}. This means that T B
can be 0, 2, 4, or 6 ms, based on the outcome of the
random variable.
12.
79
Vulnerable time
• Vulnerable time, the length of time in which there is a possibility of collision.
• We assume that the stations send fixed-length frames with each frame taking
Tfr seconds to send
• Figure 12.4 shows the vulnerable time for station B.
• Station B starts to send a frame at time t. Now imagine station A has started
to send its frame after t − Tfr. This leads to a collision between the frames
from station B and station A.
• On the other hand, suppose that station C starts to send a frame before time
t + Tfr. Here, there is also a collision between frames from station B and
station C.
• Looking at Figure 12.4, we see that the vulnerable time during which a
collision may occur in pure ALOHA is 2 times the frame transmission time
Figure 12.5 Vulnerable time for pure ALOHA
protocol
Tfr=each frame
takes Tfr sec
12.
81
• Let us call G the average number of frames generated by the system during one frame
transmission time.
• Then it can be proven that the average number of successfully transmitted frames for
pure ALOHA is S = G × e−2G.
• The maximum throughput Smax is 0.184, for G = 1/2. (We can find it by setting the
derivative of S with respect to G to 0;.)
• In other words, if one-half a frame is generated during one frame transmission time (one
frame during two frame transmission times), then 18.4 percent of these frames reach their
destination successfully.
• We expect G = 1/2 to produce the maximum throughput because the vulnerable time is 2
times the frame transmission time.
• Therefore, if a station generates only one frame in this vulnerable time (and no other
stations generate a frame during this time), the frame will reach its destination successfully
Note
12.84
Example
12.3
A pure ALOHA network transmits 200-bit frames on a
shared channel of 200 kbps. What is the throughput if the
system (all stations together) produces
a. 1000 frames per second b. 500 frames per second
c. 250 frames per second.
Solution
The frame transmission time is 200/200 kbps or 1 ms.
a. If the system creates 1000 frames per second, this is 1
frame per millisecond. The load is 1. In this case S =
G× e−2 G or S = 0.135 (13.5 percent). This means that
the throughput is 1000 × 0.135 = 135 frames. Only 135
frames out of 1000 will probably survive.
12.85
Example 12.3
(continued)
b. If the system creates 500 frames per second, this is
(1/2) frame per millisecond. The load is (1/2). In this
case S = G × e −2G or S = 0.184 (18.4 percent). This
means that the throughput is 500 × 0.184 = 92 and that
only 92 frames out of 500 will probably survive. Note
that this is the maximum throughput case,
percentagewise.
12.89
Note
12.90
Figure 12.7 Vulnerable time for slotted ALOHA
protocol
12.91
Example
12.4
A slotted ALOHA network transmits 200-bit frames on a
shared channel of 200 kbps. What is the throughput if the
system (all stations together) produces
a. 1000 frames per second b. 500 frames per second
c. 250 frames per second.
Solution
The frame transmission time is 200/200 kbps or 1 ms.
a. If the system creates 1000 frames per second, this is 1
frame per millisecond. The load is 1. In this case S =
G× e−G or S = 0.368 (36.8 percent). This means that the
throughput is 1000 × 0.0368 = 368 frames. Only 386
frames out of 1000 will probably survive.
12.92
Example 12.4
(continued)
b. If the system creates 500 frames per second, this is
(1/2) frame per millisecond. The load is (1/2). In this
case S = G × e−G or S = 0.303 (30.3 percent). This
means that the throughput is 500 × 0.0303 = 151. Only
151 frames out of 500 will probably survive.
12.93
Carrier Sense Multiple Access
12.96
• At time t1, station B senses the medium and finds it idle, so it sends a
frame.
• At time t2 (t2 > t1), station C senses the medium and finds it idle
because, at this time, the first bits from station B have not reached
station C.
• Station C also sends a frame. The two signals collide and both frames
are destroyed
• The vulnerable time for CSMA is the propagation time Tp.
• This is the time needed for a signal to propagate from one end of the
medium to the other.
• When a station sends a frame and any other station tries to send a frame
during this time, a collision will result.
• But if the first bit of the frame reaches the end of the medium, every
station will already have heard the bit and will refrain from sending.
• Figure 12.8 shows the worst case. The leftmost station, A, sends a frame
at time t1, which reaches the rightmost station, D, at time t1 + Tp.
• The gray area shows the vulnerable area in time and space.
Figure 12.8 Vulnerable time in CSMA is the propogation time Tp
12.99
What should a station do if the channel is busy
or Idle
solution
persistence methods
Figure 12.9 and 12.10 Behavior of three
persistence methods
12.101
Flow diagram for three persistence methods
12.102
• The p-persistent method is used if the channel has time slots with a
slot duration equal to or greater than the maximum propagation time.
• The p-persistent approach combines the advantages of the other two
strategies.
• 1. With probability p, the station sends its frame.
• 2. With probability q = 1 − p, the station waits for the beginning of the
next time slot and checks the line again.
• a. If the line is idle, it goes to step 1.
• b. If the line is busy, it acts as though a collision has occurred and uses the
backoff procedure
CSMA/CD
• The CSMA method does not specify the procedure following a
collision. Carrier sense multiple access with collision detection
(CSMA/CD) augments the algorithm to handle the collision.
• In this method, a station monitors the medium after it sends a frame
to see if the transmission was successful.
• If so, the station is finished. If, however, there is a collision, the frame
is sent again
Figure 12.12 Collision of the first bit in
CSMA/CD
12.105
• To better understand CSMA/CD, let us look at the first bits transmitted
by the two stations involved in the collision.
• Although each station continues to send bits in the frame until it
detects the collision, we show what happens as the first bits collide.
• In Figure 12.11, stations A and C are involved in the collision.
• At time t1, station A has executed its persistence procedure and starts
sending the bits of its frame. At time t2, station C has not yet sensed
the first bit sent by A.
Figure 12.13 Collision and abortion in CSMA/CD
12.108
• Station C executes its persistence procedure and starts sending the
bits in its frame, which propagate both to the left and to the right.
• The collision occurs sometime after time t2. Station C detects a
collision at time t3 when it receives the first bit of A’s frame.
• Station C immediately (or after a short time, but we assume
immediately) aborts transmission.
• Station A detects collision at time t4 when it receives the first bit of
C’s frame; it also immediately aborts transmission.
• Looking at the figure, we see that A transmits for the duration t4 − t1;
C transmits for the duration t3 − t2.
Minimum frame size
• For CSMA/CD to work we need restriction on the frame size.
• Minumum frame size 2Tp
• If the 2 stations involved in a collision are maximum distance apart
the signal from the first takes time Tp to reach the second , and the
effect of the collision takes another time Tp to reach the first.
• For CSMA/CD to work, we need a restriction on the frame size. Before sending the
last bit of the frame, the sending station must detect a collision, if any, and abort
the transmission.
• This is so because the station, once the entire frame is sent, does not keep a copy
of the frame and does not monitor the line for collision detection.
• Therefore, the frame transmission time Tfr must be at least two times the
maximum propagation time Tp. To understand the reason, let us think about the
worst-case scenario.
• If the two stations involved in a collision are the maximum distance apart, the
signal from the first takes time Tp to reach the second, and the effect of the
collision takes another time TP to reach the first.
• So the requirement is that the first station must still be transmitting after 2Tp.
Example
12.5
A network using CSMA/CD has a bandwidth of 10 Mbps.
If the maximum propagation time (including the delays
in the devices and ignoring the time needed to send a
jamming signal, as we see later) is 25 6 μs, what is the
minimum size of the frame?
Solution
The frame transmission time is Tfr = 2 × Tp = 51.2 μs.
This means, in the worst case, a station needs to transmit
for a period of 51.2 μs to detect the collision. The
minimum size of the frame is 10 Mbps × 51.2 μs = 512
bits or 64 bytes. This is actually the minimum size of the
frame for Standard Ethernet.
12.112
Figure 12.14 Flow diagram for the
CSMA/CD
12.113
Figure 12.15 Energy level during transmission, idleness, or
collision
12.114
Carrier Sense Multiple Access with Collision
Avoidance(CSMA/CA)
IFS allows the front of the transmitted signal by the distant station to reach this station
Contention window is an amount of time divided into slots.
12.116
Note
12.117
Note
12.118
Figure 12.17 Flow diagram for
CSMA/CA
12.119
• Interframe Space (IFS). First, collisions are avoided by deferring
transmission even if the channel is found idle.
• When an idle channel is found, the station does not send
immediately.
• It waits for a period of time called the interframe space or IFS.
• Even though the channel may appear idle when it is sensed, a distant
station may have already started transmitting
• Contention Window. The contention window is an amount of time
divided into slots.
• A station that is ready to send chooses a random number of slots as
its wait time.
• The number of slots in the window changes according to the binary
exponential backoff strategy.
• This means that it is set to one slot the first time and then doubles
each time the station cannot detect an idle channel after the IFS time.
• This is very similar to the p-persistent method except that a random
outcome defines the number of slots taken by the waiting station
• Acknowledgment. With all these precautions, there still may be a
collision resulting in destroyed data.
• In addition, the data may be corrupted during the transmission.
• The positive acknowledgment and the time-out timer can help
guarantee that the receiver has received the frame.
• Frame Exchange Time Line Figure 12.17 shows the exchange of data
and control frames in time.
• 1. Before sending a frame, the source station senses the medium by
checking the energy level at the carrier frequency.
• a. The channel uses a persistence strategy with backoff until the channel is
idle.
• b. After the station is found to be idle, the station waits for a period of time
called the DCF interframe space (DIFS); then the station sends a control frame
called the request to send (RTS).
• 2. After receiving the RTS and waiting a period of time called the short
interframe space (SIFS), the destination station sends a control frame,
called the clear to send (CTS), to the source station. This control frame
indicates that the destination station is ready to receive data.
• 3. The source station sends data after waiting an amount of time
equal to SIFS.
• 4. The destination station, after waiting an amount of time equal to
SIFS, sends an acknowledgment to show that the frame has been
received.
• Acknowledgment is needed in this protocol because the station does
not have any means to check for the successful arrival of its data at
the destination.
• On the other hand, the lack of collision in CSMA/CD is a kind of
indication to the source that data have arrived.
Network Allocation Vector
• How do other stations defer sending their data if one station acquires
access? In other words, how is the collision avoidance aspect of this
protocol accomplished? The key is a feature called NAV.
• When a station sends an RTS frame, it includes the duration of time that
it needs to occupy the channel.
• The stations that are affected by this transmission create a timer called a
network allocation vector (NAV) that shows how much time must pass
before these stations are allowed to check the channel for idleness.
• Each time a station accesses the system and sends an RTS frame, other
stations start their NAV
• Collision During Handshaking What happens if there is a collision
during the time when RTS or CTS control frames are in transition,
often called the handshaking period? Two or more stations may try to
send RTS frames at the same time.
• These control frames may collide. However, because there is no
mechanism for collision detection, the sender assumes there has
been a collision if it has not received a CTS frame from the receiver.
• The backoff strategy is employed, and the sender tries again
• Hidden-Station Problem
• The solution to the hidden station problem is the use of the
handshake frames (RTS and CTS). Figure 12.17 also shows that the RTS
message from A reaches B, but not C.
• However, because both B and C are within the range of A, the CTS
message, which contains the duration of data transmission from B to
A, reaches C.
• Station C knows that some hidden station is using the channel and
refrains from transmitting until that duration is over.
• CSMA/CA and Wireless Networks CSMA/CA was mostly intended for
use in wireless networks.
• The procedure described above, however, is not sophisticated enough
to handle some particular issues related to wireless networks, such as
hidden terminals or exposed terminals.
• We will see how these issues are solved by augmenting the above
protocol with handshaking features.
Difference Between LAN and WLAN
LAN WLAN
LAN stands for Local Area Network. WLAN stands for Wireless Local Area Network.
LAN connections include both wired and wireless connections. WLAN connections are completely wireless.
LAN network is a collection of computers or other such network devices WLAN network is a collection of computers or other such network
in a particular location that are connected together by communication devices in a particular location that are connected together wirelessly by
elements or network elements. communication elements or network elements.
LAN is free from external attacks like interruption of signals, cyber
Whereas, WLAN is vulnerable to external attacks.
criminal attacks and so on.
LAN is secure. WLAN is not secure.
LAN network has lost its popularity due to the arrival of latest wireless
WLAN is popular.
networks.
Wired LAN needs physical access like connecting the wires to the
Work on connecting wires to the switches and routers are neglected.
switches or routers.
In LAN, devices are connected locally with Ethernet cable. For WLAN Ethernet cable is not necessary.
Mobility limited. Outstanding mobility.
It may or may not vary with external factors like environment and quality It varies due to external factors like environment and quality of cables.
of cables. Most of the external factors affect the signal transmission.
LAN is less expensive. WLAN is more expensive.
Example: Laptops, cellphones, tablets connected to a wireless router or
Example: Computers connected in a college.
hotspot.