1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
\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<n\le m$, so it can find the address of the first $m$ hops.
However, some routers do not send the notification when a packet is dropped. Hence, the output may miss some hops.
For each hop, \texttt{traceroute} outputs (1) its hostname, (2) its IP address and (3) three round-trip time measurements. The round-trip time is the time used for a packet to travel to a router, be dropped, and of the notification thereof to travel back.
\item \begin{verbatim}
traceroute to cs.ru.nl (131.174.16.176), 30 hops max, 60 byte packets
1 145.116.184.1 (145.116.184.1) 1.869 ms 1.861 ms 2.721 ms
2 192.168.23.27 (192.168.23.27) 4.147 ms 4.161 ms 4.154 ms
3 dr-huyg.uci.ru.nl (192.168.10.7) 4.170 ms 4.161 ms 4.153 ms
4 www.cs.ru.nl (131.174.16.176) 4.109 ms !X 4.106 ms !X 4.090 ms !X
\end{verbatim}
Round trip time measurements: $4.109ms$, $4.106ms$, $4.090ms$.\\
IP address: \texttt{131.174.16.176}.\\
Number of hops: 4.
\item My filter: \mintinline{c}{icmp && (icmp.type==8 || icmp.type==9 || icmp.type==0)}. This filters ICMP traffic and in particular only ping requests, TTL exceeded messages and ping replies. This gives the capture in \autoref{fig:capture}.
\newgeometry{margin=2cm}
\begin{landscape}
\thispagestyle{empty}
\begin{figure}[h]
\centering\footnotesize
\begin{minted}{text}
No. Time Source Destination Protocol Length TTL Info
159 71.279742000 145.116.184.141 131.174.16.176 ICMP 74 1 Echo (ping) request id=0x7f9e, seq=1/256, ttl=1 (no response found!)
160 71.281761000 145.116.184.1 145.116.184.141 ICMP 70 255,1 Time-to-live exceeded (Time to live exceeded in transit)
163 71.285372000 145.116.184.141 131.174.16.176 ICMP 74 1 Echo (ping) request id=0x7f9e, seq=2/512, ttl=1 (no response found!)
164 71.286970000 145.116.184.1 145.116.184.141 ICMP 70 255,1 Time-to-live exceeded (Time to live exceeded in transit)
165 71.287087000 145.116.184.141 131.174.16.176 ICMP 74 1 Echo (ping) request id=0x7f9e, seq=3/768, ttl=1 (no response found!)
166 71.288882000 145.116.184.1 145.116.184.141 ICMP 70 255,1 Time-to-live exceeded (Time to live exceeded in transit)
167 71.288970000 145.116.184.141 131.174.16.176 ICMP 74 2 Echo (ping) request id=0x7f9e, seq=4/1024, ttl=2 (no response found!)
168 71.290924000 192.168.23.27 145.116.184.141 ICMP 70 254,1 Time-to-live exceeded (Time to live exceeded in transit)
171 71.294033000 145.116.184.141 131.174.16.176 ICMP 74 2 Echo (ping) request id=0x7f9e, seq=5/1280, ttl=2 (no response found!)
172 71.296037000 192.168.23.27 145.116.184.141 ICMP 70 254,1 Time-to-live exceeded (Time to live exceeded in transit)
173 71.296135000 145.116.184.141 131.174.16.176 ICMP 74 2 Echo (ping) request id=0x7f9e, seq=6/1536, ttl=2 (no response found!)
174 71.298248000 192.168.23.27 145.116.184.141 ICMP 70 254,1 Time-to-live exceeded (Time to live exceeded in transit)
175 71.298349000 145.116.184.141 131.174.16.176 ICMP 74 3 Echo (ping) request id=0x7f9e, seq=7/1792, ttl=3 (no response found!)
176 71.300152000 192.168.10.7 145.116.184.141 ICMP 70 252,1 Time-to-live exceeded (Time to live exceeded in transit)
179 71.302866000 145.116.184.141 131.174.16.176 ICMP 74 3 Echo (ping) request id=0x7f9e, seq=8/2048, ttl=3 (no response found!)
180 71.304906000 192.168.10.7 145.116.184.141 ICMP 70 252,1 Time-to-live exceeded (Time to live exceeded in transit)
181 71.304994000 145.116.184.141 131.174.16.176 ICMP 74 3 Echo (ping) request id=0x7f9e, seq=9/2304, ttl=3 (no response found!)
182 71.307139000 192.168.10.7 145.116.184.141 ICMP 70 252,1 Time-to-live exceeded (Time to live exceeded in transit)
183 71.307228000 145.116.184.141 131.174.16.176 ICMP 74 4 Echo (ping) request id=0x7f9e, seq=10/2560, ttl=4 (reply in 184)
184 71.309006000 131.174.16.176 145.116.184.141 ICMP 74 61 Echo (ping) reply id=0x7f9e, seq=10/2560, ttl=61 (request in 183)
187 71.312411000 145.116.184.141 131.174.16.176 ICMP 74 4 Echo (ping) request id=0x7f9e, seq=11/2816, ttl=4 (reply in 188)
188 71.313959000 131.174.16.176 145.116.184.141 ICMP 74 61 Echo (ping) reply id=0x7f9e, seq=11/2816, ttl=61 (request in 187)
189 71.314053000 145.116.184.141 131.174.16.176 ICMP 74 4 Echo (ping) request id=0x7f9e, seq=12/3072, ttl=4 (reply in 190)
190 71.315590000 131.174.16.176 145.116.184.141 ICMP 74 61 Echo (ping) reply id=0x7f9e, seq=12/3072, ttl=61 (request in 189)
\end{minted}
\caption{}
\label{fig:capture}
\end{figure}
\end{landscape}
\restoregeometry
\end{enumerate}
\end{document}
|