0% found this document useful (0 votes)
47 views48 pages

3.1 MAC Protocol

The document discusses MAC protocols for wireless sensor networks. It describes contention-based, scheduled-based, hybrid, and cross-layer MAC protocols. It provides examples of MAC protocols used in WSNs like SMAC, LEACH, and IEEE 802.15.4. It also discusses wormhole attacks against WSNs and countermeasures to detect such attacks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views48 pages

3.1 MAC Protocol

The document discusses MAC protocols for wireless sensor networks. It describes contention-based, scheduled-based, hybrid, and cross-layer MAC protocols. It provides examples of MAC protocols used in WSNs like SMAC, LEACH, and IEEE 802.15.4. It also discusses wormhole attacks against WSNs and countermeasures to detect such attacks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

MAC protocol for sensor

network
• In Wireless Sensor Networks (WSNs), the Medium Access Control
(MAC) protocol is a set of guidelines that dictate how each node
should transmit data over the shared wireless medium. The primary
objective of the MAC protocol is to minimize the occurrence of idle
listening, over-hearing, and collisions of data packets. By efficiently
managing access to the wireless medium, the MAC protocol helps to
reduce energy consumption and optimize the use of network
resources.
MAC Protocol Categories

• Contention based MAC


• Scheduled based MAC
• Hybrid MAC
• Cross-Layer MAC
Contention-based MAC
• Contention-based MAC protocol is also known as a random access
MAC protocol. It allows all nodes to transmit data on the shared
medium, but they have to compete with each other to access the
medium. One example of contention-based MAC is CSMA/CA.
• In CSMA/CA, each node senses the medium before transmitting the
data. If the medium is idle, the node can transmit data immediately.
However, if the channel is busy the node has to wait for a random
time also known as back-off time. This back-off time reduces the
chances of collisions.
Contention-based MAC Used in Wireless
Sensor Networks
• Sensor MAC (SMAC) is a contention-based MAC protocol that is
specifically designed for wireless sensor networks. The primary
objective of SMAC is to minimize idle listening, over-hearing, and
collisions of data packets. To achieve this goal, SMAC adopts a duty-
cycle approach, also known as a sleep-wakeup cycle. In this approach,
each node alternates between a fixed length of active and sleeping
periods based on its schedule.
• To prevent collisions among packets, SMAC utilizes the Request to
Send (RTS) and Clear to Send (CTS) packets before transmitting data
packets. This helps to ensure that only one node is transmitting data
at a time, reducing the likelihood of collisions and improving overall
network efficiency.
Scheduled-based MAC
• Scheduled-based MAC is also known as a deterministic MAC protocol.
Where each node follows a predetermined schedule and transmits
the data according to its given time slot. The data collision is
completely nullified in scheduled-based MAC. An example of
Scheduled based MAC is TDMA(Time Division Multiple Access).
• In TDMA the time is divided into fixed slots and each node is allocated
a specific time frame in which they can transmit the data. During this
time slot, other nodes remain silent.
Scheduled-based MAC Used in Wireless Sensor
Networks
• LEACH (Low Energy Adaptive Clustering Hierarchy) is a TDMA-based
protocol that utilizes a clustering mechanism in wireless sensor
networks. A cluster comprises sensor nodes grouped together, with
one node designated as the cluster head and the others serving as
members. The cluster head is selected based on a probabilistic
algorithm, which ensures that power consumption is evenly
distributed among the nodes.
• Once the cluster is formed, a schedule is created for nodes to
transmit data within the cluster. Additionally, to mitigate inter-cluster
interference, each cluster head assigns a unique CDMA code to its
cluster.
Hybrid MAC
• Hybrid MAC is a combination of different protocols such as contention-
based MAC and scheduled-based MAC to optimize the performance of
wireless sensor networks. For example, contention-based MAC protocols,
such as CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance),
allow nodes to access the medium based on a random backoff interval,
which reduces collisions but may result in inefficient utilization of the
medium. On the other hand, scheduled-based MAC protocols, such as
TDMA (Time Division Multiple Access), divide the medium into time slots
and assign them to different nodes, which can achieve high utilization but
may not be flexible enough to adapt to changing network conditions.
Hybrid MAC solved the issue by using other MAC protocols, During
transmission of data if the channel is idle or the channel has low traffic
then Hybrid MAC switches to contention-based MAC. If the traffic in the
channel increases then it is switched to scheduled-based MAC such as
TDMA.
Hybrid MAC Used in Wireless Sensor Networks
• The IEEE developed 802.15.4 as a standard for low-rate WPANs, which
outlines the PHY and MAC layers for low-power wireless communication in
the 2.4 GHz ISM band. It was specifically created for applications that
require low data rates, low power consumption, and cost-effectivenesses,
such as sensor networks, home automation, and industrial automation.
• The physical layer employs DSSS modulation with a data rate of 250 kbps
and works in the 2.4 GHz ISM band that has 16 channels with 5 MHz
bandwidth. Additionally, it uses FHSS to prevent interference from other
wireless devices.
• On the other hand, the media access control layer implements a CSMA-CA
protocol to avoid device collisions. It supports different data packet sizes,
ranging from 9 to 127 bytes, and also offers error detection and correction
mechanisms.
Cross-Layer MAC
• Cross-layer MAC allows the different layers in the protocol stack, typically
including physical, MAC, and network layers, to interact and share
information with one another. Firstly MAC layers gather information about
the state of the channel whether the channel is busy or not. This
information will be further used to control the other parameters such as
data transmission rate, packet loss rate, and delay.
• Once the parameters have been determined, the MAC layer sends the data
packets to the PHY layer for transmission over the wireless channel. After
the data transmission, the PHY layer sends feedback to the MAC layer
about the success or failure of the transmission. If the transmission was
unsuccessful. Based on the feedback MAC layer repeats the transmission
• Overall, the working of Cross-Layer MAC involves the interaction between
the MAC and PHY layers to improve the efficiency of data transmission and
energy consumption in WSNs. By optimizing the transmission parameters
Cross-Layer MAC Used in Wireless Sensor
Networks
• The IEEE 802.11e standard expands on the existing IEEE 802.11 WLAN
standard by incorporating Quality of Service (QoS) support. It utilizes
a cross-layer approach, allowing the MAC layer to collaborate with
higher layers such as the network and application layers, to provide
specific services based on the application’s needs.
• On the other hand, IEEE 802.16, or WiMAX, is intended for
broadband wireless access and utilizes a cross-layer design as well.
This design allows the MAC layer to communicate with the physical
layer to adjust to the changing channel conditions, such as
interference, noise, and fading.
Wormhole Attack in Wireless Sensor Networks
• This is a type of network layer attack which is carried out using more
than one malicious node. The nodes used to carry out this attack are
superior to normal nodes and are able to establish better
communication channels over long ranges. The idea behind this
attack is to forward the data from one compromised node to another
malicious node at the other end of the network through a tunnel. As
a result the other nodes in the WSN can be tricked into believing that
they are closer to other nodes than they really are which can cause
problems in the routing algorithm.Also the compromised nodes may
temper with the data packets.
Wormhole attack can be classified under 3
main categories:
1. Open Wormhole: In this case the data packets are first sent from
the source to a wormhole which tunnels them to the other
wormhole that transmits them to the destination.The other nodes
in the network are ignored and not used for data transfer.
2. Half-open Wormhole: In this case the data packets are sent from
the source to a wormhole which directly transmits them to the
destination.
3. Closed Wormhole: In this case the data packets are directly
transferred from the source to the destination in a single hop
making them fictitious neighbours.
Some countermeasures against wormhole
attacks are
• Watchdog Model: According to Watchdog model if some information
is to be transmitted from one node to another through a middle
node, then the sender node keeps a check on the middle node . If the
middle node fails to send the data packet in the set time limit then it
is declared as counterfeit and a new path is formulated to the
destination node. Although in this method the watchdog node is not
always accurate in detecting a wormhole and can be fooled easily if
the wormhole attack is combined with selective forwarding attack.
Probability of getting false positives is also pretty high here.
• Delphi Technique: In this method the delay per hop in a WSN is
calculated and it is obvious that tunnel path will be longer than the
normal path.So if delay per hop of any path is significantly greater
than the average then the network is considered to be under attack.
This method is not very successful if a large number of wormholes are
present in the WSN as with the increase in wormholes the overall
average of delay per hop will increase considerably.
• Wormhole Resistant Hybrid Technique: This model is a combination
of the Watchdog and the Delphi methods and overcomes their
limitations. This method keeps tabs on both, the data loss and the
delay per hop and is designed to detect every type of wormhole.
• Discovering Separate route Algorithm: This algorithm discovers
different paths between two nodes to identify a wormhole attack. It
finds all the single and double hop neighbors and also most of the
routes between nodes. So it is easily able to check if a node’s claim to
be the shortest path to the destination is true or not.
• Packet Leashes: Packet leashes prevent the long distance
transmission of packets. They are further divided as:
• (i) Geographical Leash – Makes sure that the data could not be transmitted
beyond a particular distance in a single hop.
• (ii) Temporal Leash – Sets a boundation to the total distance a data packet
can travel even with multiple hops.
Advantages:
• Fast transmission: Wormhole attacks can enable fast transmission of
data between distant nodes by creating a direct tunnel, bypassing
other nodes in the network.
• Energy efficient: Wormhole attacks can be energy-efficient as they
can reduce the number of nodes involved in the transmission of data,
leading to reduced energy consumption.
• Difficult to detect: Wormhole attacks can be difficult to detect as they
create a direct tunnel between two nodes, making it appear as if the
data is being transmitted through a legitimate route.
Disadvantages:
• Data integrity: Wormhole attacks can compromise the data integrity
of the network by allowing unauthorized access to sensitive data.
• Network partition: Wormhole attacks can lead to network partition
by creating a direct tunnel between two nodes, bypassing other
nodes in the network and isolating them.
• Security vulnerabilities: Wormhole attacks can expose the network to
other security threats such as eavesdropping, message alteration, and
node impersonation.
• Reduced network lifetime: Wormhole attacks can reduce the
network lifetime by causing some nodes to consume more energy
than others, leading to premature battery depletion and network
failure.
• Impact on network performance: Wormhole attacks can impact the
performance of the network by disrupting the flow of data and
causing delays, which can affect the overall network throughput.
Sinkhole Attack in Wireless Sensor Networks
• Sinkhole attacks are carried out by either hacking a node in the
network or introducing a fabricated node in the network.The
malicious node promotes itself as the shortest path to the base
station and tries to guide the traffic from other nodes towards itself.
This not only lures all the nodes near the sinkhole but also each and
every node closer to the base station than the sinkhole.The intruder
node or the sinkhole can then easily alter the data compromising the
security of the network. Sinkhole attack can be initiated from within
the network as well as from outside. In the first scenario the attacker
may use a bugged node to begin the intrusion and in the second case
the invader may form a direct path to the base station through it
tempting other nodes to send their traffic through it.
Anomaly Dependent:
• In Anomaly dependent intrusion prevention, the system activity is
observed and it is categorized as anomalous or normal. Here any type
of interference or invasion is considered as an anomalous activity. In
order to successfully identify attack traffic the system must initially be
trained to identify normal system activity. Mostly the anomaly
detection systems consists of a training stage where system is
configured to detect normal activity and a testing phase. The problem
with this technique is that it may not always be accurate in identifying
the sinkhole and can raise false alarms. Both statistical and rule based
techniques are a sub division of anomaly dependent approach.
Rule/Signature Based
• In this type of intrusion detection system certain rules are defined
which are to be followed by each node in the WSN. These rules are
laid out the basis of the style and manner in which the sinkhole
attacks are carried out. Nodes which are found violating the rules are
labeled as intruder nodes and hence are disbanded. Drawback of this
type of detection mechanism is that it is only able to detect already
registered attacks and is vulnerable to new attacks.
Statistical:
• This is another subset of the anomaly based detection technique.In
this method the info related to different tasks performed by the node
is recorded and analyzed . The info could be anything from CPU usage
to packet transfer between nodes. The intruder node is then found by
matching its behavior with the refe
• Hybrid: This approach is a combination of both anomaly and
signature based Intrusion Detection Systems and eliminates the
drawbacks of both of them. It is capable of catching even those
attacks whose signatures are not a part of the database. Also the
accuracy is improved considerably in contrast to the anomaly based
approach. rence data.
Key Management:
• This method is based on the principle of cryptography in which the
data transferred between nodes is encoded and can only be decoded
with the help of a key. Even a small change in the message can easily
be detected in this method. Nodes can conveniently verify the
legitimacy of the message and also ascertain if the data is sent from
the Base Station with the aid of the key.
• A Sinkhole Attack is a type of attack in Wireless Sensor Networks
(WSN) where a malicious node attracts traffic towards itself by
advertising itself as the shortest path to the sink node.
Here are some features, advantages, and
disadvantages of Sinkhole Attacks in WSN:
• Features:
• Sinkhole Attacks can be launched by a compromised node in the
WSN.
• The attacker node advertises itself as the shortest path to the sink
node, which causes legitimate nodes to route their traffic through the
attacker node.
• Once the traffic is routed through the attacker node, it can selectively
drop or modify the data packets to achieve its objective.
Advantages:
• Sinkhole Attacks can be used to steal sensitive information or disrupt the network
by dropping or modifying the data packets.
• The attacker node can remain undetected by routing the traffic through itself and
then forwarding it to the sink node.

