-------------------------------------***-------------------------------------
Network simulation
Lecturer: Mrs. Nguyễn Minh Hương
CSMA/CA protocol in Wifi networks that working in
ad-hoc mode.
-----------------------------------------------------------------------------
Team members:
Trương Quang Huy BA12-087
Nguyễn Việt Anh BA12-009
Phạm Tùng Anh BA12-010
Lê Quang Huy 22BI13190
Nguyễn Khánh Duy BA12-063
Nguyễn Việt Nam BI11-197
Nguyễn Thành Trung BI11-274
Hanoi, April 8th 2024
Table of Contents
I. WiFi: 802.11 Wireless LANs ................................................................................................................................ 1
II. Protocol description and Ad-hoc mode ...................................................................................................... 1
1. Ad-hoc networks .................................................................................................................................................. 1
2. Carrier Sense Multiple Access with collision avoidance (CSMA/CA) protocol with
RTS/CTS in Ad-hoc mode. ........................................................................................................................................ 1
III. Scenario design ..................................................................................................................................................... 3
IV. Implementation..................................................................................................................................................... 3
V. Data collection and analysis ................................................................................................................................. 5
VI. Reference ............................................................................................................................................................... 9
I. WiFi: 802.11 Wireless LANs
- Pervasive in the workplace, the home, educational institutions, cafés,
airports, and street corners, wireless LANs are now one of the most
important access network technologies in the Internet today. Although
many technologies and standards for wireless LANs were developed in
the 1990s, one particular class of standards has clearly emerged as the
winner: the IEEE 802.11 wireless LAN, also known as WiFi. In this
section, we’ll take a close look at 802.11 wireless LANs, examining its
frame structure, its medium access protocol, and its internetworking of
802.11 LANs with wired Ethernet LANs. As summarized in the Figure
below, there are several 802.11 standards.
II. Protocol description and Ad-hoc mode
1. Ad-hoc networks
- IEEE 802.11 stations can group themselves together to form an ad hoc
net-work—a network with no central control and with no connections to
the “outside world.”
- The network is formed “on the fly,” by mobile devices that have found
themselves in proximity to each other, that have a need to communicate,
and that find no pre-existing network infrastructure in their location.
2. Carrier Sense Multiple Access with collision avoidance (CSMA/CA)
protocol with RTS/CTS in Ad-hoc mode.
- In the networking world, this is called carrier sensing—a node listens to
the channel before transmitting. If a frame from another node is currently
being transmitted into the channel, a node then waits until it detects no
transmissions for a short amount of time and then begins transmission.
- WiFi uses link-layer acknowledgments. (We’ll discuss right now)
- Suppose that we have 3 wireless stations to communicate together. H1
and H2 stations are within range of H0 stations and both have associated
with the H0. Because of fading, the signal ranges of wireless stations are
limited to the interiors of the circles shown below Figure, so H1 and H2
are hidden from each other.
Page | 1
- Also suppose H1 is transmitting a frame and halfway through H1’s
transmission, H2 wants to send a frame to H0. H2, not hearing the
transmission from [Link] H2 senses the channel idle, it firstly transmits
its frame after a short period of time known as the Distributed Inter-frame
Space (DIFS) frame.
- If H2 knows that H1 is
transmitting, it chooses a random
backoff value using binary
exponential backoff and counts
down this value after DIFS when
the channel is sensed idle. While
the channel is sensed busy, the
counter value remains [Link]
resolve Hidden Terminal
Problem, the IEEE 802.11
protocol allows a station to use a
short Request to Send (RTS)
control frame and a short Clear
to Send (CTS) control frame to
reserve access to the channel. H1
can first send an RTS frame to
H0 before sending the DATA,
indicating the total time required
to transmit the DATA frame and
the acknowledgment (ACK)
frame.
- When the H0 receives a frame that it waits a short period of time known
as the Short Inter-frame Spacing (SIFS), and responds by broadcasting a
CTS frame to both H1 and H2 This CTS serves two purposes: It gives the
Page | 2
sender explicit permission to send and also instructs H2 (or other stations)
not to send for the reserved duration.
- Now H1 can peacefully transmit its DATA frame to H0. When H0
receives H1 frame, it waits for SIFS and then sends back an ACK
[Link] the transmitting station does not receive an acknowledgment
within a given amount of time, it assumes that an error has occurred and
retransmits the frame, using the CSMA/CA protocol to access the
channel.(The Figure below depicts described protocol, H1 presents
Source, H0 presents Destination and H2 presents other nodes)
III. Scenario design
- We use the example that describes the IEEE 802.11 as the template to
design scenarios. Node 0 represents H1, node 1 represents H0 and node 2
represents node 2.
IV. Implementation
Page | 3
- Step 0 must be written firstly but we put it here to compare with Step 6.
For many wireless station, the RTS/CTS sequence is used only when the
frame is longer than the threshold. Line 106 said that if enableCtsRts =
true, it will enable CTS/RTS and set ctsThr (CTS threshold) = 100 bytes,
notice that in line 114, we set PacketSize = 1400 bytes (or DATA frame),
so the DATA frame is larger than CTS threshold => Enable RTS/CTS
scheme.
Page | 4
- We only show some key point of the program that impact directly on the
scenario, the rest of the program will be attached with the report.
V. Data collection and analysis
Scenario 1 (also the designed scenario above): There are 3 nodes in the
simulation. 2 nodes transmit to 1 node, creating 2 flows.
In a hidden station experiment with
RTS/CTS disabled, the data illustrates
there are approximately one-tenth of
transmitted packets received. We also see
there is a dramatic difference between
real throughput and expectation.
On the other hand, the situation improves
significantly with RTS/CTS, with 473 of
received packets over 803 transmitted
packets and 529 of received packets over
803 transmitted. Because we set the
wireless station to continuously send
packets after 0.1s, suppose a packet in
node 0 waits to be transmitted because of
the transmitting packet in node 2. If the
wait time is larger than 0.1s, that packet
will be discarded and a new packet in node 0 will be transmitted or still wail
because the channel is not idle. This is why we can not received all transmitted
packets even with RTS/CTS. In terms of throughput, although the real
throughput is not equal to expected throughput, it is still 4 to 5 times faster than
the real throughput when RTS/CTS is disabled.
Scenario 2: There are only 2 nodes generating 1 flow.
We can see that if only one
node transmits frames, almost
100% packets are received at
the destination node because no
collisions occur with or without
RTS/CTS. We also notice that
Page | 5
the real throughput is really close to the expected throughput.
Scenario 3: There are 30 nodes generating 29 flows to 1 node.
In contrast with Scenario 2, when RTS/CTS is disabled, the node with IP
address: [Link] cannot receive any packet from other 29 nodes because of
many factors, mainly due to collisions.
Page | 6
Similarly, when RTS/CTS is enabled,a total of 23613 of transmitted packets are
sent by other nodes to the channel but only 709 packets are received. The data
indicates that the destination only received 3.06% of transmitted packets.
Page | 7
Conclusion:
- The use of the RTS and CTS frames can improve performance and reduce
the collisions generated by the hidden station problem but can not
completely remove it.
- In networking world, especially in wireless communication,there are not
only hidden terminal problem causes packet loss, but also other factors
like path loss, network congestion, multipath propagation, Interference
from other sources.
Page | 8
VI. Reference
- [Link]
- [Link]
- Computer Networking: A Top-Down Approach 8th Edition by James
Kurose (Author), Keith Ross (Author)
- [Link]
- Andrew S. Tanenbaum - Computer Networks
Page | 9