Networking 101: Ports, Protocols, TCP and UDP

 What is up guys!

In this blog, I'm going to talk about What are ports? What are Protocols? What is TCP? What is UDP? etc.

A Port is a place in the computer, which it uses to communicate and host various processes.

We can easily relate this theory of Ports to a shopping mall.

Imagine that you visit a shopping mall. What do you see there? A lot of shops right?

Now, when you look at a centralized map of the mall, you'll notice the shop and its floor and number, etc.

Thus each shop has it's own shop number and each shop provides some product to you. 

Another example can be your own body itself!!

If you want to speak, there's a particular place reserved for it, if you want to see things, there's a special place reserved for it, if you want to hear, there is a special place reserved for it and the list goes on.

In the above examples, you can assume your body and the shopping mall as a computer system and the special places and the shops as ports.

Similarly in computers, there are various services and processes present eg. HTTP, SMTP, DNS, etc. All these services have their special ports through which they operate!

A computer has 65536 ports for both TCP and UDP sides.

Here is a list of some common protocols and the ports occupied by them.


                                           TCP


         PROTOCOLS                                     PORTS


•        FTP                                                          21

•        SSH                                                   22

•        TELNET                                                 23

•        SMTP                                                      25

•        DNS                                                        53

•        HTTP                                                      80

•        HTTPS                                                   443

•        POP3                                                      110

•        SMB                                                   139+445

•        IMAP                                                     143


                                           UDP


         PROTOCOLS                                     PORTS

•        DNS                                                         53

•        DHCP                                                 67,68

•        TFTP                                                      69

•        SNMP                                                    161


Let me walk you through some of these protocols briefly.
For TCP,
• FTP stands for File Transfer Protocol and it is basically used for file transfer purposes. If the port pertaining to FTP is open, then you can connect to the system and transfer files to the server as well as copy the files of the server to your system as well.
• SSH stands for Secure Shell and is used to login into a system remotely and this is an encrypted process when it comes to SSH.
• TELNET stands for Telecommunication Network and is used to login into a system remotely but unlike SSH, encryption is not present over here so everything is in cleartext.
• SMTP (Simple Mail Transfer Protocol), POP3 (Post Office Protocol), and IMAP (Internet Message Access Protocol) are all related to mail service.
• DNS (Domain Name System) does the work of translating IP Addresses into names. It is both a TCP as well as UDP class protocol.
• HTTP (Hypertext Transfer Protocol) and HTTPS (Hypertext Transfer Protocol Secure) are used for website purposes. Remember that HTTP is unencrypted whereas HTTPS is encrypted.
• SMB (Server Message Block) is used for file sharing. It is sometimes referred to as "samba" and initially, it used only port 139 but in the later version of windows port 445 was used as well.

For UDP,
•  DNS (Domain Name System) does the work of translating IP Addresses into names. It is both a TCP as well as UDP class protocol.
• DHCP (Dynamic Host Control Protocol) does the work of assigning you an IP address randomly from a predefined range once you connect to a network.
• TFTP (Trivial File Transfer Protocol ) is the UDP version of FTP.
• SNMP (Simple Network Management Protocol) is used for collecting and organizing information about managed devices on IP networks and for modifying that information to change device behavior.

That's all about Ports and Protocols.

Now, we are going to talk about some level 4 (Transport Layer) concepts.

Let's have a look at TCP and UDP

TCP

TCP stands for TRANSMISSION CONTROL PROTOCOL.
It is a connection-oriented protocol.
Now, you might be wondering what this connection-oriented thing means...
In simpler terms connection-oriented means that before transmitting the data, a connection has to be established
Since TCP is connection-orientation, it is a reliable protocol so it is used in websites(HTTP & HTTPS), FTP, SSH, etc.

TCP works on the 3-way handshake rule
This rule works as follows.
Firstly the sender sends a SYN packet
After this, the receiver sends the SYN+ACK packet (Here the connection is established)
Finally, the sender sends the ACK packet

In layman's language,
The sender asks for permission to send the data. (SYN packet)
The receiver acknowledges the request (SYN+ACK packet) and here the connection is established between the sender and the receiver
After the receiver gives a thumbs-up to the data transfer, the sender sends the data (ACK packet)



UDP  

UDP stands for USER DATAGRAM PROTOCOL.
It is a connectionless protocol.
It is evident from the word itself that it doesn't need to establish a connection as in TCP and the data is sent directly
Since it is a connectionless protocol, data frames if lost, do not make any significant impact. Hence, it is used in VOIP, Streaming services, DNS, etc.


Here is a picture that will make you understand TCP and UDP




If you like the content then do consider connecting with me and pour your knowledge into my DM!!😇 

Instagram: bhavak_29

LinkedIn: https://www.linkedin.com/in/bhavak-kotak-3b6b071b1/

:NOTE:

All the images belong to their respective owners.

I am a learner so I learn things from different sources and I DO NOT claim that any of the content(if it does) belonging to someone else as mine.

Also a huge thanks to Heath Adams(AKA The Cyber Mentor). It is because of his course that I am motivated to put this content here and I have taken inspiration from his videos to a considerable amount of extent and tried to convey what I understood in the best way possible.



 

Comments

Popular posts from this blog

Defeating RootME

TCS HACKQUEST PLAYGROUND WALKTHROUGH

Networking 101: The OSI Model