辅导案例-COMP3310 /
THE AUSTRALIAN NATIONAL UNIVERSITY Mid Semester Examination 2020 Answersheet COMP3310 / COMP6331 (Computer Networks) Section 1: Signalling and Media 1. Manchester Encoding of bits on a wire/wireless link has an up or down transition for every bit. What are the two main benefits of doing this, and what is a significant downside? (3 marks) • Transitions on every 0 and 1, greatly helps resilience, and removes impact of runs of 0’s or 1’s • Regular transitions provide in-built clock signal for synchronisation • Downside – reduced data rates (half the bit clock rate) 2. What is the difference between Amplitude/Frequency/Phase Modulation (AM/FM/PM) and Amplitude/Frequency/Phase Shift Keying(ASK/FSK/PSK)? (1 mark) • AM/FM/PM is just A/F/P modulation of a constant voltage or carrier wave; an analogue signal • A/F/PSK is modulation applied with some number of discrete levels, transmitting one or more bits per symbol; it is quantised (or “keyed”) 3. How many bits-per-symbol can you send with N-QAM? (1 mark) • 16 QAM = 4 bits per symbol (2^4=16: a symbol can take one of 16 values) • 32 QAM = 5 bits per symbol (2^5=32: a symbol can take one of 32 values) • 64 QAM = 6 bits per symbol (2^6=64: a symbol can take one of 64 values) • 128 QAM = 7 bits per symbol (2^7=128: a symbol can take one of 128 values) 4. What is the difference between multiplexing, inverse multiplexing and statistical multiplexing? (3 marks) • Multiplexing: mixing multiple signals (from different sources) onto a single path (e.g. a trunk) o Aside: separating the mixed signals at the other end is De-multiplexing. • Inverse multiplexing: taking one signal and sending it across multiple paths, o e.g. high speed Ethernet using multiple pairs of wires in a UTP cable; HDMI, USB, ... • Statistical multiplexing: having multiple sources share a medium based on the optimistic probability that not everyone wants to send at the same time – you have no idea. 5. “deciBels” (dB) are used as a logarithmic-scale measure of ratios, especially energy. What is the difference between dB, dBm, and dBi? (3 marks) • dB (deciBels) = a pure logarithmic measure of the ratio of energy between e.g. signal and noise, or between two signals, e.g. gain in an amplifier – dB = 10*log10(S/N) • dBm = dB relative to a 1mW signal (0dBm = 1mW, 20dBm = 100mW) • dBi = dB relative to an “isotropic” transmitter or receiver, usually used for antennas 6. Why are the wires twisted in UTP cables? (1 mark) • So that external noise interference impacts both wires in the cable equally, rather than just one wire more than the other. Makes it much easier to subtract out the interference at the other end. 7. Interpretation of a DSL signal graph, as seen by a modem. The graph is showing you all the different frequency carriers on a typical NBN FTTN DSL link, each carrying what they can. Explain (briefly): a. What causes the overall slope down to the right? b. What is the frequency, and the likely source, of that spiky poor performance around channels 160 and 200? c. Why is there a gap at the lowest frequency channel (channel zero)? d. Broadly estimate the downstream and upstream data-rates achievable over this link. Show your calculation. You can read from the graph a channel is around 4kHz wide. Ignore the red vertical line. • The slope down to the right is frequency attenuation (due to the skin-effect). Makes S/N ratio worse at high frequencies (and hence lower bits/s) [1 mark] • The lowest frequency channel is 0-4kHz, which is set aside for telephony (POTS/PSTN) [1 mark] • Calculating data up/down: [2 marks] o Each channel carries X symbols per second (channel width = 4kHz=4000/sec) Some people may be more precise and use 4.3kHz, so get an answer ~10% higher o You have some # of bits per symbol - read from the lower chart o You have a number of channels working in parallel o Total = [# of channels] times [4000 symbol/sec] times [# bits/symbol] So estimating for green upstream sections, from the lower chart, channels 1-32 = 31 channels, averaging about 10 bits/symbol => 4000Hz * 31 channels * 10 bits/symbol is roughly = 1,240,000 bits/second = 1.24Mb/s. Downstream calculation, same approach, imagine a box around each of the blue sections and add them together, so roughly 4000*[(120 channels*8bits/symbol)+(30*4)+(30*2)]=4k*[960+120+60]=4,560,000=4.5Mb/s. • Those channels are at 160*4=640kHz and 200*4=800kHz. The drop in signal/noise ratio is most likely due to noise being picked up by the DSL cable somewhere. At those frequencies I’d suspect AM radio stations (in fact there are two ABC radio stations in Canberra at 666kHz and 840kHz). 8. What are the benefits of a communications circuit, and what are the downsides, compared to using some shared communication channel approach? (2 marks) • Circuits (physical or virtual) are dedicated to your use, providing some guarantee of quality of service, no competition. A shared channel cannot guarantee that. • Downside: they can’t be used by others when you’re idle (wasting bandwidth), they have to be set-up/torn-down somehow for each circuit, and if any point along the path fails, the whole circuit fails. [A shared channel is more efficient, requires no state to be set up in the network, and any failures just mean packets take a different path if they can] 9. Why can we carry much more information over optical cables rather than copper? (1 mark) • Mainly because they carry information over light instead of electricity. Light runs at much higher frequencies, THz range, instead of electrical signals in the MHz-GHz range. Gives you 1,000-1,000,000 times the capacity immediately. (Recall, frequency ~= #of symbols/second) • A much smaller benefit is from reduced attenuation and sensitivity to interference. Over “short” distances they don’t matter as much though – that’s about carrying the same amount of information further. Section 2: LANs and UP. 10. When is a LAN broadcast useful? i.e. what problems does it help you solve? (2 marks) • When you need to find a device/service on the network, and don’t know who to ask • When you need to tell one or more devices on the network something about yourself (a service, your address, …) , and don’t know who to tell. 11. CSMA/CD (carrier-sense-multiple-access/collision-detection) is used for wired LANs like Ethernet, especially before we had Ethernet switches. What are the 3 features being referred to and what are their benefits? (3 marks) • MA = Multiple Access – dealing with multiple devices on the same shared medium • CS = Carrier Sense – listen if somebody is already talking, and wait politely if they are. • CD = Collision Detection – listen if somebody starts colliding with you when you’ve started talking and back out for another go. 12. In the formal OSI 7-layer model, which is the lowest layer which supports ONLY end-to-end (process-to-process) communications, in principle? Identify it from the list and explain what that means [2 marks] Physical, Link, Network, Transport, Session, Presentation, Application Transport – it’s what applications code to (to run over e.g. tcp, udp, …). Below here is stuff the network interfaces, routers and switches care about, and applications do not. At this layer applications are effectively talking directly to (an application/process on) another host. Aside, it’s not a pure situation. At the Network layer: IP addresses and ports (transport layer) can be modified by NAT – it breaks ‘end-to-end’ communications. Routers modify IP headers (ttl, checksums) and may do security inspections of transport payloads. 13. What is the Ethernet broadcast address (in hex or binary), and how is it different to an IP- layer broadcast address? (2 mark) • Broadcast = all ones. Ethernet has 48-bit MAC addresses, so ff:ff:ff:ff:ff:ff • IPv4 broadcast, all ones = 255.255.255.255 • An Ethernet broadcast is done at the Ethernet layer, could be purely electrical. An IP broadcast requires the network switches/routers to actively replicate the packet to every (physical) port. 14. How do wireless devices learn about “hidden-stations” (other wireless devices) to avoid collisions? (2 marks) • Through the use of RTS/CTS (Request to Send, Clear to Send) • If you hear a CTS, somebody else (that you can’t hear, hidden from you) has sent an RTS, and it’s polite to wait. 15. Why do Ethernet and WiFi frames start with a preamble - what problems do they solve? (2 marks) • To wake up receivers that somebody wants to transmit • To help receivers synchronise clocks with the transmitter and identify the start of the frame o Note: there is no negotiation/protocol information in the preamble, that comes in the header within the frame, after the preamble 16. What main problem does the spanning-tree algorithm prevent, and what causes it? (2 marks) • It prevents broadcast storms when the network is looking for a destination it hasn’t seen before. (switches will flood every port) • The problem is caused by loops in the topology, e.g. redundant links or more complex, multi- switch loops. 17. What is the raw (physical layer) bit-rate in Ethernet and what medium does it run over? Explain how you identify it (2 marks) • 100 = 100Mb/s • 1000 = 1000Mb/s = 1Gb/s. • 10G = 10Gb/s • 40G = 40Gb/s • -LX, -FX = fibre (L=long wavelength=light, F=fibre). • -T = copper (UTP) Section 3: Layer 3 (IP) 18. Which attribute in an IP-router’s forwarding table determines the order in which forwarding decisions are made? (1 mark) The prefix length (longest, most-specific get preferred) 19. What is the difference between IP forwarding and routing? (2 marks) • Forwarding is a quick LOCAL-device decision about an incoming packet that comes in on one port and needs to go out another. Local decisions are based on forwarding tables within the device • Routing is a slower GLOBAL decision-making process that sets up and maintains forwarding tables across a range of devices. 20. I can make an IP packet up to 64kB in size, but it’s a bad idea to go that big. Three questions: Why is it a bad idea to have packets that big? In what circumstances do packets get fragmented along their way, and what do we use to avoid it? (3 marks) • Large packets can cause blocking, and a greater risk of being corrupted/lost, causing waste • When a packet is larger than the MTU on the next link, the router will fragment the packet. • We avoid this by using Path-MTU-Discovery (PMTUD). 21. What is the full name of the protocol used to convert IP addresses into MAC addresses, and where and why do we need it? (3 marks) • Address Resolution Protocol (ARP) • Used to send IP packets across an Ethernet or WiFi link to a specific device • We need that devices Ethernet MAC address when given only its IP address. 22. Choosing from the list of options below, answer these two questions: Normal routers change which field(s) in the IPv4 header of a packet passing through? A NAT device (e.g. your home modem/router) will also change which field for outbound packets? (2 marks) • Protocol • TTL • Don't Fragment Flag • Source Address • Checksum • Version Routers will change the TTL (decrement by one) and Checksum (since the header has been changed). A NAT will also change the IP source address on outbound packets, to the public interface of the NAT. It will also change the port numbers, but that’s inside the TCP/UDP headers, not the IP header. 23. How many bits are in an IPv6 address? (1 mark) • 128 bits – four times the length of an IPv4 address 24. Despite causing complexity, breaking things and being generally evil, what is NAT actually good for? (2 marks) • Helps network managers set up local networks using whatever addresses (in the approved private ranges) they want, AND only need one publicly routable IP address to connect to the wider Internet. Reduces pressure on IPv4 address exhaustion. 25. What type of packets are sent by routers to provide feedback to hosts about network matters (e.g. errors or problems)? (1 mark) • ICMP = Internet Control Message Protocol 26. What is special about IPv4 addresses in the 10.0.0.0/8 and 192.168.0.0/16 ranges? Why are they treated this way? (2 marks) • These are private address ranges, used behind NAT, and are not routed across the Internet. (Any such packets will be dropped by a router on the Internet). It allows network managers to set up private networks that could be connected to the Internet, and largely work, without requiring expensive routable IP addresses. 27. What field in the IP header does the traceroute command use to determine the path of packets towards a destination? (1 mark) • Traceroute uses the TTL field incrementally to identify each router along the path (listening for an ICMP-TTL-exceeded message each time). 28. Which network mask will allow up to X hosts on a single subnet, and explain? (1 mark) (/N format) X hosts, plus the broadcast address (all ones) plus the ‘wire’ address (all zeroes) = X+2 host addresses. So log2(X+2) bits of subnet mask, leaving remaining bits for the prefix. • 6 + 2 = 8 = 3 bits of subnet => 29 bits of mask = /29 (255.255.255.248) • 14 + 2 = 16 = 4 bits of subnet => 28 bits of mask = /28 (255.255.255.240) • 30 + 2 = 32 = 5 bits of subnet => 27 bits of mask = /27 (255.255.255.224) • 62 + 2 = 64 = 6 bits of subnet => 26 bits of mask = /26 (255.255.255.192) • 126 + 2 = 128 = 7 bits of subnet => 25 bits of mask = /25 (255.255.255.128) • 254 + 2 = 256 = 8 bits of subnet => 24 bits of mask = /24 (255.255.255.0) • 510 + 2 = 512 = 9 bits of subnet => 23 bits of mask = /23 (255.255.254.0) • 1022 + 2 = 1024 = 10 bits of subnet => 22 bits of mask = /22 (255.255.252.0) 29. You've been allocated an IP address range for your subnet of 126.45.41.64/X. Two questions, for a given X: • What is the "network" (or "wire") IP address? • What is the IP broadcast address for this subnet? Explain how you worked these out. (1 mark) /X = X bits of network prefix, 32-X for hosts. All zeroes of host address = network address. All ones of host address = broadcast address • 126.45.41.64/26: Net = 126.45.41.64, Broadcast = 126.45.41.127 • 126.45.41.64/27: Net = 126.45.41.64, Broadcast = 126.45.41.95 • 126.45.41.64/28: Net = 126.45.41.64, Broadcast = 126.45.41.79 • 126.45.41.64/29: Net = 126.45.41.64, Broadcast = 126.45.41.71 • 126.45.41.64/30: Net = 126.45.41.64, Broadcast = 126.45.41.67 30. Unpack the IPv6 address 2018:#### to its full length in hexadecimal (1 mark) Explanation: IPv6 = 128-bits = 16 octets = 8 hex-pairs, in quad notation. Address packing removes leading zeroes, and multiple blocks of zeroes become ‘::’, but only once in a compression. • 2018:cf2:dc00::68:8ac2 o 2018:0cf2:dc00:0000:0000:0000:0068:8ac2 • 2018:cf2::dc00:68:8ac2 o 2018:0cf2:0000:0000:0000:dc00:0068:8ac2 • 2018:cf2::dc:68:8ac2 o 2018:0cf2:0000:0000:0000:00dc:0068:8ac2 • 2018:cf2:d0c::68:8ac2 o 2018:0cf2:0d0c:0000:0000:0000:0068:8ac2 • 2018:cf2:d0c:0:608::8ac2 o 2018:0cf2:0d0c:0000:0608:0000:0000:8ac2 • 2018::cf2:d0c:0:608:8ac2 o 2018:0000:0000:0cf2:0d0c:0000:0608:8ac2 Section 4: Layer 4 (Transport) 31. If you write 1000 bytes to a TCP socket, how many packets will be sent? Explain your answer (1 mark) • Trick question: you don’t know, though it’s between 1 and 1000 (ignoring losses, retransmissions, etc). TCP is just a bytestream, you write into a buffer and listen from a buffer. The Transport/Network layer code in the kernel decides how many packets to send, based on a range of parameters (buffer-length, delay-limits, ...). 32. Inside your operating system, what 5 pieces of information uniquely identify a tcp/udp connection over the internet? (2 marks) • IP addresses (source, destination), port numbers (source, destination), and transport protocol (tcp or udp, usually). 33. Why does a TCP server's accept() call block? (i.e. wait for input) What is it waiting for? (1 mark) • It has indicated to the operating system that it is ready to receive incoming connections, i.e. waiting for a client to connect(). 34. A ‘netstat -n’ command returns a table with one row like this. Each row relates to one of the connections the operating system knows about: Proto: Local Remote State TCP 192.168.1.2:53398 150.203.56.47:80 CLOSE_WAIT What has just happened here? (you can check the man/help page for netstat, and/or run it) (2 marks) • A connection from this machine (192.168.1.2, behind a NAT) to port 80 (webserver probably) on 150.203.56.47 (a public address, happens to be at ANU) has just been close()d by the client (a FIN has been sent), and is waiting for the other end to finish sending and/or to acknowledge and close its end. 35. What sockets library function is called just before a TCP server makes an accept() call for incoming connections? (1 mark) • Listen() 36. What is the common name for the first segment sent in a TCP 3-way handshake when setting up a connection? Choose from the following • SYN • ACK • Connect • SYN/ACK • Open (1 mark) • SYN (which gets a reply SYN/ACK, to which it replies ACK) 37. What is the common name for a segment that gets sent back if you try to make a TCP connection to a port which is not currently in the listening state? (1 mark) • Reset (RST) 38. Why does TCP use a Sliding Window, specifically related to segments it has sent? What's the main benefit? (1 mark) • A sliding window manages the number of unacknowledged segments that are out on the network (using the sequence number as a pointer). It keeps the network path between sender and receiver as full as possible, so that long round-trip delays don’t choke the performance of the network. 39. Why do we have "well-known" ports for tcp/udp connections? (1 mark) • It provides a default for applications to connect to when they use ‘well-known’ application protocols. A human doesn’t need to specify it in e.g. an application address like a URL, or an email address, or an ftp server. Strictly speaking it also discourages use of those ports by non- standard applications, which is good for avoiding confusion. 40. When packets pass through a NAT (network address translation) device on the edge of your network, what does it actually do to incoming/outgoing packets to allow connections to work, and what does it need to store? (3 marks) • A NAT device modifies the outbound private IP address to the public IP address of the NAT/router, • It records that private IP address and port number of the sender so that replies from the public internet are forwarded back to the right machine • It also maintains any static forwarding rules for incoming packets, e.g. packets for random port 7880 are forwarded to machine 10.1.1.9 on port 80, to make a webserver there visible to the outside world. 41. Why do we have ‘port’ numbers in tcp/udp segments? (1 mark) • So that the operating system can direct incoming packets to the correct process/service (application) listening for particular packets in each direction. End of questions