# Networking

Networking

1)    Explain how routers forward packets in a datagram network and in a virtual circuit network.
2)    Routing on the Internet would not work if IP addresses were assigned at random to hosts. Explain the problem that would arise in that case. Then explain how IP addresses are allocated and why that strategy avoids the above problem.
[6 marks]
3)    Suppose an IP packet of 5000 bytes travels on network A with MTU of 1500 and then on network B with an MTU of 512 bytes. Show the content of the fields of the first 8 bytes of each IP packet received at the destination (for example the original IP packet can be described as ver = 4, hlen= 20, type=T, length= 5000, id=X, fflag=0, foffset=0)
4)
a.    Consider a network with link costs c(a,b)= 4, c(b,c) = 20, c(b,e) = 7, c(c,d) = 3, c(d,e)=1.  Simulate the execution of the distance vector protocol presented in Appendix, filling in Table 2.
b.    The simplified algorithm presented in the Appendix does not work if link costs increase during the execution. Starting from the final situation of the execution in the previous point show why an increase in cost would not be correctly reflected in the distance vectors (assume nodes connected by the link whose cost changes update their distance vector accordingly and start updating their neighbours). In the algorithm presented during the lectures, nodes keep a copy of past distance vectors received from all nodes. Explain why this would solve the above problem.

5)    A typical attack on non-switched Ethernet is packet sniffing, i.e. disabling the hardware filtering of frames performed by the network card, so that also packets addressed to other nodes are passed to upper layers.
This attack is not effective on a switched network. Explain why, with an example on a network composed by hosts A,B,C (the attacker) connected to a switch, where node A sends 3 packets to node B which replies to each packet. Suppose switch tables starts empty.
6)    Now reconsider the above case focusing on IP packets sent from A to B supposing that at the start A does not yet know B’s MAC address. Explain the process for A to send 10 IP packets to B, including every operation performed by hosts, and every message sent. Is there anything C can do to receive packets destined to B in this case? If no explain why the process is secure, if yes explain the attack and think about possible ways to detect or prevent it.

7)    Suppose host A need to send the following 3 bytes of data to B (in hexadecimal): E2,34,9F. Compute the parity bits according to the following schemes: a) single bit odd parity, b) column (odd) parity scheme with 2, 4 and 6 columns c) two dimensional parity schemes with 6 columns. Then say how many errors can be detected or corrected with each scheme, and compute the overhead of the scheme i.e., the ratio between the number of bits used for error correction and the number of data bits.
8)    Suppose the only factor to define the maximum length of Ethernet cables is allowing the transmitting node to detect collisions with other nodes. Find out the minimum length of an Ethernet frame L and compute the maximum length of a cable for R=10Mbps, 100Mbps and 1Gbps Ethernets (assume the speed of signal propagation is 200.000Km/sec). Then compute the CSMA/CD efficiency for such long cables using the formula in the slides (note that efficiency is computed from the maximum length frame size).

•    The table shows the sequence of messages exchanged by nodes, and the corresponding updates to the recipient distance vector. Initially the table only has the distance vector for the immediate neighbors of a given node, and “-“ (inifinity) for the others.
•    At each step y receives the distance vector of x Dx and potentially updates its own distance vector Dy. Y updates the distance for each destination n Dy(n), if the distance advertised by x (i.e., Dx(n)) plus the cost of the link c(x,y) is less than the y’s current distance for n. In mathematical terms at each step Dy(n) ? min{Dy(n), c(x,y) + Dx(n)}
Columns description
•    “Message x->y”: write the sending node and the receiving node followed by an arrow
•    “c(x,y)”: report here the cost of the link connecting the sending and receiving node
•    “DV of”: report the node y receiving the message, whose DV is potentially updated by the receipt of the message, this will make it easier to spot the “last” version of the DV vector for each node
•    “A,B,…”: report here the updated Dy(A), Dy(B), … i.e. the components of the updated distance vector of the receiving node y. If a component is changed from the most recent version of y, underline the new value.
•    “DV updated”: y if any component of the distance vector was updated in this step, – otherwise
•    “Node completed”: x if this is the last message x is sending at this iteration, “-“ otherwise
•    “Nodes to execute”: the set of nodes that still needs to be executed, computed from the value of the previous row, adding “DV updated” (if necessary) and removing “Node completed”
Notes to complete the table
1)    Simulate the execution of nodes in lexicographical order, i.e. first send messages from A, then from B, etc. When the last node executes, restart from A, if needed (see below). Also send messages to nodes in order, i.e. if B is connected to both E and G, fist send B’s distance vector to E (B->E) and then to G (B->G). To keep track of the nodes that still needs to execute due to their distance vector being updated use the columns “DV updated”,”Node completed” and “Nodes to execute” as explained before. If it is node X turn and X does not need to be executed, skip its execution. The algorithm terminates when “Nodes to execute” is empty.
2)    Be sure when comparing x and y distance vector to consider the last DV in the table, i.e. the most recent one.

Example on a network with link costs: c(A,B) = 5, c(B,C)=3, c(B,E)=10, c(C,D)=10, c(D,E)=1

Message x->y    c(x,y)    DV of    A    B    C    D    E    DV updated    Node completed    Nodes to execute
A    0    5    –    –    –
B    5    0    3    –    10
C    –    3    0    10    –
D    –    –    10    0    1
E    –    10    –    1    0            {A,B,C,D,E}
A->B    5    B    5    0    3    –    10    –    A    {B,C,D,E}
B->A    5    A    0    5    8    –    15    A    –    {A,B,C,D,E}
B->C    3    C    8    3    0    10    13    C    –    {A,B,C,D,E}
B->E    10    E    15    10    13    1    0    E    B    {A,C,D,E}
C->B    3    B    5    0    3    13    10    B    –    {A,B,C,D,E}
C->D    10    D    18    13    10    0    1    D    C    {A,B,D,E}
D->C    10    C    8    3    0    10    11    C    –    {A,B,C,D,E}
D->E    1    E    15    10    11    1    0    E    D    {A,B,C,E}
E->B    10    B    5    0    3    11    10    B    –    {A,B,C,E}
E->D    1    D    16    11    10    0    1    D    E    {A,B,C,D}
A->B    5    B    5    0    3    11    10    –    A    {B,C,D}
B->A    5    A    0    5    8    16    15    A    –    {A,B,C,D}
B->C    3    C    8    3    0    10    11    –    –    {A,B,C,D}
B->E    10    E    15    10    11    1    0    –    B    {A,C,D}
C->B    3    B    5    0    3    11    10    –    –    {A,C,D}
C->D    10    D    16    11    10    0    1    –    C    {A,D}
D->C    10    C    8    3    0    10    11    –    –    {A,D}
D->E    1    E    15    10    11    1    0    –    D    {A}
A->B    5    B    5    0    3    11    10    –    A    {}

Table 1

Message x->y    c(x,y)    DV of    A    B    C    D    E    DV updated    Node completed    Nodes to execute
A    0    4    –    –    –
B    4    0    20    –    7
C    –    20    0    3    –
D    –    –    3    0    1
E    –    7    –    1    0            {A,B,C,D,E}