\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc} \usepackage[margin=2cm]{geometry}
\usepackage{amstext} \usepackage{amsmath} \usepackage{array}
\newcommand{\lra}{\Leftrightarrow}

\title{Howework 3 -- Computer Networking}

\author{Claudio Maggioni}

\begin{document} \maketitle
\section*{Exercise 1}
The EUI-48 MAC address space can have $2^{48} = 281474976710656$ possible addresses. The IPv4 address space has $2^32 = 4294967296$
addresses while IPv6 has = $2^{128} \approx 3,402823669209385 \cdot 10^{38}$ addresses. In practice, some of the addresses in
 these spaces may be reserved for special purposes (e.g.
  \texttt{FF:FF:FF:FF:FF:FF} as the broadcast MAC address or the
   \texttt{127.0.0.0/8} subnet reserved for loopback networks 
    in IPv4) so the number of usable addresses is smaller than
     these figures.

\section*{Exercise 2}
$$D = 1010100000_2 = 512_{10} + 128_{10} + 32_{10} = 672_{10}$$
$$G = 10011_2 = 19_{10}$$
$$r = |G| - 1 = 4$$ 
$$R =D \cdot 2^r \mod G = 10752 \mod 19 = 17_{10} = 10001_2$$

\section*{Exercise 3}

For 10 Mbps:

$$t = \frac{100 \cdot 512 b}{10^7\frac{b}{s}} = 5.12 ms$$ 

For 100 Mbps:

$$t = \frac{100 \cdot 512 b}{10^8\frac{b}{s}} = 0.512 ms$$ 

\section*{Exercise 4}
A mechanism that an AP can use to maintain constant reliability (e.g. constant BER) while communicating with a station that is getting farther away from it is to use rate adaptation: once transmission errors are detected through ARQ checks, the AP can switch to a lower transmission rate (akin to TCP's congestion control mechanisms) to counteract interference and lowering signal strength.

The AP may also decide to boost its transmission power if possible, thus increasing signal strength. However, this technique does not provide a linear increase in signal strength since obstacles or powerful interferences may be present.

In alternative, if the station is in a ESS and another AP is present in the same subnet, the station may decide to hop from the first AP to the new AP if the latter has a better RSSI. If the DS uses switches, those should be informed of the change of BSS so as to keep their switching tables updated. 

\section*{Exercise 5}
Collision detection is \textit{avoided} in IEEE 802.11 since collisions, contrary to IEEE 802.3 Ethernet, are expensive to detect since the power of a received message is significantly lower than the power of transmission. In addition, if collision detection was used scenarios like the hidden terminal problem would not have been avoided.

\section*{Exercise 6}
Let $d$ be the DIFS time and $s$ be the SIFS time.
The station that wants to transmit will transmit an RTS frame after $d$ units and such frame will be $2 + 2 + 6 + 6 + 4 = 20$ bytes long. Therefore we start waiting:

$$ d + \frac{20b}{11 \cdot 10^6 \frac{b}{s}} \approx d + 1.82 us$$

Then the AP will wait for $s$ units and then send a CTS frame $2 + 2 + 6 + 4 = 14$ bytes long. The station will receive the CTS at the instant:

$$ d + 1.82us + s + \frac{14b}{11 \cdot 10^6 \frac{b}{s}} \approx d + s + 1.82us + 1.27us = d + s + 3.09us$$

Then, after $s$ units the station will send the DATA frame. This frame will contain 3 MACs: 1 for the station itself (TX address), 1 for the BSSID of the network (the MAC of the AP, the RX address), and 1 for the MAC address of the destination, which might be in the distribution system (e.g. on a 802.3 network to which the AP is connected to. I will assume for simplicity that there is no fourth address (which might mean that the ultimate destination of this frame's data is on a 802.11 network as well). Therefore, the frame is $2 + 2 + 6 + 6 + 6 + 2 + 1032 + 4 = 1060$ bytes long. So, the AP will receive the entire DATA frame at:

$$d + s + 3.09us + s + \frac{1060b}{11 \cdot 10^6 \frac{b}{s}} \approx d + 2s + 3.09us + 96.36us = 
d + 2s + 99.45us$$

Finally, the ACK frame will be sent by the AP after $s$ units transmitting $2+2+6+4=14$ bytes, making the final formula:

$$d+2s+99.45us + s + \frac{14b}{11 \cdot 10^6 \frac{b}{s}} = d + 3s + 100.72us$$

\end{document}
