Exercise 5:
a) Briefly describe what the Domain Name Service (DNS) is and what it is
used for. Would internet work without a DNS?
• DNS is the system that translates domain names into IP addresses, which
allows users to access websites using easy-to-remember web addresses
instead of complex IP addresses.
• Yes, Internet would work even without the DNS but, users would have to
manually enter the IP address of servers.
b) Describe the difference between an IP number and a port number. For
what are these two numbers used?
• An IP address identifies a device on a network,
• while a port number is used by applications running on those devices to
communicate with each other.
c) How is an IP (Version 4 and Version 6) numbers constructed?
• In IPv4, an IP address consists of four bytes in decimal representation
ranging from 0-255.
• Each byte is separated by a period if there is more than one digit.
• Example: 192.168.1.1
• In IPv6, an IP address consists of eight groups of four hexadecimal digits
separated by colons.
• Each group is ranging from 0-FFFF.
• Example: 2001:db8::8888
d) Give one example of an arbitrary, but valid IP address version 4 and
version 6 IP.
• Valid IPv4 Address: 10.0.0.1
• Valid IPv6 Address: fe80::1
Exercise 6:
What is a typical use case to use 'threads' in a program, when you write a
program, which acts as a server (in the client-server model)?
• Threads are used in a server program to handle multiple client connections
concurrently.
• Each client connection is typically assigned to a separate thread, allowing
the server to serve multiple clients simultaneously without blocking or
delaying other clients' requests.
Exercise 7:
a) Describe the difference between a Type-1 and a Type-2 hypervisor.
1. Type-1 Hypervisor:
• Runs directly on the physical hardware of the host system.
• It does not require a separate underlying operating system.
• Provides high performance and efficiency.
• It needs appropriate drivers to communicated with the hardware.
• Eg: VMware ESX, Microsoft Hyper-v
•
2. Type-2 Hypervisor:
Runs on top of a conventional operating system (the host OS).
• Requires the host OS to manage hardware resources.
• Simpler to install and configure compared to Type-1 hypervisors.
• E.g.: KVM, Virtual Box.
b) Describe the difference between Full and Para Virtualisation.
c) Describe the problems occurring with input devices (Keyboard, mouse) when
running a virtual machine. Describe possible solutions and their advantages
and disadvantages. (6 marks).
Problems:
• Input lag
• Inconsistent input
• Device Compatibility
• Mouse not visible in VM
Solutions:
• Enable hardware-assisted virtualization (e.g., Intel VT-x or AMD-V)
• update the VM's guest additions or integration services to the latest
version provided by the hypervisor to improve input device handling.
• install virtualized drivers within the guest operating system.
• Click “Right-Ctrl” Button and mouse integration feature is enabled in the
VM settings.
Exercise 8:
a) Briefly explain the differences between bridge network and host
networking in Docker. (3m)
Bridge Networking:
• Containers within a bridge network can communicate with each
other and with host. But cannot communicate outside the network.
• Containers have their own IP addresses.
• Ports need to be mapped to the host's ports.
• More Secured because of network isolation
Host Networking:
• Containers share the host's network namespace.
• Containers use the host's IP address.
• Ports are directly accessible on the host.
• Less Secured.
b) Briefly explain what happens in every step of the following Dockerfile.
Focus on the Docker commands, not what the Linux commands are
doing.(6m)
c) From nginx:1
d)
e) RUN apt-get update \
f) && apt-get install -y --no-install-recommends\
g) curl \
h) imagemagick
i)
j) RUN mkdir /fgallery \
k) && curl -sL "https://github.com/wavexx/fgallery/fgallery-
1.8.2.tar.gz" \
l) | tar xz -C /fgallery
m)
n) COPY docker-entrypoint.sh /
o) RUN chmod +x /docker-entrypoint.sh
p) COPY noimages.html /
q) VOLUME /images
r) WORKDIR /images
s) ENTRYPOINT ["/docker-entrypoint.sh"]
• RUN apt-get update \
This command updates the package lists for packages that need upgrading
and installs any upgrades if required.
• && apt-get install -y --no-install-recommends\ curl \ imagemagick
This command installs the curl and imagemagick packages without
installing recommended packages. The -y flag is used to automatically
answer yes to prompts.
• RUN mkdir /fgallery \
This command creates a directory named fgallery in the root directory (/).
• && curl -sL "https://github.com/wavexx/fgallery/fgallery-1.8.2.tar.gz" \ |
tar xz -C /fgallery
This command downloads the fgallery-1.8.2.tar.gz file from the specified
GitHub URL, extracts its contents, and places them into the /fgallery
directory.
• COPY docker-entrypoint.sh /
This command copies the docker-entrypoint.sh file from the build context
(the directory containing the Dockerfile) to the root directory (/) in the
Docker image.
• RUN chmod +x /docker-entrypoint.sh
This command makes the docker-entrypoint.sh file executable by changing
its permissions.
• COPY noimages.html /
This command copies the noimages.html file from the build context to the
root directory (/) in the Docker image.
• VOLUME /images
This command creates a mount point named /images for external volumes.
• WORKDIR /images
This command sets the working directory for any subsequent RUN, CMD,
ENTRYPOINT, COPY, and ADD instructions to /images.
• ENTRYPOINT ["/docker-entrypoint.sh"]
This command sets the default executable to run when the container starts
as the docker-entrypoint.sh script.
Additional:
Q: What is the difference between TCP and UDP? In which Situation would
you use which of the two protocols? (2m)
• TCP (Transmission Control Protocol) is connection-oriented, reliable (no
data loss), and ensures ordered data delivery. Used when a reliable
connection is need like “e-mail services".
• UDP (User Datagram Protocol) is connectionless, unreliable, and prioritizes
speed over reliability (Data loss). Used when speed is needed like “live
telecasting”.
Q: Can sockets communicate platform-independent? Where do you see that
in real life? (2m)
Yes, sockets can communicate platform-independently using standardized
networking protocols and APIs. This is seen in real-life applications like web
browsing, instant messaging, online gaming, and video streaming services, where
users can interact across different devices and platforms seamlessly.
Q: What are the main reasons for using virtual machine? (3m)
The main reasons for using virtual machines (VMs) are:
• Independent Operating System (OS),
• isolation and security,
• Portability and Migration,
• flexibility and scalability,
• Testing and Development.
Q: Write Docker Code.
# Use the official Python image as the base
FROM python:3.9
# Download and copy the Python file from the URL
ADD http://wouachimmer.uni-wuppertal.de/exam/run_webserver.py .
# Install the required packages
RUN pip install flask
# Expose port 9999 for the web server
EXPOSE 9999
# Run the Python file when the container starts
CMD ["python", "run_webserver.py"]
2. # Build the image with the name "webserver"
docker build -t webserver .
# Run the container with the name "webserver" and publish port 9999
docker run --name webserver -p 9999:9999 webserver