TCP Interview Questions & Answers
What is TCP?
Transmission Control Protocol is a
connection-oriented protocol. This means that before any data transfer can take
place, Certain Parameters has to be negotiated in order to establish the
connection
What is TCP Three Way
Handshake process?
TCP Three Way Handshake process is used for a
reliable connection. In this process, the transmitting network device first
establishes a connection-oriented (reliable) session with its peer system which
is called three-way handshake. Data is then transferred. When the Data transfer
is finished, connection is terminated and virtual circuit is teared down.
What is window size in
TCP three way handshake process (3WHS)?
It is 16-bit window field which indicates the
number of bytes a sender will send before receiving an acknowledgment from the
receiver.
What are TCP Flags?
TCP Flags are used to influence the flow of
data across a TCP connection. Below are TCP Flags:
1.
PUSH
(PSH): It pushes the
buffered data to the receiver’s application. If data is to be sent on immediate
basis we will push it
2.
Reset
(RST): It resets the
connection
3.
Finish
(FIN): It finishes the
session. It means no more data from the sender
4.
Urgent
(URG): It is used to
set the priority to tell the receiver that this data is important for you
5.
Acknowledgement
(ACK): All packets
after SYN packet sent by client should have this flag set. ACK=10 means host
has received 0 through 9 and is expecting byte 10 next
6.
Synchronize
(SYN): It Initiates a
connection. It synchronizes the sequence number
What is the difference
between PUSH and URG flag?
The PUSH flag in the TCP header informs the
receiving host that the data should be pushed up to the receiving application
immediately. The URG flag is used to inform a receiving station that certain
data within a segment is urgent and should be prioritized.
What is the importance
of Sequence Number and Acknowledgement Number?
Sequence Number is a 32-bit field which indicates the
amount of data that is sent during a TCP session. By Sequence Number sender can
be assured that the receiver received the data because the receiver uses this
sequence number as the acknowledgment number in the next segment it sends to
acknowledge the received data.
Acknowledgment number is used to acknowledge the received data
and is equal to the received sequence number plus 1.
What is encapsulation
and decapsulation?
Encapsulation: Preparing and passing he data by any
upper layer to the layer below it, is called Encapsulation.
Decapsulation: Decoding data while going upwards from
the physical layer till application layer is called decapsulation.
What is the difference
between TCP and UDP?
Following are differences in TCP and UDP,
·
TCP is connection
oriented protocol while UDP is connectionless protocol
·
TCP is more reliable
than UDP
·
UDP is faster for data
sending than TCP
·
UDP makes error
checking but no reporting but TCP checks for errors and performs reporting
·
TCP provides
guaranteed Delivery of Data but UDP has no guarantee
·
Header size of TCP is
20 bytes while that of UDP is 8 bytes
·
TCP has
acknowledgement segments but UDP has no acknowledgement
·
TCP is used for
application that require high reliability but less time critical whereas UDP is
used for application that are time sensitive but require less reliability
Which one is reliable
out of TCP & UDP?
TCP is reliable.
What are the Layer 4
well-known port numbers?
Total Port numbers range from 0 to 65535 &
it is divided further into three parts:
·
0-1023: Well-known
ports
·
1024-49151: Registered
ports
·
49152-65535: Dynamic
ports (private ports)
Below are famous TCP & UDP Port numbers:
|
Protocol |
TCP/UDP |
Port Number |
Description |
|
FTP |
TCP |
20/21 |
File Transfer Protocol is used for
file transfers (RFC 959) |
|
SSH (Secure Shell) |
TCP |
22 |
SSH is the primary method used to manage
network devices securely at the command level (RFC 4250-4256) |
|
Telnet |
TCP |
23 |
Telnet is the
primary method used to manage network devices at the command level. Unlike
SSH which provides a secure connection, Telnet does not, it simply provides a
basic unsecured connection (RFC 854) |
|
SMTP |
TCP |
25 |
Simple Mail Transfer Protocol is
used for two primary functions, it is used to transfer mail (email) from
source to destination between mail servers and it is used by end users to
send email to a mail system (RFC 5321) |
|
DNS |
TCP/UDP |
53 |
Domain Name System
(RFC 1034-1035) |
|
DHCP |
UDP |
67/68 |
Dynamic Host Configuration
Protocol (RFC 2131) |
|
TFTP |
UDP |
69 |
Trivial File Transfer Protocol is
same as FTP above but uses UDP instead of TCP (RFC 1350) |
|
HTTP |
TCP |
80 |
Hypertext Transfer Protocol (RFC
2616) |
|
POP3 |
TCP |
110 |
Post Office Protocol
is used for Emails (RFC 1939) |
|
NTP |
UDP |
123 |
Network Time
Protocol (RFC 5905) |
|
NetBIOS |
TCP/UDP |
137/138/139 |
NetBIOS (RFC 1001-1002) |
|
IMAP |
TCP |
143 |
Internet Message
Access Protocol (RFC 3501) |
|
SNMP |
TCP/UDP |
161/162 |
Simple Network Management Protocol (RFC 1901-1908,
3411-3418) |
|
BGP |
TCP |
179 |
Border Gateway
Protocol (RFC 4271) |
|
LDAP |
TCP/UDP |
389 |
Lightweight
Directory Access Protocol (RFC 4510) |
|
HTTPS |
TCP |
443 |
HTTPS is used in
conjunction with HTTP to provide the same services but doing it using a secure connection which is
provided by either SSL or TLS (RFC 2818) |
Comments
Post a Comment