COMS3200 – Assignment 2 | My Assignment Tutor

1The University Of QueenslandSchool of Information Technology and Electrical EngineeringSemester One, 2021COMS3200 – Assignment 2Due: 3:00pm 19th May, 2021Marks: 100Weighting: 20% of your final gradeRevision: 0.9IntroductionThis assignment introduces the use of Network Layer and Link Layer (from OSI Models) aswell as socket programming (simulation) on each of these devices: adapters, switches androuters. After finishing the assignment, you will understand how data is sent throughout theinternet.This assignment contains three parts. For Part A and B, you will need to submit your answersthrough Blackboard Quiz. for Part C, you will submit your code via COMS3200 subversion(SVN). All submitted works are marked automatically. It is strongly recommended that youread this spec carefully before you start working, as to avoiding any mistakes.This assignment is to be your individual work. Using answers (or code) that you did notcalculate (or write) is against course rules and may lead to a misconduct charge.Part A (21 marks)Answer each of the following questions in the associated quiz on Blackboard, following thespecified instructions. All answers will be automatically marked.You have established a new server for COMS3200 Inc, called RUSHBSvr (in assignment 1).It works perfectly and has grown so much in users recently that the company must nowupgrade their network.You, a supervisor of this project, has assigned the task of designing two (2) new networks, abranch in Sydney and a local system for working at home. You also moved the File Server to“somewhere” on the Internet to serve as a centralise data centre for your company. Then, youended up with the network map on next page.To minimise spending for this system, you set up for only one DNS Server (D2) and oneDCHP Server (D1). You claimed that the system will run smoothly without paying more forbuilding extra servers, and it works.2Figure 1. A simple internet mapYou are now required to explain to your colleagues how your system works with somescenarios given below. You can use these assumptions to support your answers:1. The broadcast MAC address of all the LANs is FF:FF:FF:FF:FF:FF.2. All forwarding tables in the switches and routers are up to date.3. All valid protocols are HTTP, FTP, SSH, DNS, DHCP, UDP, TCP, ICMP, SNMP,ARP, OSPF, and BGP. If there are 2 protocols used at the same time (e.g., SSH andTCP), choose the highest level (lowest layer) only (e.g., TCP).4. D2 is a DNS Server, and D1 is a DHCP Server.You will have to fill out the table and answer some questions in Blackboard. Each student’squestions will have different values (that is replaced by XXX…). Your question values willbe shown in the quiz. Please be careful to double-check before submitting your work toBlackboard, as you can submit only once.Task: Answer the questions below on Blackboard.Question 1: Host A just joined the network and currently does not have an IP address. Pleasecomplete the following table describing the four packets that will be transmitted through theServer SL7…InternetHost CR1-LAN 2R2-LAN 1AP2DHCP Server (D1)Host BAP1Host AR1-LAN 1DNS Server (D2)AP2-Internet 2AP1-Internet 1Switch 2 Switch 1Switch 33network upon this event (in the order they were sent), assuming that all requests succeed,and Host A ends up with IP address XXX.XXX.XXX.XXX. ProtocolOpcodeSourceMAC addressDestinationMAC addressSource of senderIPv4 addressDestination oftarget IPv4 address Question 2: After ending up with the IP address above, Host A wants to send a standardDNS query to the DNS Server. Host A has already gotten the IPv4 addresses of the DNSServer and its gateway router from the DHCP Server. Router 1’s ARP table contains allhosts’ IP and MAC addresses in the network, and all other ARP tables are empty. Completethe following table describing the first four packets transmitted through the network uponthis event, and no additional ongoing communications. ProtocolOpcodeSourceMAC addressDestinationMAC addressSource of senderIPv4 addressDestination oftarget IPv4 address Question 3: Host A now wants to establish a HTTP connection with the Server S (see thefigure 1 above). You may assume that Host A knows S’s IP address and that all ARP tablescontain all required information to transmit any packet. Complete the following tabledescribing the packets that are sent to transmit Host A’s request to initialise the connection,assuming the request is being sent from TCP port XXXX and the following available portnumber in Router 1’s NAT table is XXXX. Give the TCP flags as an 8-bit binary numberrepresenting the CWR to FIN flags. ProtocolOpcodeSourceMAC addressDestinationMAC addressSource of senderIPv4 addressDestination oftarget IPv4 addressTCPTCP Question 4: In addition to the connection described in question 3, Host B’s port XXXX is alsocurrently connected to S. What are the contents of the NAT table in R1 while theseconnections remain alive? (if a new port is required, use port XXXX).4 LAN IPLAN PortWAN IPWAN Port Question 5: Suppose X sent a packet with the destination IP address XXX.XXX.XXX.XXXand destination MAC address XX:XX:XX:XX:XX:XX. What network devices (hosts, servers,routers, switches) in the above diagram would receive this packet?Question 6: Server S sends a packet with the destination IP address XXX.XXX.XXX.XXX.What network devices (hosts, servers, routers, switches) in the above diagram would receivethis packet?Part B (9 marks)Answer each of the following questions in the associated quiz on Blackboard, following thespecified instructions. All answers will be automatically marked.In this part, you will need to use Wireshark to analyse a packet capture file, named a2.pcap.This packet capture shows a client connecting to a LAN network, then a ‘traceroute’ commandbeing run from the client. Some of the relevant IETF RFCs may help you in understandingthe following questions. In particular:1. RFC 2131 for Dynamic Host Configuration Protocol (DHCP)2. RFC 791 for Internet Protocol (IP)3. RFC 1034 for Domain Name System (DNS)4. RFC 6747 for Address Resolution Protocol in IPv4 (ARP)This is a real-life scenario Wireshark trace and has been updated to the newest protocol. Werecommend you to ask any questions you may have for this trace besides the given questionsto provide you with more understanding of how LAN networking works. You need to befamiliar with using the Wireshark filter feature to answer these questions.Task: Answer the questions below on Blackboard.Question 1: The client joined the LAN networking successfully. What is the assigned IPaddress from the DHCP Server to this client? (1 mark)Question 2: What is the MAC address of the client? (1 mark)Question 3: What is the netmask of this LAN network? (1 mark)Question 4: What is the DHCP Server’s IP address? (1 mark)Question 5: What is the MAC address of the DHCP Server? (1 mark)Question 6: Is this LAN network a subset of a bigger LAN network? (1 mark)Question 7: What is the target IP address of the traceroute command? (1 mark)Question 8: Does the traceroute command run successfully, or give up while waiting for anICMP response? (1 mark)5Question 9: How many routers are there between the host (where it runs the traceroutecommand) and the target server? (1 mark)Question 10 (bonus): The client connects to the LAN network through a password enabledwireless connection, what is the security standard used for this Access Point? (1 mark)Hints:1. For each TTL, traceroute sends the packet 3 times.2. The DHCP Server is attached to another device.3. Please use the Wireshark filter where appropriate.4. Available security standards you can choose are WPA/WPA2 (personal or enterprise),WEP, and WPA3.Part C (70 marks)Your company is doing well thanks to your RUSHBSvr. Due to a network upgrade in Sydney,your superiors want a new protocol because they feel the current protocols are toocumbersome and complicated. As seen in Figure 1, the RUSHBSvr is now located somewhereelse on the Internet, and you are tasked with setting up the protocols needed to exchangedata with the server.To accomplish this part, you will need to implement two virtual protocols: RUSHBAdapteron the link layer, and RUSHBSwitch on network/transport layer protocol. Virtual means thatyour program is simulating those protocols in the application layer; that is, network layeraddresses will not correspond to physical interfaces.Again, this is an individual assignment. You can feel free to discuss aspects of socketprogramming and the specification with fellow students. Directly helping (or seeking helpfrom) other students with the actual coding of your solution is considered cheating, as wellas looking at another student’s code (even if it’s in printed or in electronic form). All of yoursubmitted code will be subject to automated checks for plagiarism and collusion on moss anddetected plagiarism or collusion will be reported for misconduct proceedings. If you’re havingtrouble, please seek help from a member of the teaching staff. Don’t be tempted to copyanother student’s code, and don’t commit any code to your repository unless it’s your work.SimulationYou need to implement two programs in this part, RUSHBAdapter and RUSHBSwitch,representing the link and network layer RUSHB protocols respectively. You have alreadyimplemented the application layer RUSHB protocol, RUSHBSvr. Since this a simulatednetwork, they are all implemented in the application layer of the OSI model of networking inpractice (see figure below).6 OSI MODELRUSHB MODEL (SIMULATION)LINK LAYEREthernetLINK LAYER &NETWORK LAYERRUSHBSwitchNETWORK LAYERIPTRANSPORT LAYERUDP/TCPRUSHBAdapterAPPLICATION LAYERHTTP/…APPLICATION LAYERRUSHBSvr/… Figure 2. Network layers mappingRUSHBAdapter and RUSHBSwitchRUSHBAdapter is supposed to work as an adapter for one process only through TCP (e.g.RUSHBSvr). The process that connects to RUSHBAdapter needs to open a socket underlocalhost (127.0.0.1) as a listener under an available port (assigned by the kernel). However,in this assignment, your RUSHBAdapter is not required to listen to any processes, instead,it will listen to your stdin (see the figure below).RUSHBSwitch works like a network router, and it can be local or global. A localRUSHBSwitch can listen to many RUSHBAdapter through a UDP and connect to manyglobal RUSHBSwitches through TCP. In the meantime, the global RUSHBSwitch cannotlisten to any RUSHBAdapter, but can connect to other RUSHBSwitches. This is a diagramexplaining how RUSHBAdapters and RUSHBSwitches are connected:Figure 3. End-to-end connection in RUSHBThe final goal for this programming assignment is sending and receiving data across theglobal network without losses and errors. Data can be anything that can attached to thelocal globalglobal localstdinstdout7adapter, such as netcat, or RUSHBSvr, or even stdin (as in this assignment). From now, wewill refer to RUSHBAdapter as the adapter and RUSHBSwitch as the switch.[Adapter Invocation]The adapter takes the following command line arguments (in order):• the port number of the switch that will connect to in UDP protocolFor example, if the switch is listening on an UDP port 5678, then the adapter runs as: Pythonpython3 RUSHBAdapter.py 5678Javajava RUSHBAdapter 5678C or C++./RUSHBAdapter 5678 [Greeting Protocol]When first executing, the adapter will make “a greeting protocol” to the switch through aUDP port number to get its local IP address, each of the greeting packets is in the structurebelow. Note that from now, we will define each block of a packet has a total of 4 bytes,divided by 4, each one is 8 bits. BIT081624SOURCE IP ADDRESSDESTINATION IP ADDRESSRESERVED (all 0s)MODEASSIGNED IP ADDRESS Figure 4. Greeting structure in RUSHBMODE = 0x01: DISCOVERYMODE = 0x02: OFFERMODE = 0x03: REQUESTMODE = 0x04: ACKNOWLEDGEFigure 5. MODE instruction in RUSHBFigure 6. Then greeting process between RUSHBAdapter and RUSHBSwitchRUSHBAdapter RUSHBSwitchDISCOVERYREQUESTOFFERACKNOWLEDGE8We call RUSHBSwitch in the case above is the host, and RUSHBAdapter is the client. It willwork as follow:1. In a DISCOVERY message, since the sender has not know its IP address in the hostnetwork yet, then SOURCE IP ADDRESS and ASSIGNED IP ADDRESS should beleft at 0x00000000 (let the host fill out the assigned IP address).2. The OFFER from the host contains the ASSIGNED IP ADDRESS, and the SOURCEIP ADDRESS is the address of the switch itself, but the DESTINATION IPADDRESS should be left at 0x00000000 (since the client has not accept the offer yet).3. After receiving the offer from the host, your adapter (or switch for the upcoming part)now send back the request for the assigned IP address. The REQUEST should containsthe value of DESTINATION IP ADDRESS and ASSIGNED IP ADDRESS, whileSOURCE IP ADDRESS should be left at 0x00000000.4. The host sends back an acknowledgement message with all the fields must be filled.The client must send a discovery message when first connected to the switch, and the hostmust send back the assigned IP address if there are spaces for the client to join in the network.After receiving an acknowledgment from the host, the client should remember its IP addressand the router IP address for the upcoming event.[IP Address Allocation]Your assigned IP addresses with CIDR notation and IP addressing allocation in the subnetmust follow the guideline of RFC 1518 and RFC 1519. To be clear, CIDR notation must bevalid with the associated IP address. For example, with 192.168.0.1/24, the switch IPaddress is 192.168.0.1, the next available IP address in this subnet should be 192.168.0.2,and the total hosts can be accepted in this subnet is 254.If there are more than 254 hosts connected to your switch, your switch should ignore theincoming connections and not giving the [Greeting Protocol] stated in page 7.[Adapter Commandline Interface]After finishing the greeting protocol, your adapter should print out (to stdout) the character”>” followed by a white space, to tell the user that it is ready for user commands.For example, if you make your program using C99, and you want to type “HELLO_WORLD” asa command:./RUSHBAdapter 5678> HELLO_WORLDThe commandline interface for the adapter will only accept the command ”send” with usage:> send {receiver_ip_address} {message}9Where {receiver_ip_address} is the IP address of the receiver and {message} is themessage that you want to send (separated with a white space). For example, if you want tosend “HELLO_WORLD” to the IP address 130.102.71.65, then you would use the command:> send 130.102.71.65 “HELLO_WORLD”To process the user command, your adapter will build a packet with the structure in figure7. For example, your adapter was assigned with IP 192.168.0.2 from the host (from192.168.0.1) and sends “HELLO_WORLD” to 130.102.71.64, your adapter need to send to192.168.0.1 with MODE 0x05 in figure 8 below. BIT081624SOURCE IP ADDRESSDESTINATION IP ADDRESSRESERVED (all 0s)MODEDATA Figure 7. Data structure in RUSHB BIT081624192.168.0.2130.102.71.640x0000000x05HELLO_WORLD Figure 8. An example of data packetPlease remember, the network byte order is defined to always be big-endian, and it may differfrom your host. After processing a command from a user, your adapter should print out thecharacter “>” followed by a white space again for the next command.When your adapter receives an EOF (end of file) from any file or socket descriptors, it shoulddo nothing, not accepting input anymore, and works their jobs normally insteads of early exit.[Data Communication]The adapter should also be able to receive the packet from its connected switch (in thenetwork). The switch will ask if your adapter is available to receive the packets before sendingthem. The querying packet will be sent with the structure in figure 9 with MODE 0x06. Forexample, the packet will be sent as in figure 10. BIT081624SOURCE IP ADDRESSDESTINATION IP ADDRESSRESERVED (all 0s)MODE Figure 9. Querying structure in RUSHB BIT081624192.168.0.1192.168.0.20x0000000x06 Figure 10. An example of query packetYour adapter (or client) will respond with MODE 0x07 to tell the server that it is ready toreceive the packets (see figure 11 and 12). This is also applied for the transmission between 2switches, the sender switch will send the packet with MODE 0x06, and the receiver switch10will reply back with MODE 0x07. However, when an adapter sends a message to a switch, itwill not need to ask if it is available. BIT081624SOURCE IP ADDRESSDESTINATION IP ADDRESSRESERVED (all 0s)MODE Figure 11. Response structure in RUSHB BIT081624192.168.0.2192.168.0.10x0000000x07 Figure 12. An example of response packetThen, the sender will send packets to the client with MODE 0x05. The receiver needs to printout the data it received. For example, if a host from 130.102.71.64 sends “HELLO_WORLD”after the query protocols established, the sender will send the packet as in figure 11. Pleasenote that even though the switch that sends the message to the adapter has an IP address192.168.0.1, the source IP address in the packet is still 130.102.71.64, as it is the origin of thepacket. BIT081624130.102.71.64192.168.0.20x0000000x05HELLO_WORLD Figure 13. An example of data packet from a global hostWhen receive the data packet, your adapter should print out to stdout in this form:Received from {source_ip}: {data}nFor example, with the packet above, the adapter will print this out with a newline:Received from 130.102.71.65: HELLO_WORLDThere are few things you need to remember for sending and receiving packets:1. Your program should remove the characters “> ” before print out the receivedmessage, then, it should print the characters “> ” again for the next user command.2. We send and receive messages through the port number in the localhost (127.0.0.1),and assuming that the port number is in link layer of RUSHB Models.3. Your adapter (or switch) won’t have to send the checking packets (mode 0x06 and0x07) again if the checking protocol already done within 5 seconds. After 5 seconds ofthe checking protocols, if there is an upcoming packet, your adapter (or switch) has toestablish the checking protocol again.114. If any packets that are not in the given protocols or invalid, your adapter and switchshould ignore them.[Switch Invocation]The switch will take the following command line arguments (in order):• the type that the switch will be (either local or global)• the IP address with the CIDR notation indicating its subset• (optional for local) the second IP address with the CIDR notation indicating its subset• the latitude of the switch in the map• the longitude of the switch in the mapTo simply the calculations, latitude and longitude are denoted as the positive integers,represent the coordinates on a cartesian plane, where latitude is horizontal x-axis andlongitude is the vertical y-axis.Figure 14. End-to-end connection with the areasThe switch invocation will have three modes:1. If you want to run the switch in local mode that initially has one listening socket on aUDP port for adapters (the blue area in figure 14), with the LAN IP address is192.168.0.1/24, and at the location is (2, 5), then the execution is: Pythonpython3 RUSHBSwitch.py local 192.168.0.1/24 2 5Javajava RUSHBSwitch local 192.168.0.1/24 2 5C or C++./RUSHBSwitch local 192.168.0.1/24 2 5 2. If you want to run the switch in local mode with two listening socket, one is for thelocal adapters through a UDP port, and another one in a global area that listen in thelocal globalglobal local12TCP port for other switches (the red area in figure 14), with the LAN IP address is192.168.0.1/24, the global IP address is 44.45.46.0/8, and at the location is(140, 26), then the execution is: Pythonpython3 RUSHBSwitch.py local 192.168.0.1/24 44.46.46.0/8 140 26Javajava RUSHBSwitch local 192.168.0.1/24 44.46.46.0/8 140 26C or C++./RUSHBSwitch local 192.168.0.1/24 44.46.46.0/8 140 26 3. If you want to run the switch in global mode (the yellow area in figure 14), with theglobal IP address is 172.64.2.1/16, and the location is (465, 784) then the executionis: Pythonpython3 RUSHBSwitch.py global 172.64.2.1/16 465 784Javajava RUSHBSwitch global 172.64.2.1/16 465 784C or C++./RUSHBSwitch global 172.64.2.1/16 465 784 Your program should print out the port number to stdout with a new line. For the switchlistening in both TCP and UDP ports, it should print port on UDP first, and then TCP. Itshould also print out (to stdout) the character ”>” followed by a white space, to tell the userthat the adapter is ready for user commands.There are some examples of the switch invocation:1. The switch is local and listening on a UDP port, the kernel gives it port number 4455:python3 RUSHBSwitch.py local 192.168.0.1/24 2 54455>2. The switch is local and listening on both UDP and TCP ports, the kernel gives it a portnumber 4455 for TCP and 6677 for UDP:python3 RUSHBSwitch.py local 192.168.0.1/24 22.23.24.1/24 2 566774455>3. The switch is global and listening on a TCP port, the kernel gives it port number 1234:python3 RUSHBSwitch.py global 1.2.3.1/24 456 7891234>13[Switch Connection]With any incoming connection requests from the adapters or other switches, your switch mustbe able to run the [Greeting Protocol] that stated on page 7; also, your switch needs to giveeach of them the smallest available IP address based on its netmask and the runningconnections. For example, if an adapter connecting to your switch with host IP address is192.168.0.1, and there are two adapters currently connecting, then the available IP addressthat you will give to the incoming adapter is 192.168.0.4 as in the figure 15 below. BIT081624192.168.0.10x000000000x0000000x02192.168.0.4Figure 15. An example of the offerCommandline Interface]line for the switchaccepts the command ”connect” with usageis the TCP port number of the hostyour switch will connect to that port. Tdefined in page 7.command (or first establish the connection) will sends./RUSHBSwitch44.45.46.01/24OFFER 44.45.46.02REQUEST 44.45.46.0244.45.46.02RUSHBSwitch ing message[Switch The commandand TCP)(not applicable for the local switch listening on both UDP > connect {port_number} where {port_number}the command executed,protocol as same as the [Greeting Protocol]”connect”switch it want connects to. Whenhen, it sends a greetingThe switch receives thethe greeting message first. Figure 16. The greeting protocol between a local switch and a global switchconnect./RUSHBSwitch192.168.0.1/24ACKNOWLEDGE 192.168.0.1 44.45.46.0244.45.46.01 ??RUSHBSwitchDISCOVERYREQUESTOFFERACKNOWLEDGE14After finishing the greeting between switches, your switch also needs to send a message totell its location, in MODE 0x08, and within the structure below. BIT081624SOURCE IP ADDRESSDESTINATION IP ADDRESSRESERVED (all 0s)MODELATITUDELONGITUDE Figure 17. Location packet in RUSHB BIT08162444.45.46.0244.45.46.010x0000000x0825 Figure 18. An example of location packetThe receiver switch will reply them to tell you where it is (see an example in the figure below). BIT08162444.45.46.0144.45.46.020x0000000x08465784 Figure 19. An example of location packetWhen receiving a location packet, your switch should broadcasts the information about thedistance of the new neighbour, to the current neighbours (see figure 20). To calculate thedistance between you and the new connecting switch, we use this formula:𝑑𝑖𝑠𝑡𝑎𝑛𝑐𝑒 = +(𝑥! – 𝑥”)! + (𝑦! – 𝑦”)!In the example above the distance will be calculated below, and rounded down:𝑑𝑖𝑠𝑡𝑎𝑛𝑐𝑒 = +(465 – 2)! + (784 – 5)! = 906.20 ≈ 906The broadcast message will be sent in the structure in figure 20 with MODE 0x09, but withthe distance added with the distance from the source switch to the destination switch. Supposeyou received a packet in figure 19, you have connected to a router with IP address 47.48.49.01,your IP address is 47.48.49.02 in that network, the distance between you and the host is 94,then the message you will send to 47.48.49.01 will be in figure 21. BIT081624SOURCE IP ADDRESSDESTINATION IP ADDRESSRESERVED (all 0s)MODETARGET IP ADDRESSDISTANCE Figure 20. Broadcasts message in RUSHB BIT08162447.48.49.0247.48.49.010x0000000x0944.45.46.011000 Figure 21. Example of broadcast message15If your switch received a packet with MODE 0x09, you also need to broadcast that messageto all your neighbours except the one in SOURCE IP ADDRESS, DESTINATION IPADDRESS or TARGET IP ADDRESS. Please remember that you only can broadcast themessage to other switches if they are connecting with you. The switch will not send theboardcast message to its adapters.There are few things about commandline and broadcasting message that you need to know:1. For the local switch that listening on both UDP and TCP, it won’t accept the connectcommand, thus if user input a connect request, it should do nothing.2. After a command from a user, your program should prints out the character “>”followed by a white space for the next input. If it receives any packet with MODE0x09 with distance larger than 1000, your switch should ignores that packet.3. We assume that all the switch will have a different CIDR IP address, as well as itsrange, for example, if there exists a switch with IP address 42.43.44.1/8, then, therewill be no other switches that has the IP address start with 42.XXX.XXX.XXX/8, thisalso be applied for the local networks.4. If your switch receives the same MODE 0x09 packet (same SOURCE IP ADDRESS,DESTINATION IP ADDRESS and TARGET IP ADDRESS) but the distance islarger, then it should ignore that paket (and not sending to neighbours).In the case of a global switch (invocation number 3 on page 12) that connects to a local switch(invocation number 2 in page 12); after the greeting protocols, local switch then sends adistance packet of its UDP side to that global switch. The distance field of the packet is thedistance from the local switch to the global switch. For example, if switch A (global) connectsto switch B (local) as in the figure below. After the greeting protocols and the locationexchange, B then sends a distance packet to tell A that the distance from A to 10.0.0.1 is 10,suppose that the distance between A and B is 10. BIT08162447.48.49.0147.48.49.020x0000000x0910.0.0.110Figure 22. Example of distance packet connect./RUSHBSwitch local44.45.46.01/24 10.0.0.1/8 …./RUSHBSwitch global192.168.0.1/24 …OFFER 44.45.46.02REQUEST 44.45.46.02ACKNOWLEDGE 44.45.46.02192.168.0.1 44.45.46.0244.45.46.01 10.0.0.1DISTANCE OF 44.45.46.02…DISTANCE OF 10.0.0.1A BBA 16When your switch receives an EOF (end of file) from any file or socket descriptors, it shoulddo nothing, not accepting input anymore, and works their jobs normally insteads of early exit.[Fragmentation]If your switch receives a data packet (MODE 0x05) with the total size larger than 1500 bytes(including header) as in figure 22, it must:1. Splits the packet by smaller chunks with the maximum size of 1500 bytes2. Send the chunks with MODE 0x0a (more fragments coming), and the last chunk withmode 0x0b (last fragment packet) with the structure as same as in figure 23.3. Set-up an offset, from the second packet. BIT081624192.168.0.2192.168.0.30x0000000x05“A” x2000 Figure 23. A 2012 bytes data packet BIT081624SOURCE IP ADDRESSDESTINATION IP ADDRESSOFFSETMODEDATA Figure 24. Fragmentation in RUSHBFor the data packet in figure 23, your switch must splits it into 2 packets: BIT081624192.168.0.2192.168.0.30x0000000x0a“A” x1488 Figure 25. A 1500-bytes data packet BIT081624192.168.0.2192.168.0.30x0005d00x0b“A” x512 Figure 26. A 524-bytes data packetAs you can see, packet in figure 26 has an offset of 0x5d0 (1488 in decimal), denotes thatthe data in this packet starts at index 1488.When your adapter receives the message with mode 0x0a it should wait for the next packetsuntil receives packet mode 0x0b. Then, it prints to stdout the data it received (as normal).For the example above, your adapter will print out:Received from 192.168.0.2: AAA………AAAAwith 2000 letter A’s.Fragmentation is applicable for the switches only. Also, the adapters are able to send anypackets with the maximun size of 55296 bytes.17[Forward]If your switch receives data messages (MODE 0x05, 0x0a and 0x0b), it should forwards themessage to another routers until it reached the destination, with these conditions:1. The router that receives the forward message has to be one that could form a shortestpath (based on the distances) to the destination.2. Every message must follow the [Data Communication] in page 9.3. If the router that receives the a message and its IP address is the same as thedestination IP address as in the packet, it should print to stdout the message itreceived, as same as [Data Communication] in page 10.4. If your switch doesn’t know the existance of the destination’s IP address, it will forwardthe message to the longest prefix matching of the next switch IP address (Kurose,p.344, 4.2.1).5. In case of 2 paths that have the (same) shortest distance to the destination, yourswitch must sends the message to the switch that has the longest prefix matching(Kurose, p.344, 4.2.1). This is only applicable for the case your switch knows theexistance of the destination’s IP address, if not, rule number 4 must be applied.In the example below, A wants to send to B a message, and we assume that all routers in anetwork have their IP address and distances assigned in the figure 24. Then, the message willbe forwarded in each switch within the green line to get to the destination.Figure 26. End-to-end connection with the IP addresses and distancesIn the case of a coming data packet with the destination IP address is 129.0.0.1 and:1. Your switch doesn’t have any information about the destination IP address from theboardcast messages.2. Your switch is connecting to a switch has an IP address of 135.0.0.1 and a switch hasan IP address of 136.0.0.1.Your switch should sends the message to the switch that has an IP of 135.0.0.1 since itmatches the longest prefix of the IP address (1000 0001 and 1000 0111 rather than 1000 0001and 1000 1000).A 192.168.0.1 1.2.3.41.2.3.12.3.4.52.3.4.13.4.5.63.4.5.15.6.7.85.6.7.16.7.8.96.7.8.17.8.9.107.8.9.1 9.10.11.1210.11.12.139.10.11.110.11.12.110.0.0.110.0.0.21510702559555BA B18You are free to implement any algorithms you would like to, but your adapter and switchmust not send any extra packets than the packets that have stated above. Also, all theprograms must be thread-safe, if race-condition occurred in some tests, you might get 0 forthese. As long as your program works as expected, you will receive full marks for that part.SubmissionYour programs must be written in Python, Java, C, or C++. Your program should be ableto be invoked from a UNIX command line as follows. It is expected that any Python programscan run with version 3.6, any Java programs can run with version 8, any C programs have tobe complied with the standard of C99 or GNU99. No external libraries or extensions ispermitted for use in your program. Pythonpython3 RUSHBAdapter.py {port}python3 RUSHBSwitch.py {local|global} {ip} [optional_ip] {x} {y}Javamakejava RUSHBAdapter {port}java RUSHBSwitch {local|global} {ip} [optional_ip] {x} {y}C or C++make./RUSHBAdapter {port}./RUSHBSwitch {local|global} {ip} [optional_ip] {x} {y} Figure 8. Filename and Command-Line syntax for the submissionNo late submissions will be marked for this assignment under any circumstances. Submissionmust be made electronically by committing using subversion. In order to mark yourassignment, the markers will check out /trunk/ass2/ from your repository onsource.eait.uq.edu.au. Please do not create subdirectories under /trunk/ass2/. Themarking may delete any such directories before attempting to compile. Code checked in toany other part of your repository will not be marked.IMPORTANT NOTICE: As the assignment is auto-marked, it is very important that thefilename and command-line syntax exactly matches the specification above. Specificationadherence is critical for passing. If your program is failed to executed because of the wrongsyntax, you will receive a 0 for the assignment without any exceptions.MarkingMarks will be awarded for functionality only. The tests will mostly check your program’sbehaviour and packet structure.19Provided that your code compiles (see above), you will earn marks based on the number offeatures your program correctly implements. Partial marks may be awarded for partiallymeeting the functionality requirements. Not all features are of equal difficulty. If your programdoes not allow a feature to be tested, you will receive 0 marks for that feature, even if youclaim to have implemented it. For example, if your program can never open a file, we cannotdetermine if your program would have loaded input from it. The markers will make noalterations to your code (other than to remove code without academic merit). Your programshould not crash or lock up/loop indefinitely (without any reason). Your program should notdelay for unreasonably long times.For RUSHBAdapter:• execute and run (5 marks)• send and receive packet (5 marks)• packet build and protocols (5 marks)• command line interface (5 marks)For RUSHBSwitch:• execute and run (10 marks)• ip validation capacity (5 marks)• send and receive packet (5 marks)• packet build and protocols (5 marks)• command line interface (5 marks)For the combination of 2 or more processes:• message transmission in a simple map (10 marks)• complete transmission in a big map (10 marks)Specification updatesIt is possible that this specification contains errors or inconsistencies, or missing information.It is possible that clarifications will be issued via the course website. Any such clarificationsposted five (5) days or more before the due date will form part of the assignment specification.If you find any inconsistencies or omissions, please notify the teaching staff.Tips and hints0. Start your assignment early.Updates0.1 Initial release20 0.20.30.40.50.60.70.80.9Add clarification and edit part BEdit part BAdd clarificationAdd clarificationAdd clarificationAdd clarification for FragmentationAdd clarification for EOFAdd clarification for Routing

QUALITY: 100% ORIGINAL PAPER – NO PLAGIARISM – CUSTOM PAPER

Leave a Reply

Your email address will not be published. Required fields are marked *