Networking Notes
Networking Notes
Application Layer
1. An Application Layer is a Layer at which the data is generated or created which we need to
transfer over the Network.
2. This layer also serves as a window for the application services to access the network and
displaying the received information to the user.
3. The Application layer of the TCP/IP models handles the high-level protocols issue of
representation, encoding and dialog control.
Presentation Layer
1. This layer is responsible for presenting the data in the required format which may include
encryption, decryption, compression & decompression.
2. This layer is responsible to represent the data for the Application Layer.
PDU: DATA
Session Layer
1. This Session establish, manage and terminates session betweentwo communication hosts.
Ex. Client Server Login
Protocol used: Network Time Protocol. (123)
PDU: Formatted Data
Port Number
i. A Port number is a way to identify a specific process to which an internet or other
network message is to be forwarded when it arrives at a server.
ii. It works at Layer 4 used by TCP & UDP.
iii. A port no. is a 16 bit integer that is put in the header appended to a message unit.
iv. Range 0 – 65535; 0-1023 is well known, 1024-65535 are Random.
i.e.: - FTP(20,21), SSH(22), Telnet(23), SMTP(25), DNS(53), DHCP(67,68), TFTP(69).
Protocol Number
i. It is used in Layer 3
ii. Range 0-255
iii. Protocol number is used to identify that which type of
Data is generated in the transport layer.
iv. Protocol no. is present in IPv4 header which is of 8 bytes.
v. The protocol number is used by the layer-3 protocol.
(IPv4 or IPv6) to determine to which layer-4 protocol in
The network stack it should send the payload of the packet .
<icmp-1>
Data Packet: A Packet is the single unit of data that is routed between a source and destination
on the Network. Each Packet contains information to help device or switch the packet to its
destination & actual data is known as Payload.
c. A MTU is the Largest size packet or frame, specified in octet (eight bit= byte), that can be
sent in a packet or frame based Network such as the internet.
d. The internet’s TCP uses the MTU to determine the max size of each packet in any
transmissions.
What is MSS?
The Maximum Segment Size is the largest amount of data, specified in bytes, that a
communication device can handle in a single, un-fragmented piece.
For optimum communication, the number of bytes in the data segment and the header
must add up to less than the number of bytes in the MTU.
Difference betweenSegmentation and Fragmentation
S.NO. Segmentation Fragmentation
Segmentation takes place at
Layer 4. Fragmentation takes place at Layer 3
1 i.e. Transport Layer i.e. Network Layer
During the original creation of
packet when a set of data
doesn’t fit within the “Maximum During the original creation of frame where the
Segment Size” the data is then Network Layer must sends packets down to the
chopped into multiple segment data link layer for transmission. Some Data link
referred as “Protocol data unit”. layer technologies have limits on the length of the
This Process is known as data that can be sent.
2 Segmentation. In Shorts some links have smaller MTU.
Something about MSS: MSS is set
as a TCP option initially in the
TCP SYN Packet during the 3 way
Handshake. This Value cannot be
changed after the connection is If the Packet that is to be sent is larger than the
established. MTU than it is chopped. This process is known as
fragmentation. These pieces are re-assembled
Default Maximum TCP segment once they arrived at the Network Layer of the
3 size=576 bytes destination.
In order to avoid fragmentation
(No. of Bytes in the data
4 segment + The Header) < Header Fragmentation can be avoided
MTU- Max Transmission Unit
Max limit of data that can be transmitted through
interface at once.
MSS- define the Max Limit of 1500 – 20 byte(TCP header)+20 byte(IP Header)
5 Segment size +1460 MSS
Transport Layer
1. The 4th Layer in TCP/IP model.
2. Deals with logical communication between processes.
3. Responsible for delivering messages between network hosts.
4. Accept the data from Application Layer and prepare it for addressing at Network Layer.
5. Transport the data across the Network Reliably by breaking up data from sender and
reassembling it at receiver (client) end.
6. It decides if data transmission should be parallel or single path.
7. Multiplexing or splitting are done by this.
8. Provide additional Quality of Services.
9. Converting messages into smaller units
10. Responsible for end-to-end delivery of complete messages.
11. Provide transparent transfer of data between end users by providing reliable
data transfer service to the upper layer.
12. Controls the reliability through flow control, segmentation, De-
segmentation & error control.
13. Also provides the acknowledgement of the successful data transmission and
sends the data if no errors occurred.
Services:
UDP Header.
1. UDP header is 8 bytes fixed and simple header.
2. First 8 byte consists of all necessary header information and remaining part consist of
data.
Application of UDP
1. Used for simple request response communication when size of Data is less and hence
there is lesser concern about flow and error control.
2. It is a suitable protocol for multicasting (support packet switching).
3. Used for some routing update protocol like RIP.
4. Normally used for real time application which cannot tolerate uneven delays between
sections of a received message.
5. Following protocol uses UDP-
NTP (Network Time Protocol), DNS (Use TCP also), BootP, DHCP, NNP, TFTP,
RTSP, RIP, OSPF.
6. Application layer can do some of the tasks through UDP like Traceroute, Record
Route, and Time Stamp.
7. UDP takes datagram from Network Layer, attach its header and send it to the user so it
works fast.
8. UDP is null protocol if remove checksum field.
When to use UDP
1. Reduce the requirement of Computer resources.
2. When using multicast or Broadcast to transfer typically used for streaming media.
3. UDP is also known as Stateless Protocol.
Three-way Handshake
1. Client want to establish a connection with server so the first “connection agreement”
segment is request for (synchronization) SYN (syn. seq no.), which inform server that the
client want to start communication with server. (Initial SYN sequence no. is random).
2. SYN+ACK Now the server respond the client with segment ACK request & establishing
connection parameter rules between hosts.Server also sends it SYN Bit set. So that bi-
directional communication can be started.
3. ACK Client Acknowledged the server with the final segment which notifies the server that
the connection agreement has been accepted. Now both establish a reliable connection an
actual data transfer can be started.
4. TCP negotiate maximum segment size (MSS).
5. TCP Header is of 20 byte or up to 24 byte with options.
TCP Header
1. Nonce Sum: - It is an experimental Flag, used to help protect against accidental Malicious
Concealment of Packet from the Sender. It is 1 bit Flag.
2. CWR: - It stands for Congestion Window reduced is used by sending host to indicate that it
received a packet with the ECE Flag set.
3. ECN-echo: - It stands for explicit Congestion Notification. ECN allows end-to-end
notification of network congestion without dropping packets. (rfc 3168).
4. Synchronization (SYN)
a. Used in first step of connection establishment phase or 3 way handshake process
between two hosts. Only the first packet from the sender as well as receiver should
have this flag set.
b. Used for synchronizing sequence numbers.
c. Tell the other end which sequence no. they should expect.
5. Acknowledgement (ACK)
a. Used to acknowledge packets those are successfully received by the host.
b. Flag is set if the Acknowledgement number field contains a valid acknowledgement
number.
6. Finish (FIN) – It is used to request for connection termination i.e. when there is no more
data from the sender, it requests for connection termination. This is the last packet sent by
sender. It frees the reserved resources and gracefully terminate the connection.
7. Reset (RST) – It is used to terminate the connection if the RST sender feels something is wrong
with the TCP connection or that the conversation should not exist. It can get send from receiver
side when packet is sent to particular host that was not expecting it.
8. Urgent (URG)
a. Data inside a segment with URG = 1 flag is forwarded to application layer immediately
even if there are more data to be given to application layer.
b. It is used to notify the receiver to process the urgent packets before processing all
other packets.
c. The receiver will be notified when all known urgent data has been received.
9. Push (PSH)
a. Transport layer by default waits for some time for application layer to send enough
data equal to maximum segment size so that the number of packets transmitted on
network minimizes which is not desirable by some application like interactive
applications (chatting).
b. Similarly transport layer at receiver end buffers packets and transmit to application
layer if it meets certain criteria.
c. This problem is solved by using PSH. Transport layer sets PSH = 1 and immediately
sends the segment to network layer as soon as it receives signal from application layer.
Receiver transport layer, on seeing PSH = 1 immediately forwards the data to
application layer.
In general, it tells the receiver to process these packets as they are received instead of
buffering them.
d. PUSH Function asks to Push the Buffered data to the receiving application.