• Disadvantages:
• Sinkhole Attacks can cause a significant amount of damage to the WSN by
disrupting the network, stealing information, or causing the nodes to fail.
• The attacker node may need to use a significant amount of energy to advertise
itself as the shortest path, which can cause it to be detected by the legitimate
nodes.
• The WSN can be protected from Sinkhole Attacks by using secure routing
protocols that authenticate the nodes and verify the path before forwarding the
traffic.
Wireless DOS Attack on WiFi
• Dos attack is a denial-of-service attack which affects the server or a
website via sending a request of traffic and making it unreachable or
unavailable.This article will help you to know the working of a dos
attack on a Wifi.
What does a DOS Attack do?
• A Dos attack means to shut down a computer or the whole network,
making it unreachable to its users. It is accomplished by sending a
huge request traffic, or by sending some data that make the server
crash. Attackers mainly target web servers like media companies, e-
commerce websites, banking, etc. Most of the time, a dos attack
doesn’t result in loss of data.
There are 3 types of Dos attacks
• 1. Application-layer flood: In this type of attack, an attacker sends a
large number of requests on a server, which results in server crashes
and slow speeds of the network. In Application-layer flood requests
may vary within the range of thousands in a second to million, which
consume huge resources until the server crash or is unreachable to
the user.
• 2. Distributed Denial of Services Attacks: There is not much
difference between a Dos and DDoS attack. In this attack, not only
one computer sends requests but several computers are engaged in
sending requests to a specific target, making it disabled. These
computers have been hacked earlier and can be controlled by the
attacker.
• 3. Unintended Denial of Service Attacks: This type of attack is
wicked, i.e they are not nefarious. In this attack, websites are
overwhelmingly flooded with legitimate traffic to their destination
where the server is brought down completely.
Collision Avoidance in wireless networks-

