\documentclass[a4paper,9pt]{article} \author{Camil Staps\\\small{s4498062}} \title{Networking\\\large{Assignment 1}} \usepackage{polyglossia} \setmainlanguage{english} \usepackage{geometry} \usepackage[hidelinks]{hyperref} \usepackage{caption} \usepackage{enumitem} \setenumerate{label=\alph*)} \usepackage{minted} \usepackage{msc} \newcommand{\paction}[3][1.5]{\action*{\begin{minipage}{#1\envinstdist}#2\end{minipage}}{#3}} \usepackage{pdflscape} \begin{document} \maketitle \section{Protocol for a teller machine} \begin{enumerate} \item \begin{minted}[gobble=12,fontsize=\footnotesize]{clean} :: Maybe a = Nothing | Just a :: Card :== Int :: Password :== String :: Amount :== Int :: AuthProof // Messages that the ATM can send to the bank :: ATMMessage = Authenticate Card Password // Verify card & pwd | QueryBalance AuthProof // Query balance | Withdraw AuthProof Amount // Withdraw amount | Terminate AuthProof // Terminate session // Messages that the bank can send to the ATM :: BankMessage = AuthResult (Maybe AuthProof) // Result of Authenticate | Balance (Maybe Amount) // Result of QueryBalance | Withdrawn Amount // Amount has been withdrawn | Terminated // Session has been terminated \end{minted} \item See \autoref{fig:atmprot}. \begin{figure}[h] \centering\footnotesize \setlength{\instdist}{2\instdist} \begin{msc}{Cash withdrawal} \declinst{atm}{}{ATM} \declinst{bank}{}{Bank} \paction[0.9]{Request \texttt{Card} and \texttt{Password}}{atm} \nextlevel[3.5] \mess{\texttt{Authenticate Card Password}}{atm}{bank} \nextlevel \paction[1]{Verify \texttt{Card} and \texttt{Password}}{bank} \nextlevel[3.5] \mess{\texttt{AuthResult (Just ap)}}{bank}{atm} \nextlevel \action*{Request amount \texttt{n}}{atm} \nextlevel[2.5] \mess{\texttt{Withdraw ap n}}{atm}{bank} \nextlevel \paction{Subtract \texttt{n} from the account's balance}{bank} \nextlevel[3.5] \mess{\texttt{Withdrawn n}}{bank}{atm} \nextlevel \action*{Give \texttt{n} to the user}{atm} \nextlevel[1.5] \end{msc} \caption{} \label{fig:atmprot} \end{figure} \item \begin{itemize} \item Confidentiality (agents transmit sensitive data but the protocol doesn't provide confidentiality itself). \item Integrity (protocol doesn't deal with message loss etc.). \end{itemize} \end{enumerate} \section{Message segmentation in packet switched networks} \begin{enumerate} \item $8Mb$ at $2Mbps$ takes $4s$. Doing this thrice takes $12s$. \item $\frac{10Kb}{2000Kbps}=5ms$ per hop. The first packet takes $15ms$. The second also, but will be sent $5ms$ after the first packet. Therefore, it will be received $20ms$ after transmission is started. \item $(800+3)\cdot\frac{10}{2000}=4.015s$, using the formula from the lecture. This is of course smaller than what we calculated at a). It is roughly three times as small because there are three packets in the pipeline most of the time. Increasing the number of packets will bring this therefore ever closer to $4s$. \item \begin{itemize} \item Using segmentation, if one packet is lost we only have to send that packet again (~$5ms$) instead of the whole message (~$4ms$). \item Without segmentation, every hop will need to have a buffer of at least the message size because of the store-and-forward principle. With segmentation, smaller buffers can be used because only one packet has to be stored at a time. \end{itemize} \item \begin{itemize} \item It is more complicated because we need to divide the message in different parts. This means more processing time on both the transmitter's and the receiver's end. \item We need more overhead to describe what each packet is, so in fact we're sending more data than without segmentation. Because of this the calculations above are not precise. On a single link, this means segmentation may slow down the transmission. \end{itemize} \end{enumerate} \section{Shared link between multiple users} \begin{enumerate} \item $10/0.05 = 200$. \item ${100\choose50}\cdot0.2^{50}\cdot0.8^{50}\approx1.62\cdot10^{-11}$. \item $d_{\mathit{prop}}=1\cdot10^6/(2.5\cdot10^8) = 0.004s$. $d_{\mathit{trans}}=100/0.05=2000s$. So the total time needed is $0.004 + 2000 +0.5 = 2000.504s$. \item For queuing delay to occur, either 11 or 12 users have to be sending simultaneously. The probability is then ${12\choose11}\cdot0.2^{11}\cdot0.8 + {12\choose12}\cdot0.2^{12}\approx2.007\cdot10^{-7}$. \end{enumerate} \section{Traceroute} \begin{enumerate} \item Each IP packet has a TTL (Time To Live) field which is the number of hops a packet may travel to the destination. Every hop that forwards a packet decrements the TTL unless it is $0$, in which case the packet is dropped. When the packet is dropped, the dropper will notify the sender. In this notification the sender can find the address of the dropper. So, by setting TTL $n$ we can find the address of the $n$th hop. Traceroute does this sequentially for $0