Computer networks are constructed using a modular architecture known as layering. a) Explain how layering simplifies the protocols used in networks and intermediary devices. Fundamentally, layering is a means of modularising/decomposing the inherent complexity of network functionality – consider that the network service needs to consider such functions as vastly different as the transmission and reception of bits versus the encoding of an image for transmission over a network connection. Simplifying protocols – the division of functions between the layers allows protocols to be focused on solving specific problems without needing to be concerned about the detail of the functions present in other layers. For example, IP is only concerned with how to forward a TPDU across the internetwork to the destination host. IP is not concerned with how reliable delivery is achieved (TCP) or how to transmit bits over a twisted pair cable (Ethernet). Simplifying devices – the separation of functions into different layers allows those layers to be selectively implemented by the intermediary devices. For example, only the physical and data link layers are needed to be implemented in a link-layer switch, and only the physical, data link, and network layers are required for a router or multilayer switch. Note that many such intermediary devices implement the full protocol stack to enable remote configuration via SSH/web/etc., however this is not required, and higher layers are usually software based while the lower layers of a particular device can be implemented fully in hardware to optimise performance.
b) Explain how encapsulation and decapsulation works and how these mechanisms are used to achieve logical communication between peer layers. The physical communication in between nodes on a single network represents the physical communication pathway, i.e., the transmission and reception of bits/streams of bits. This is represented by the physical layer which defines the properties and characteristics of the medium and the signalling used to represent bits on that medium. The layer immediately above the physical layer, the data link layer, provides a number of different services such as being able to deliver data to a specific node (destination) elsewhere on the network. To achieve this service, other nodes on the network need to be able to know what the intended destination is, so the data link layer protocol adds this information is added to the data passed down from higher layers in the form of a header before passing the combined data to the physical layer for transmission. This is the process of encapsulation. The physical layer in other nodes will then receive the transmission and pass it to the data link layer. The data link layer will inspect the value of the destination address to determine if they are the intended destination. If they are the intended destination, they remove any header added by the source node’s data link layer before passing the data unit to higher layers in the form that it was originally provided to the source node’s data link layer. This is the process of decapsulation. Notice how the header added by the data link layer protocol on the sending node is processed by the same data link layer protocol implemented on the destination node. Also notice how after the header is added to the data the data-link layer passes the combined data to the physical layer for transmission, i.e., effectively the data-link layer is requesting the physical layer to send the data. On the destination node, the data-link layer receives the data from the physical layer consisting of both the header and the data from the higher layer protocol combined. From the perspective of the data-link layer, the mechanisms of the physical layer are hidden, so it gives the appearance that the data-link layer on the sending node is sending the combined data directly to the data-link layer on the receiving node. The data in the header represents communication between the two data-link layers, i.e., peer layers. As the data-link layer is not involved in the physical transmission of bits, this represents logical communication. c) A key advantage of layering is that a protocol in one layer can be replaced with another with little or no impact. Discuss how this works, including any influence/expectations on adjacent layers (layers above/below where the protocol is replaced).
Each layer in the protocol stack uses the services of the layer immediately below, implements various mechanisms to add services of the underlying layer services, then presents this new value- added service to the layer above. The interactions between adjacent layers (higher/lower layers) are defined by an interface of some kind, i.e., an application programming interface (API). Exchanging a protocol at one layer with another can be done straightforwardly as long as the interface remains consistent, i.e., the new protocol will invoke the services of the layer below using the interface it defines, and provide an interface to the layer above equivalent to the replaced protocol. A good example of this exchange of protocols is the existence of two network layer protocols: IPv4 and IPv6. The basic service provided by these protocols, including global addressing and routing, are the same. These protocols can be substituted without any significant change to surrounding protocols. In particular, lower-layer protocols such as Ethernet are unaffected. Higher layer protocols, such as TCP and UDP did not strictly require modification, although to improve
performance the header checksum was removed from IPv6 and the existing optional checksum in UDP was made mandatory. The only potential change that may need to be made to higher layer protocols and/or applications from switching to IPv6 is the change in the address size, however there will be cases where even this isn’t required. It is also possible to exchange lower-layer protocols in the same manner, e.g., switching from Ethernet to Wi-Fi. Upper layer protocols may require some changes however. Changing transport protocols is likely to have an impact because of the different delivery semantics they provide, e.g., TCP provides reliable delivery whereas UDP provides an unreliable service, however in some cases these too could be changed with no significant impact (DNS can use either TCP or UDP for example). Changing an application layer protocol would not require changes elsewhere in the protocol stack, however the application program itself would possibly need modification. d) Consider a home network where a computer connected via Ethernet to the router is printing to a printer that is connected by Wi-Fi to the same router using the Internet Printing Protocol (IPP). Assuming that the Wi-Fi network is just an extension of the existing wired LAN, i.e., they are the same subnet, illustrate the communication protocol stacks of all devices in the communication path, indicating both the layer name and actual protocol (see Week 1 Slide #32 for an example without the actual protocols named). From the above description we already know that the physical/data-link layer protocol is either Ethernet or Wi-Fi, the network layer is of course IP, and the application layer is the Internet Printing Protocol. It’s possible to identify the transport layer using quick web search, which shows IPP uses TCP.
Note how in the above illustration only the bottom two layers are shown on the router. This is because the Wi-Fi network is an extension of the Ethernet network. Although the router would definitely implement the network layer (and potentially higher layers if a web interface or similar is provided), it is not relevant to this figure. Instead, a translating bridge function is used, where the Ethernet header is translated to a Wi-Fi header as required. It would be acceptable to indicate the Network: IP layer as a single layer on the router however.
Consider the differences between datagram switching and virtual-circuit switching networks. Explain how the following aspects of communication are impacted (or why they are not impacted) by these different switching techniques: i. Delays encountered by data travelling from sender to receiver; ii. The order packets would arrive at the receiver; and iii. The reliability of packets being delivered to the receiver. Put simply, the difference between these two approaches is when the decision is made on the path individual datagrams that form part of a larger communication will take through the network. For datagram switched networks, the decision on the path is made independently for each datagram as it arrives at each intermediary device as it travels towards the destination. In virtual- circuit switching on the other hand, the path is determined before the actual data/ payload of the larger communication is sent, usually as part of an initial special setup datagram that’s sent through the network. All datagrams in the larger communication will then take the same path. Delays – datagrams in virtual-circuit networks all follow the same path to the destination, so the general expectation would be to observe a relatively consistent delay. In datagram-switched networks however, each datagram could take a different path, and each path could have a different length, network speeds, congestion, and so on, suggesting a greater variability in delay. Note however that a virtual-circuit network does not necessarily guarantee that delay will be consistent however, as there can still be fluctuations in the amount of traffic being sent in other communications that share the same physical links (affecting queuing delays). Order – datagrams passing through a virtual-circuit network will follow the same path, so generally will arrive in the order in which they were sent (see note). Datagrams passing through a datagram-switched network however can be forwarded across alternate links and with different delays (previous paragraph) may arrive in a different order as a result. Note: virtual-circuit networks only guarantee that packets will take the same path. Other factors may affect the order in which datagrams are actually received, including the loss of datagrams due to network errors or mechanisms such as Quality of Service implemented by higher layer protocols can result in a reordering of packets as they are being queued. Reliability – although it may not be immediately apparent how the reliability of the network could be affected by the use of datagram vs virtual-circuit switching, if a fault occurs in the path for a virtual-circuit then communication would no longer be viable. If a fault occurs in a datagram switched network however it would be possible for the network to route around the failed part of the network and for communication to continue, suggesting a more reliable service. Alternatively, in the absence of failures in the underlying network, virtual circuit networks may be better able to avoid congestion as they can support the pre-allocation of resources along the path, e.g., buffers in intermediary devices, with new virtual circuits required to be routed through alternate pathways. Datagram switched networks however could be more susceptible to congestion as there is limited control over the pathways individual datagrams will take and a lack of ability to pre-allocate resources. Outside of the above examples and similar issues, the reliability of an individual datagram passing over either datagram-switched networks or virtual-circuits would, in general, be expected to be much the same. It is also not expected that students will have the same detail as above for reliability.
Given the following network topology:
a) Illustrate the use of network layer addresses and link-layer addresses as a packet is sent from the PC on the left to the PC on the right.
b) Explain what is happening in your illustration, including why some addresses are changing and others not, where encapsulation/decapsulation is occurring and at what layers. There are two sets of addresses shown in the above figure: network addresses and link-layer addresses. The source and destination network addresses have global scope and do not change across the entire figure. This is why the network address of the PC on the left (N1) and of the PC on the right (N4) do not change in the packets indicated for each link. The source and destination link-layer addresses however have local scope and will reflect the devices on an individual link. There are two links in the figure, first from the PC on the left to the router (link layer addresses L1 and L2), and from the router to the PC on the right (L3 and L4). These addresses change to reflect the relevant link. The switch however is an interconnecting device for the link between the router and the PC on the right, and although the link addresses will be inspected by the switch, they will not be changed. More simplistically, switches are used to build a single network, whereas routers are used to connect two or more networks together. The left PC prepares the packet which will contain the user data, encapsulated by the transport layer, encapsulated by the network layer, and encapsulated by the data-link layer. The network addresses contain N1 and N4 representing itself as the source the right PC as the destination (global scope), however on the current link the packet is sent to the router, so the link-layer addresses will contain L1 and L2 reflecting transmission of the packet from the PC on the left to the router. The router will receive the packet and decapsulate the data-link layer. The destination network address is then examined, identifying the PC on the right as the destination, so the packet is again encapsulated by the data-link for sending to the PC on the right. The network addresses are unchanged, but the link-layer addresses will contain L3 and L4 reflecting transmission of the packet from the router to the PC on the right. As indicated above, the switch will inspect the link-layer addresses, but there is no decapsulation/encapsulation here. Finally, when the packet is received by the PC on the right it will decapsulate all the layers before passing the data to the relevant application.
a) Modern Ethernet networks make use of switches which, when only one device is connected to a switch port, enables CSMA/CD to be disabled and full-duplex communication to be used instead. Explain why this same technique is not possible for WiFi networks, which require use of CSMA/CA. CSMA/CD is the medium access control protocol used on shared Ethernet networks (coaxial cable or hub-based star topology) to enable nodes to effectively share the medium. The use of a shared medium results in the possibility that if two devices were transmitting at the same time their transmissions would overlap, known as a collision, preventing other devices from receiving either transmission. CSMA/CD manages (controls) access to the medium, preventing devices from transmitting when the medium is already in use and discontinuing transmission if a collision is detected. CSMA/CD is considered half-duplex because of this limit of only one transmission on the medium at any time, implying a node can only be transmitting a signal or receiving a signal at any one time, not both. When only one device/node is connected to a switch port, the possibility of two transmissions overlapping on a shared medium can be eliminated. For example, in 100Mbps Ethernet networks (100BASE-T), the cable contains a number of twisted pairs (four pairs in a CAT5/CAT6 cable) and one pair is used for communication in one direction and another pair used for communication in the reverse direction. The restriction to only two devices (node and switch), each with a dedicated path to transmit data to the other, eliminates the possibility of a collision occurring, allowing CSMA/CD to be disabled and full-duplex communication to be used instead. Gigabit Ethernet is more complex but effectively has the same outcome of a channel in each direction that is independent from the opposite direction. Wi-Fi networks by their nature however are required to use a shared medium (the open air). The frequencies used are internationally standardised and available for private use, and although used for Wi-Fi networks, other consumer devices such as portable handsets for the Plain Old Telephone Service (POTS), wireless microphone systems, and various radio remotes such as garage door openers share these frequencies. There is also a limited number of frequencies available, and so it is not unusual to see several Wi-Fi networks sharing frequency bands. It would be theoretically possible to use different frequencies to provide dedicated channels, however separate frequencies would be required for each device on each Wi-Fi network to provide the equivalent of the dedicated pathways identified for Ethernet networks which is not feasible. b) The CSMA/CA protocol, used in WiFi networks is able to reduce the likelihood of collisions occurring, but is unable to eliminate them. Given that the RTS/CTS flow control mechanism ensures only one device transmits at any one time, explain why collisions can still occur. In your answer, use a scenario/example to aid in your explanation (an illustration may work well for this). Note: assume that only one WiFi network is in use and there are no other devices are using the same frequencies. As noted in (a) above, completely avoiding a collision requires the use of a dedicated pathway which isn’t possible/feasible for Wi-Fi networks. The possibility of other signals overlapping a transmission, or even background interference, cannot be entirely eliminated even in the presence of the RTS/CTS mechanism. It’s also important to note that only the Wi-Fi network itself will adhere to the time reservations (NAVs) identified in a CTS message. Other Wi-Fi networks
sharing the same frequency can also generate signals that could collide (as can other devices using the same frequency, although these are out of scope per Note in the question). Other problems can also occur leading to the traditional “collision” concept occurring. Wired networks such as shared Ethernet impose a maximum length on the cable, guaranteeing that all nodes can hear the transmissions of other nodes. In a Wi-Fi network however, one node may not be in range of all other nodes, known as the hidden station problem, typically illustrated as similar to the following:
This figure illustrates the location of three Wi-Fi transceivers and the associated range of their transmissions. The blue and the green transceivers are within the range of the red transceiver, so they can communicate effectively with the red transceiver (and vice-versa). The blue and green transceivers however are unable to see each other, and cannot observe/receive the transmissions of the other. A similar problem can be caused by physical barriers in the world where once device is effectively hidden behind the barrier. Unable to see the transmissions of other devices can also lead to collisions. Another problem that can occur is where signals can reflect off surfaces, causing a duplication of a signal known as multi-path propagation, i.e., the receiving transceiver will receive the direct signal from another node, and the reflection (echo) of that same signal from a surface. This duplicate signal is equivalent to a collision, although the encoding used allows this echo to effectively be eliminated. More simplistically, before a node can send a transmission on Wi-Fi networks using RTS/CTS they must first issue the RTS request and be assigned the channel by the access point’s corresponding CTS message. The RTS requests themselves must be sent randomly and therefore those transmissions themselves can still collide. It’s important to note that some overlapping of signal can be solved in Wi-Fi networks due to the encoding used on transmissions which includes some ability to correct for errors. If one signal being received by a node is significantly stronger than other signals the node may be able to selectively receive the stronger signal. These approaches, whilst improving the performance of Wi-Fi, do not eliminate the possibility of collisions occurring.
The IP protocol includes error control in the form of a checksum that validates only the content of the IP header. As noted in the Week 5 slides, this design decision was based on the inefficiency of providing error control at the network layer once fragmentation had been considered. a) Draw an illustration that shows a packet arriving at a router, which is then fragmented into two or more fragments for transmission to the receiver. Indicate any relevant IP header fields in your illustration.
The relevant fields in the above illustration of an IP datagram being fragmented are: • Version – set to 4 to represent IPv4, defining the format of the header; • Total length – 820 octets (20 header + 800 data) in the original datagram divided into two equal smaller datagrams (20 header + 400 data); • Identification – a unique number sent by the sender, 12345 for the purposes of this example; • Flags – used to indicate no fragmentation in the original datagram, then 001 indicated in the first fragment to indicate another fragment is to come; • Fragment offset – indicates how far (offset) into the original datagram’s data this fragments data should be rebuilt (multiple of 8 octets, so 50 * 8 = 400 offset). • Data – indicated as reduced in size (illustrative but not proportionally sized). A unique IP datagram is identified by the combination of the identification field, source address, destination address, and protocol fields, so these additional fields could also be illustrated in the above datagrams as relevant fields. These additional fields were omitted from the above diagram as the focus was on the key fragmentation fields in the context of a single datagram. b) Explain why fragmentation may occur and how it works (both fragmentation and reconstruction at the destination). Fragmentation occurs whenever a datagram arrives at a router and needs to be forwarded on an outgoing link which is unable to carry to the complete datagram. An IP datagram can potentially be up to 65535 octets in length including at least 20 bytes of IP header, depending on the presence of options in the header. Most underlying links do not carry this amount of data in a single frame, e.g., Ethernet (most common wired network) only carries 1500 bytes of payload. Even in internetworks consisting entirely of the same type of link, it is possible that an IP datagram may need to be fragmented. For example, the use of tunnels or VPNs in a network require an additional layer of encapsulation, so if an IP datagram of 1500 bytes were transmitted over an Ethernet-based internetwork, it would need to be fragmented to pass over a tunnel/VPN. Upon encountering an outgoing link which doesn’t have an adequate Maximum Transmission Unit (MTU) size to carry the complete datagram, the IP protocol will divide the data payload into two or more fragments and attach a header to each. The flags and fragment offset fields are adjusted to reflect the placement of the fragment in the original datagram, and a new header checksum is
calculated for each new fragment datagram. These fragments then represent independent datagrams and are forwarded through to the destination like any other, potentially along alternate pathways. In travelling through further links each datagram could encounter a link with an even smaller MTU, requiring further fragmentation. Upon receiving a fragment, the destination will usually store the fragment in a buffer for a defined period of time whilst awaiting the arrival of the other fragments. Once all fragments are received, the original datagram is reassembled before passing its payload to higher-layer protocols. If all fragments aren’t received within the defined time, the received fragments are discarded. Fragments may be discarded if the network is particularly busy however (limited buffer space in any device could be overwhelmed). c) Explain why the presence of fragmentation would influence the decision to validate only the IP header instead of the entire datagram. The calculation and validation of a checksum value is a costly operation. Although relatively simple, the Internet checksum algorithm performs a one’s complement sum of all the input data in 16-bits, so the entire data must be considered. Each datagram’s header is modified at each router in the path to the destination host (TTL field must be reduced), so any checksum would need to be recalculated at each device, increasing processing delay. By restricting the checksum to the header, the cost of this calculation and associated validations is minimised, and validation of the complete payload is left to higher layer protocols. If a datagram were to be fragmented, additional data is introduced to the datagram/s in the form of the additional IP header required on second and further fragments. Importantly however, if any of the fragments were to fail checksum validation, then it would be discarded in transit, whilst the cost of checksum validations and recalculations would still be incurred for other fragments at each router in the path, exaggerating the cost/wastefulness of the additional processing time given the original datagram could never be reconstructed. It’s worthy of noting that in IPv6 the checksum has been removed entirely, given the presence of similar validations in both upper layers (TCP and UDP have checksums over the entire payload) and even in lower layers (Ethernet, Wi-Fi, and PPP have CRCs/checksums).