We take a close look at so-called WiFi which is also known as IEEE standard 802.11
• Consider the situation depicted in the figure, where each of the four nodes
is able to send and receive signals that reach just the nodes to its
immediate left and right. For example, B can exchange frames with A and C
but it cannot reach D, while C can reach B and D but not A. (A and D’s reach
is not shown in the figure.) Suppose both A and C want to communicate
with B and so they each send it a frame. A and C are unaware of each other
since their signals do not carry that far. These two frames collide with each
other at B, but unlike an Ethernet, neither A nor C is aware of this collision.
A and C are said to be hidden nodes with respect to each other. According
to Wikipedia, the hidden node problem can be defined as “In wireless
networking, the hidden node problem or hidden terminal problem occurs
when a node is visible to a wireless access point (AP), but not to other
nodes communicating with that AP.”
Collision cannot be detected in hidden node
problem
• This is because the nodes A and C are out of range of each other(and so
cannot detect a collision while transmitting). Thus, Carrier sense multiple
access with collision detection (CSMA/CD) does not work, and collisions
occur. The data received by the access point is corrupted due to the
collision. To overcome the hidden node problem, RTS/CTS handshaking
(IEEE 802.11 RTS/CTS) is implemented in addition to the Carrier sense
multiple access with collision avoidance (CSMA/CA) scheme. A related
problem, called the exposed node problem, occurs under the following
stated circumstances: Suppose B is sending to A (as in the above Figure).
Node C is aware of this communication because it hears B’s transmission. It
would be a mistake for C to conclude that it cannot transmit to anyone just
because it can hear B’s transmission.
• For example, suppose C wants to transmit to node D. This is not a problem since
C’s transmission to D will not interfere with A’s ability to receive from B. We
address these problems by an algorithm known as Multiple Access with Collision
Avoidance (MACA). The sender and receiver exchange frames with each other
before transmitting data. This informs all nearby nodes that a transmission is
about to begin. Sender transmits Request to Send (RTS) frame to receiver. The
receiver then replies with clear to send (CTS) frame back to the sender. Any node
that receives CTS frame knows that it is close to the receiver, therefore, cannot
transmit a frame. Any node that receives the RTS frame but not the CTS frame
knows that is not close to the receiver to interfere with it, So it is free to transmit
data. Reference – Wikipedia This article is contributed by Nikhil Ranjan 10 and
Palak Jain. If you like GeeksforGeeks and would like to contribute, you can also
write an article using write.geeksforgeeks.org or mail your article to review-
[email protected]. See your article appearing on the GeeksforGeeks main
page and help other Geeks. Please write comments if you find anything incorrect,
or if you want to share more information about the topic discussed above.
Features of collision avoidance in wireless
networks include:
• Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA): This is a
protocol used in wireless networks to prevent data collisions. CSMA/CA ensures
that a device checks for the presence of other signals before transmitting data,
thus reducing the risk of collisions.
• Clear Channel Assessment (CCA): CCA is a mechanism used to determine
whether a wireless channel is clear or busy before transmitting data. This feature
helps to avoid collisions by ensuring that a device does not transmit data when
the channel is already in use.
• Request to Send (RTS) and Clear to Send (CTS): RTS and CTS are signals that are
sent between devices to reserve a channel for data transmission. These signals
help to prevent collisions by ensuring that only one device transmits data at a
time.
• Collision Detection: In cases where collisions do occur, collision detection helps
to reduce their impact by allowing the devices to detect and retransmit the data.
Features of collision avoidance in wireless
networks include:
• Backoff Algorithm: Backoff algorithm is a feature that ensures that devices wait for a
random period before attempting to retransmit data in the event of a collision. This
feature helps to reduce the risk of multiple devices attempting to transmit data
simultaneously, which could result in further collisions.
• Quality of Service (QoS): QoS is a mechanism that prioritizes traffic based on its
importance or urgency. By assigning different levels of priority to different types of
traffic, QoS can help prevent collisions by ensuring that important traffic gets transmitted
first, reducing the risk of collisions with less important traffic.
• Fragmentation: Fragmentation is the process of breaking up large packets of data into
smaller fragments before transmitting them. This helps to prevent collisions by reducing
the amount of time that any one device is transmitting data, allowing other devices to
access the channel more frequently.
• Power Control: Power control is a feature that adjusts the power level of a wireless
device based on its distance from the access point. By reducing the power level of
devices that are close to the access point, power control can help prevent collisions by
reducing the risk of interference with other devices on the network
Advantages of collision avoidance in wireless
networks:
• Improved network efficiency: Collision avoidance helps to reduce the
risk of data collisions, which can cause network congestion and slow
down data transmission. By ensuring that devices transmit data one
at a time, collision avoidance helps to improve network efficiency.
• Reduced data errors: Data collisions can lead to data errors and
packet loss. Collision avoidance helps to reduce these errors by
ensuring that data is transmitted in a controlled manner.
• Better network throughput: By reducing the risk of data collisions,
collision avoidance helps to increase network throughput, allowing
more data to be transmitted in a shorter period of time.
Disadvantages of collision avoidance in
wireless networks:
• Increased latency: Collision avoidance protocols like CSMA/CA introduce latency
into the network, as devices have to wait for their turn to transmit data. This can
lead to slower data transmission and increased response times.
• Network overhead: Collision avoidance protocols require additional signaling
between devices, which can increase network overhead and reduce overall
network efficiency.
• Limited scalability: Collision avoidance protocols like CSMA/CA may not scale
well in larger networks with many devices. As the number of devices increases,
the likelihood of collisions also increases, leading to decreased network
efficiency.
• Complexity: Implementing collision avoidance protocols can be complex and
require additional hardware and software resources. This can make it more
challenging to manage and troubleshoot network issues.
Difference between Deadlock Prevention and
Deadlock Avoidance
• Deadlock Prevention :
Deadlock prevention means to block at least one of the four
conditions required for deadlock to occur. If we are able to block any
one of them then deadlock can be prevented.
• The four conditions which need to be blocked are:-
• Mutual Exclusion
• Hold and Wait
• No Preemption
• Circular Wait
• Spooling and non-blocking synchronization algorithms are used to
prevent the above conditions.In deadlock prevention all the requests
are granted in a finite amount of time.
• 2. Deadlock Avoidance :
In Deadlock avoidance we have to anticipate deadlock before it really
occurs and ensure that the system does not go in unsafe state.It is
possible to avoid deadlock if resources are allocated carefully. For
deadlock avoidance we use Banker’s and Safety algorithm for
resource allocation purpose. In deadlock avoidance the maximum
number of resources of each type that will be needed are stated at
the beginning of the process.
Deadlock Avoidance in Distributed System
• Deadlocks are the fundamental problems in distributed systems. A
Deadlock is a situation where a set of processes are blocked as each
process in a Distributed system is holding some resources and that
acquired resources are needed by some other processes. In this
situation, a cycle arrives at a deadlock.
• Conditions of deadlock: A process in distributed systems uses
different resources in the following way.

• Request
• Use
• Releases
• That means, a process requests the resource and uses it in its
execution and after execution, it releases the resource.
• Methods for Handling Deadlock :
• There are four methods for handling Deadlock:
• Deadlock Prevention
• Deadlock Avoidance
• Deadlock Detection
• Deadlock Recovery
• Deadlock Avoidance:
• In Deadlock Avoidance, the system will be checked if it is in a safe
state or an unsafe state. Safe state is ensured when the request for
the resource by the process is permitted when there is no deadlock
found in the system. If there is deadlock found then the system will
be in an unsafe state.
• To avoid deadlocks the process should inform the system that how
many resources that a process should request for its execution. To
make that happen we use Algorithm.
• Step 1: Work and finish the 2 vectors of size m & n. Initialize work
with available and finish[i] = false
for i=1 to n , m=>#resources and n=>#processes.
• Step 2: Find an i such that both (i) finish[i] = false (ii) need(i) <= work ,
if no such i exists then go to Step 4.
• Step 3: Work = work + allocation
finish[i] = true
go to Step 2.
• Step 4: if finish[i] = true for all i then the system is in a safe state.

You might also like