Jasper Alblas
Jasper Alblas
Hey there! Let’s tackle the awesome Introductory Networking room on THM. Ready to dive in?
Room URL: https://tryhackme.com/room/introtonetworking
I am making these walkthroughs to keep myself motivated to learn cyber security, and ensure that I remember the knowledge gained by THMs rooms. Join me on learning cyber security. I will try and explain concepts as I go, to differentiate myself from other walkthroughs.
The topics covered in this room are as follows:
TryHackMe does a good job of explaining concepts, and I won’t go into many details. However, I will try to highlight the important points.
The OSI model is a standardised model used to explain concepts behind networking. It contains of seven layers:
The transport layer decided which of the two protocols to send data over. This is layer four.
Answer: 4
The second layer, the data link layer, adds a MAC address to a packet and also ensures that the data has not been corrupted.
Answer: 2
The data layer is also responsible for the data formatting, so the answer is again layer number two.
Answer: 2
The first layer (Physical layer) is responsible for transmitting and receiving data.
Answer: 1
The presentation layer ensures that the data is standardised before sending it further along to the receives
Answer: 6
The session layer creates a session to track communication between the host and receiving machines.
Answer: 5
The application layer provides an interface to programs running on a machine to send networking requests.
Answer: 7
The network layer looks at the target IP address and selects the best route to the target destination.
Answer: 3
The “bite-sized” pieces of data sent over TCP are called segments. (When sending data over UDP they are called datagrams.
Answer: Segments
The File Transfer Protocol (FTP) operates at the Application Layer (Layer 7) of the OSI model. This layer is responsible for providing network services directly to end-user applications, facilitating file transfers between client and server systems.
Answer: 7
Live video is best transmitted over UDP, as speed is more important than reliability. It is acceptable to miss a few packets when seeing a Netflix movie, but you want it to go fast 🙂
Answer: UDP
Data passes from each layer to the next, and with each step more information is added to the transmission. We call this process encapsulation.
Note that in each layer we give a different name to the encapsulated data. In layers 7,6 and 5, the data is referred to as data. In the transport layer the encapsulated data is referred to as a segment or a datagram (depending on wether TCP or UDP is used). At the Network Layer, the data is referred to as a packet. In the Data Link layer it becomes a frame, and finally in the Physical Layer we refer to the data as bits.
When the data is received by the destination, the whole process is reversed. We call this de-encapsulation. The process goes from the physical layer towards the application layer. During each step it remove a piece of the added information.
If you look at the above figure, you will see that data in layer two are called frames.
Answer: Frames
We covered this in the previous section. Data at layer 4 is called Datagrams if we are referring to the UDP protocol.
Answer: Datagrams
When a computer receives a message over a network, it goes through a process to interpret and handle the data. This process is called de-encapsulation and it ensures that the message is processed and understood properly at each layer.
Answer: De-encapsulation
Refer to the above image again. In the data link layer (number 6) we add a trailer.
The trailer is added to the end of the frame, and it typically contains error-checking information, such as a Cyclic Redundancy Check (CRC) or Frame Check Sequence (FCS), to ensure data integrity during transmission. This helps the receiving system detect errors in the transmitted frame.
Answer: Data link
This is true. By encapsulating data with headers and sometimes encryption at different layers, sensitive information can be segmented and less visible to unauthorized entities.
Answer: Aye
There exists another model similar to the OSI model, which we refer to as the TCP/IP model. The TCP/IP model is actually slightly older.
Instead of the seven layers of the OSI model, the TCP/IP model only has four:
The two models match up like this:
Why do we use two similar models? The OSI model is easier to learn because the different steps are split up, while the TCP/IP model is more practical and used in real life.
How data actually moves through a network
TCP/IP consists of a variety of protocols. TCP/IP takes its name from the two most important of these: the Transmission Control Protocol which controls the flow of data between two endpoints, and the Internet Protocol, which controls how packets are addressed and sent.
TCP is a connection-based protocol. This means that there has to be a stable connection between two computers. The creation of this connection is called the three-way handshake.
The process goes like this:
The TCP/IP was developed by the United States Department of Defense (DoD) as part of research for ARPANET, the precursor to the internet. The OSI model came 10 years later.
Answer: TCP/IP
Answer: Transport
Answer: Application
Answer: Physical
Answer: Internet
TCP is a connection-based protocol, which means that there has to be a stable connection between two computers. The creation of this connection is called the three-way handshake.
Answer: Connection-based
SYN is short for synchronise. When attempting to make a connection, your computers sends a request to a remote computer indicating it wants to establish a connection. This request contains a SYN bit.
Answer: Synchronise
In the second second the remote computer responds with a packet which contains the SYN bit, as well as a ACK (acknowledgement) bit.
Answer: SYN/ACK
The short name for the acknowledgement segment is ACK.
Answer: ACK
Now it is time to look at some network related command-line tools. We start with the ping tool. This simple tool is used to test whether a connection to a remote system is possible. It can also be used to determine the ip address of the server hosting a website.
Ping uses the ICMP protocol, which is one of the slightly less well-known TCP/IP protocols that were mentioned earlier. The ICMP protocol works on the Network layer of the OSI Model, and the Internet layer of the TCP/IP model. The basic syntax for ping is ping <target>
.
ping bbc.co.uk
The relevant command is “ping” followed by the url:
Answer: ping bbc.co.uk
This can be answered by looking the output of the previous command:
Answer: 217.160.0.152
We can find the answer on the man page of the ping command. Run the following command:
man ping
Here you can see in the top that the -i flag can be used to specify the interval. You can also see this page:
https://linux.die.net/man/8/ping
-i interval: Wait interval seconds between sending each packet. The default is to wait for one second between each packet normally, or not to wait in flood mode. Only super-user may set interval to values less 0.2 seconds.
Answer: -i
See the above screenshot.
Answer: -4
For this answer you have to scroll a bit down when looking at the man page.
The answer is the -v flag.
Answer: -v
Traceroute can be used to map the path your request takes as it heads to the target machine. Since the internet is made up of a plethora of different servers which are all network up to each other, a request needs to take a path across a variety of them. Traceroute shows this path by listing all systems that are between your computer and the destination. The basic syntax for traceroute on Linux is this: traceroute <destination>
Use the following command:
traceroute <destination>
You will see something similar as this:
Answer: No answer needed.
Time to look at a man page again:
man traceroute
The -i flag allows us to specify the interface through which traceroute should send packets.
Answer: -i
Have another look at the man page. This time scroll a bit up.
Answer: -T
In Windows, traceroute operates primarily at the Internet Layer of the TCP/IP model by default.
Traceroute works by sending ICMP Echo Requests (Internet Control Message Protocol) and analyzing the Time-to-Live (TTL) field in the packet header. ICMP is part of the Internet Layer in the TCP/IP model, used for diagnostics and network communication.
Answer: Internet
Domain names are transferred into IP addresses by a domain name system. This means you can write medium.com instead of writing a difficult to remember IP address. Domains are leased out by companies called Domain Registrars.
The command line tool called whois allows you get information on the owner of a domain name. Just use whois <domain>
to get a list of available information about the domain registration.
facebook.com
Let’s move on. Run the following command:
whois facebook.com
Answer: No answer needed
You will find the postal code in the output.
Answer: 94025
Look at the output again. Scroll to the top to find the following data:
Answer: 29/03/1997
whois facebook.com
Answer: No answer needed
Look in the output from the previous command:
Answer: Redmond
I searched for “One Microsoft Way” on Google Maps, and could easily identify a golf course nearby by looking at satellite imagery.
Answer: Bellevue Golf Course
A little bit down in the output:
Answer: msnhst@microsoft.com
I mentioned DNS before. Let’s discuss what they are and how try work. At the most basic level, DNS allows us to ask a special server to give us the IP address of the website we’re trying to access. For example, if we made a request to www.google.com, our computer would first send a request to a special DNS server (which your computer already knows how to find). The server would then go looking for the IP address for Google and send it back to us. Our computer could then send the request to the IP of the Google server.
Let’s say you write a domain name in your browser. Let’s discuss more details by have a look at the steps that occur:
This all happens automatically.
The tool dig allows manual querying of DNS servers for domain information, often used for network troubleshooting. It works by querying recursive DNS servers with a command like dig <domain> @<dns-server-ip>
. When performing a DNS lookup, such as on google.com, the ANSWER section is the most important, showing the IP address associated with the domain. Another key piece of information is the TTL (Time To Live), which tells your computer how long to cache the DNS result before querying the server again. TTL is measured in seconds, and in the example, the TTL is 157 seconds (2 minutes and 37 seconds).
The command to use would be like so:
dig <domain> @<dns-server-ip>
Answer: Domain Name System
If the required info is not in your local info, your computer would query a recursive DNS server.
Answer: Recursive
Domain extensions are handled by top-level domain DNS servers.
Answer: Top-level domain
As mentioned before, your computer looks into your local cache. If the IP address of a domain is saved there, it does not have to communicate with a DNS server.
Answer: local cache
Some simple googling lead me to the answer here:
https://developers.google.com/speed/public-dns
Answer: 8.8.4.4
TTL is measured in seconds, and since every hour has 3600 seconds, 24 hours would equal 86400 seconds.
Answer: 86400
We are done with the Introductory Networking room on THM! I hope you learned a lot about networking and some essential Linux command line tools to gain information about networks.
It was great fun to write this summary of the TryHackMe: Introductory Networking room of TryHackMe, so thank you for reading.
Find more of my walkthroughs here.
You are welcome to support me by buying me a cup of coffee:
I learned a lot through HackTheBox’s Academy. If you want to sign up, you can get extra cubes, and support me in the process, if you use the following link: