Starting from:

$24.99

COMS3200/7201 Assignment 3 Solution

Part A asks some questions on packet behavior in the following network, which depicts three LANs and a file server connected to the internet.

Answer each of the following questions in the associated quiz on blackboard, following the specified instructions. All questions will be automatically marked. Each question follows on from the previous question - that is, for each question you can assume the tasks described in the previous question(s) have been fully completed.
Protocol Opcode Src MAC addr Dst MAC addr Src/Sender IPv4 addr Dst/Target IPv4 addr




Protocol Opcode Src MAC addr Dst MAC addr Src/Sender IPv4 addr Dst/Target IPv4 addr




Protocol TCP Flags Src TCP port Dst TCP port Src/Sender IPv4 addr Dst/Target IPv4 addr
TCP
TCP
LAN IP LAN Port WAN IP WAN Port


This question requires you to analyse the Wireshark file assign3.pcapng. This packet capture shows a client using the tracert/traceroute command to find the path that is taken from their machine to an external server. Note that the trace has been slightly modified, so not all information conveyed in this trace is representative of real-world information.
Answer each of the following questions in the associated quiz on blackboard, following the specified instructions.
All questions will be automatically marked.
1. What is the IPv4 address of...
(a) The network’s gateway interface? (1 mark)
(b) The network’s DHCP server that offers the client’s IP address? (1 mark)
(c) The network’s primary DNS server? (1 mark)
3. Consider the ARP packet shown in frame 26
(a) Who is the vendor of the receiver’s NIC? (1 mark)
(b) Is this a broadcast, multicast, or unicast message? (1 mark)
4. Which of the following Ethernet fields are not captured in any of the Wireshark frames in this trace? (theremay be multiple) (1 mark)
i. SFD ii. Source MAC address iii. Destination MAC address iv. Ethertype v. Payload vi. CRC
(Optional extension question (not marked): Can you explain why not all fields are not captured?)
9. What is the IPv4 address of the DNS server used to retrieve the information in (8)? (1 mark)
The following questions each ask you to provide a Windows command-line command. In any case where multiple commands exist, you should use the one taught in the Wireshark labs for this course (we will of course be flexible on the order of parameters in the commands when marking). Assume for each of the following scenarios, the user has waited until the command has finished its execution (without manually terminating it early).
10. What command was likely used by the user to initiate the packet transmission captured in the followingframes?
(a) Frame 16 (1 mark)
(b) Frames 19 to 23 (1 mark)
In this part of the assignment you will be required to implement the network layer for a host running on a virtual IP network. You should be familiar with the typical TCP/IP stack (A.K.A. the DoD model or internet protocol suite), where Ethernet is used as a link-layer protocol and IPv4 used as a network layer protocol. The protocols we will be using will be virtual - that is, network layer addresses won’t actually correspond to physical interfaces. To do this, the network stack will be redefined to that shown in the table below.
TCP/IP Stack Protocols Virtual Stack
Network Layer
Transport layer UDP Link layer
Network layer IPv4
Link Layer Ethernet
As described in the above figure, UDP will be used as your virtual network’s link layer, and you will be required to implement a virtualisation of IPv4 ontop of this UDP-based link layer. Each UDP socket will correspond to a link layer interface, and localhost UDP port numbers will be used as the link layer addressing system of this virtual network.
By the end of this assignment, your implemented host program should be able to:
• Accept simple user commands through a basic command line interface (CLI)
• Send and receive messages across this virtual network layer
• Handle fragmentation of virtual IP packets
Program Invocation
Your program should be able to be invoked from a UNIX or UNIX-like command line as follows. It is expected that any Python programs can run with version 3.6, and any Java programs can run with version 8. The ip-addr and ll-addr parameters correspond to the IPv4 address in CIDR notation (indicating the client’s subnet) and link layer address (UDP port number) of your host program respectively.
Python python3 assign3.py ip-addr ll-addr
C/C++
make
./assign3 ip-addr ll-addr
Java
make java Assign3 ip-addr ll-addr
Your Task
• gw set [ip-addr] : set the gateway IP address of the subnet the client is a part of to [ip-addr] (overriding any existing gateway address)
• gw get : print the currently stored gateway IP address to stdout, or None if no gateway address has been specified
• arp set [ip-addr] [ll-addr] : insert a mapping from [ip-addr] to [ll-addr] in the host’s ARP table (overriding any existing entries for [ip-addr])
• arp get [ip-addr] : print the currently stored link layer address mapped to [ip-addr] to stdout, or None if no mapping exists
• exit : terminate the program
• msg [ip-addr] "[payload]" : send a virtual IPv4 packet to [ip-addr] with the given payload (which will be supplied as a string)
In addition to sending packets, your program should be able to receive them from other hosts. When your program receives an IPv4 packet with the protocol indicator set to 0, it should print the payload of that packet to stdout, in the below format ([ip-addr] should be replaced with the sender’s IPv4 address and [message] should be replaced with the string encoding of the payload):
Message received from [ip-addr]: "[message]"
Note that there is only a single space after the colon. When your program receives an IPv4 packet with a non-zero protocol number, it should print the following message to stdout ([proto-num] should be the hexadecimal representation of the protocol formatted as 0x??):
Message received from [ip-addr] with protocol [proto-num]
You can assume all packets sent to your program are valid IPv4 packets. You should be able to receive messages at any time without blocking the CLI, and any messages should be printed cleanly (without any CLI prompts or responses disrupting the message contents). Remember to backspace the current prompt (the > character) before printing the output.
• mtu set [value] : set the MTU of the network’s links as the specified [value]
• mtu get : print the currently stored MTU (the default MTU should be 1500)
Virtual packets that are longer than the specified MTU (or the default MTU if none has been specified) should be fragmented before transmission. The length of a virtual packet is equal to the length of the IPv4 header added to the length of the IPv4 payload (i.e. you don’t need to consider the length of the non-virtual headers). You can assume the value of the MTU will never be smaller than 100.
Your program should also be able to receive packets that have been fragmented (and display them as a single message).
Example CLI output
python3 assign2.py 192.168.1.1/24 1024
> gw get
None
> gw set 192.168.1.30
> gw get
192.168.1.30
> msg 192.168.1.2 "hello"
No ARP entry found
> arp get 192.168.1.2
None
> arp set 192.168.1.2 2222
> arp get 192.168.1.2
2222
> msg 192.168.1.2 "hello"
> mtu get
1500
> mtu set 1600
> mtu get
1600
Message received from 192.168.1.2: "hello there, thankyou for your message"
Message received from 192.168.1.3 with protocol 0x06
> exit
Packet Formatting
Your IPv4 packets don’t need to contain meaningful values for the DCSP/ECN fields, nor are you required to compute a correct checksum. You can assume packets will never contain any options and subsequently that the IHL will always be 5. The TTL field should contain some meaningful value (i.e. to allow the packet to reach its destination).
Tips for Success
• Revisit the lectures and labs on the internet layer of the TCP/IP stack (in particular the lectures on IPv4)
• Make sure you fully understand the requirements of this assignment before commencing work
• Ensure you always exercise good thread safety if using threads to implement concurrency
• Frequently test your code
• Ensure your base functionality is working (such as the CLI) before attempting the more difficult tasks
• Start early and ask any questions you might have early
Library Restrictions
• You can’t use any libraries that aren’t considered standard for your language (i.e. if you have to download a library to use it it would be considered as non-standard)
Submission
Submit all files necessary to run your program. At a minimum, you should submit a file named assign3.py, assign3.c, assign3.cpp or Assign3.java. If you submit a C/C++ or Java program, you should also submit a makefile to compile your code into a binary named assign3 or a .class file named Assign3.class.
IMPORTANT: If you do not adhere to this (eg. submitting a C/C++/Java program without a Makefile, or a .class file instead of a .java file), you will receive 0 for this part of the assignment.
Marking
Academic Misconduct
• Released assignment
• Clarified that there is only one space after colons in output

More products