Networking: Difference between Transport layer and Networking Layer - networking

In Internet Model there are four layers: Link -> Networking -> Transport -> Application.
I don't really know the difference between networking layer and transport layer. As I read:
Transport layer: include congestion control, flow control, reliability ...
Networking layer: route data from A to B
So, base on above properties, I see that there are some overlaps between those two layers.
1) Networking layer decides to move data from A to B. But, when data has known how to moved from A to B, what does it means for term "flow control" "congestion control" ... ? How and What does it control when the packet (and byte stream is in packet) has already known to moved across network.
2) Or other example, TCP protocol in Transport layer is ORDERED delivery of a stream. But, TCP doesn't decide how to move data, but Networking layer. So, how can TCP can do ?
So, I cannot get in those two terms. Please teach me.
Thanks :)

These are levels of abstraction.
Transport Layer is where the decision to use TCP/UDP is made. Among commonly used protocols in this layer, TCP is reliable, UDP isn't. Depending upon the choice made, the respective headers are attached to your packet. TCP for example just knows about SYN-ACK, Three-way handshake mechanisms, but does not know the address of the remote-endpoint, or the mechanism of getting the packet across the network.
Congestion control, Flow control help ensure that the network isn't flooded with packets, by regulating the number of packets being sent.
Now, after TCP/UDP header being appended, it moves on to the Network Layer. Till this step, the remote end-point's IP address wasn't a part of the packet at all. It is at this step that the Source & Destination IP addresses are added to the packet. This layer actually knows the remote-endpoint.
Sender Receiver
----------- ------------
| | virtual link | |
| Transport | -----------------> | Transport |
| | | |
----------- ------------
| |
| |
----------- -----------
| | virtual link | |
| Network | ------------------> | Network |
| | | |
----------- -----------
| |
| |
----------- -----------
| | | |
| Physical | | Physical |
| | | |
----------- -----------
↓ ↑
|____________real link____________|
The sender's Transport Layer data, is the exact data received by the receiver's transport layer.
As the packet travels down the sender, each layer is adding its own header information, but all of that is removed by the corresponding layer on the receiver.
The advantage is that a virtual link is established, like the one shown above, whereas the real link is only in the physical layer.

Transport layer:
Logical communication between processes.
Network layer:
Logical communication between hosts.
Transport layer:
Responsible for checking that data available in session layer are error free.
Network layer:
Responsible for logical addressing and translating logical addresses (ex. amazon.com) into physical addresses (ex. 180.215.206.136)
Transport layer: Protocols used at this layer are :
TCP(Transmission Control Protocol)
UDP(User Datagram Protocol )
SCTP(Stream Control Transmission Protocol)
Network layer: Protocols used at this layer are :
IP(Internet Protocol)
ICMP(Internet Control Message Protocol)
IGMP(Internet Group Message Protocol)
RARP(Reverse Address Resolution Protocol)
ARP(Address Resolution Protocol)
Transport layer:
This layer ensures that the protocols operated at this layer provide reliable end-to-end flow and error control.
Network layer:
This layer controls routing of data from source to destination plus the building and dismantling data packets.

Transport: Determines how data is to be sent: Reliably or unreliably. Defines well known services (ports.)
Network: Provides logical addressing, finds best path to a destination.

Transport Layer:
The fourth and “middle” layer of the OSI Reference Model protocol stack is the transport layer. I consider the transport layer in some ways to be part of both the lower and upper “groups” of layers in the OSI model. It is more often associated with the lower layers, because it concerns itself with the transport of data, but its functions are also somewhat high-level, resulting in the layer having a fair bit in common with layers 5 through 7 as well.
Recall that layers 1, 2 and 3 are concerned with the actual packaging, addressing, routing and delivery of data; the physical layer handles the bits; the data link layer deals with local networks and the network layer handles routing between networks. The transport layer, in contrast, is sufficiently conceptual that it no longer concerns itself with these “nuts and bolts” matters. It relies on the lower layers to handle the process of moving data between devices.
The transport layer really acts as a “liaison” of sorts between the abstract world of applications at the higher layers, and the concrete functions of layers one to three. Due to this role, the transport layer’s overall job is to provide the necessary functions to enable communication between software application processes on different computers. This encompasses a number of different but related duties
Modern computers are multitasking, and at any given time may have many different software applications all trying to send and receive data. The transport layer is charged with providing a means by which these applications can all send and receive data using the same lower-layer protocol implementation. Thus, the transport layer is sometimes said to be responsible for end-to-end or host-to-host transport (in fact, the equivalent layer in the TCP/IP model is called the “host-to-host transport layer”).
Network Layer:
The third-lowest layer of the OSI Reference Model is the network layer. If the data link layer is the one that basically defines the boundaries of what is considered a network, the network layer is the one that defines how internetworks (interconnected networks) function. The network layer is the lowest one in the OSI model that is concerned with actually getting data from one computer to another even if it is on a remote network; in contrast, the data link layer only deals with devices that are local to each other.
While all of layers 2 through 6 in the OSI Reference Model serve to act as “fences” between the layers below them and the layers above them, the network layer is particularly important in this regard. It is at this layer that the transition really begins from the more abstract functions of the higher layers—which don't concern themselves as much with data delivery—into the specific tasks required to get data to its destination. The transport layer, which is related to the network layer in a number of ways, continues this “abstraction transition” as you go up the OSI protocol stack.
Network Layer Functions
Some of the specific jobs normally performed by the network layer include:
Logical Addressing: Every device that communicates over a network has associated with it a logical address, sometimes called a layer three address. For example, on the Internet, the Internet Protocol (IP) is the network layer protocol and every machine has an IP address. Note that addressing is done at the data link layer as well, but those addresses refer to local physical devices. In contrast, logical addresses are independent of particular hardware and must be unique across an entire internetwork.
Routing: Moving data across a series of interconnected networks is probably the defining function of the network layer. It is the job of the devices and software routines that function at the network layer to handle incoming packets from various sources, determine their final destination, and then figure out where they need to be sent to get them where they are supposed to go. I discuss routing in the OSI model more completely in this topic on the topic on indirect device connection, and show how it works by way of an OSI model analogy.
Datagram Encapsulation: The network layer normally encapsulates messages received from higher layers by placing them into datagrams (also called packets) with a network layer header.
Fragmentation and Reassembly: The network layer must send messages down to the data link layer for transmission. Some data link layer technologies have limits on the length of any message that can be sent. If the packet that the network layer wants to send is too large, the network layer must split the packet up, send each piece to the data link layer, and then have pieces reassembled once they arrive at the network layer on the destination machine. A good example is how this is done by the Internet Protocol.
Error Handling and Diagnostics: Special protocols are used at the network layer to allow devices that are logically connected, or that are trying to route traffic, to exchange information about the status of hosts on the network or the devices themselves.

Cthulhu's explanation is ok but in order to understand a bit better, I recommend that you should read on the OSI Model
Transport layer handles port numbers, TCP, UDP, layer 4 PDU's and it's the first step in encapsulating and segmenting data in order to send it across the network
PDU = protocol data unit , it's a piece of information containing a header, the data segment and maybe a footer (see layer 2 encapsulation)
Network handles ip routing and delivery of data packets across the network
Each layer (regardless if it's OSI model or TCP/IP model with 4 layers) , each layer interacts with it's adjacent layer and provides an abstract framework for today's telecom purposes
Regarding your questions :
1). Flow control is a TCP mechanism for handling the size of the packet in order to prevent packet loss and retransmision, congestion control is another thing. Network layer doesn't decide anything, it simply tries to send your package over a network, if it fails, it will notify the upper layer about this problem and then the application or user should decide what to do).
2). TCP enables a 3way handshake mechanism to start a session, afterwards each packet is market with a counter and the receiver acknowledges receipt of senders package. In case he doesn't acknowledge, TCP resends that lost package. Networking layer will only forward packets and won't make any decisions regarding traffic control or packet ordering.
Further details are available in CCNA1 documentation or on the web.

Considering the ISO/OSI reference model transport layer is 4th layer. It mainly deals with the end to end delivery of the packets. End to end means it is responsible for delivering the packet to the appropriate port.
Network layer on the other hand is 3rd layer and is responsible for delivering the packet only to the host not to any specific [port/process in the system.
People do have the doubt that when you have transport layer which can deliver the packet from one end to other than why do we have network layer?
The simple answer to this question is that network layer is responsible for carrying the packet from sender to destination. But after reaching the destination it depends on the transport layer to deliver it to appropriate port number or process(in operating system terminology). Moreover at network layer we IP protocol which is heart of internet. You can read more about this here.

Related

How does Network layer knows if it has to fragment the packet

I got basic question. Trying to understand the mechanism how network layer identify when it receive packet larger than its interface MTU configured and has to fragment it.
For example. If the data to be transmitted by application is 2000byte where as the NIC on the server is having MTU 1500. Network layer has to do fragmentation now but how it knows it has to do it. Does the Transport layer give the full 2000byte data to network layer and than network layer compares it with the interface MTU configured and decide accordingly
If the data to be transmitted by application is 2000byte
There are transport-layer (L4) protocols (most prominently TCP) that do all the chunking for an application. TCP is MTU-aware and segments its data automatically into the optimal chunks.
Other L4 protocols don't do any chunking of their own (e.g. UDP). Any application data is simply encapsulated into a datagram and passed to the network layer. If necessary, the network layer then fragments the encapsulating IP packet across several data-link-layer frames.

OSI Layers explained

I'm trying to understand Network layers. There are five layers, application, transport, network, link and physical layer. I have studied from various sources but I couldn't understand clearly, especially transport, network and link layers. Can you explain those layers for a dummy person like me? Thanks.
So I think the hardest part people have with the OSI model is that they look at some of the layers and forget its talking about communication... application layer specifically people get confused as to what its talking about.
Application references the protocols applications use to communicate.
Examples being ftp, http, etc.
As stated above, the original OSI model (which is really just theory, nothing actually implements it exactly as it would be too inefficient) has 2 more layers in between application and transport (which are most likely wrapped into the application layer). These are Presentation and Session.
Presentation is responsible for things like HTTP's Accept-Encoding: gzip, deflate. encryption and character encoding are said to be Presentation layer, so SSL/TLS falls under this category (the s in https).
HTTP Sessions is literally would be a literal example of the Session layer (anything that keep your application state alive across connections). If a protocol is connection oriented, it might not have a session layer, which is why HTTP is probably the only example I can think of at the moment.
As you can see HTTP was the answer to all 3 of these top layers, which is why they have all been combined into Application layer in newer versions of the model. Cisco still uses the 7 layer model, but Microsoft uses the 5 layer you're using.
Transport is TCP... it contains information about reordering packets and can adjust the amount of packets per window, allows the computer to know if anything was lost and ask for re-transmission, etc.
UDP is also an example of the transport layer, however its a lot simpler of a protocol, no re-transmission of packets are done on UDP.
Network is the IP protocol (also IPX/SPX from the old netware days, and ICMP (pings) and IGMP (routers)) this allows for addressing computers that rely outside the a collision domain (things separated by switches or routers).
Link or DataLink layer is ethernet, (or ATM, or FDDI) which addresses computers physically connected to a hub or directly with a network cable to each other.
This layer adds the MAC addressing in ethernet and the frame part of a packet is the header it uses.
Physical layer (in original OSI model) is just your cables and network equipment.
Pretty much the only people who still talk about OSI is network techs.
They may still say Layer 2 or Layer 3 switches, etc which is in reference to OSI.. Layer 2 is an ethernet switch, a layer 3 switch adds routing.
The best way to see how this is used is to load up wireshark and snoop your own network traffic. It will actually show you the parts of a packet that are responsible for most of the layers.
Knowing the OSI model is not really overly useful, but it can help you organize the stages of network communication in your mind and help you troubleshoot.
Knowing the protocols and how they interact is extremely useful, learn how tcp negotiates connections, IP addressing and subnet masking, HTTP and Ethernet can help you whether you are a developer or a server admin, or network admin or even a DBA. There is nothing like a bad network card to ruin your weekend or even a whole month if no one thinks to check it, and the only way to tell is use tcpdump, and wireshark to see errors in the Ethernet frames.
The OSI reference model
The OSI model is used to connect to the open systems—these are the systems that are open and communicate with other systems. By using this model, we do not depend on an operating system anymore, so we are allowed to communicate with any operating system on any computer. This model contains seven layers, where each layer has a specific function and defines the way data is handled on certain different layers. The seven layers that are contained in this model are the Physical layer, Data Link layer, Network layer, Transport layer, Session layer, Presentation layer, and the Application layer.
THE PHYSICAL LAYER
This is the first layer in the OSI model and contains a definition of the network's physical specification, including the physical media (cables and connectors) and basic devices (repeaters and hubs). The layer is responsible for the input raw bits transmission data stream into zeros and for the ones that are on the communication channel. It then places the data onto the physical media. It is concerned with data transmission integrity and makes sure that the bits that are sent from one device are exactly the same as the data that is received by the other device
THE DATA LINK LAYER
The main role of the Data Link layer is to provide a link for raw data transmission. Before the data is transmitted, it is broken up into data frames, and the Data Link layer transmits them consecutively. The receiver will send back an acknowledge frame for each frame that has been sent if the service is reliable.
This layer consists of two sublayers: Logical Link Control (LLC) and Media Access Control (MAC). The LLC sublayer is responsible for transmission error checking and deals with frame transmission, while the MAC sublayer defines how to retrieve data from the physical media or store data in the physical media.
We can also find the MAC address, also called as the physical address, in this layer. The MAC address is used to identify every device that connects to the network because it is unique for each device.
The MAC address contains twelve hexadecimal characters, where two digits are paired with each other. The first six digits represent the organizationally unique identifier and the remaining digits represent the manufacturer serial number. If you are really curious to know what this number means, you can go to www.macvendorlookup.com and fill the text box with our MAC address to know more about it.
THE NETWORK LAYER
The Network layer is responsible for defining the best way to route the packets from a source to the destination device. It will generate routing tables using Internet Protocol (IP) as the routing protocol, and the IP address is used to make sure that the data gets its route to the required destination. There are two versions of IP nowadays: IPv4 and IPv6. In IPv4, we use 32-bit addresses to address the protocol and we use 128-bit addresses in IPv6. You are going to learn more about Internet Protocol, IPv4, and IPv6 in the next topic.
THE TRANSPORT LAYER
The Transport layer is responsible for transferring data from a source to destination. It will split up the data into smaller parts, or in this case segments, and then will join all the segments to restore the data to its initial form in the destination.
There are two main protocols that work in this layer: the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP).
TCP supplies the delivery of data by establishing a session. The data will not be transmitted until a session is established. TCP is also known as the connection-oriented protocol, which means that the session has to be established before transmitting the data.
UDP is a method of delivering data with the best efforts, but does not give a guaranteed delivery because it does not establish a session. Therefore, UDP is also known as the connection-less protocol. In-depth explanation about TCP and UDP can be found in the next topic.
THE SESSION LAYER
The Session layer is responsible for the establishment, maintenance, and termination of the session. We can analogize the session like a connection between two devices on the network. For example, if we want to send a file from a computer to another, this layer will establish the connection first before the file can be sent. This layer will then make sure that the connection is still up until the file is sent completely. Finally, this layer will terminate the connection if it is no longer needed. The connection we talk about is the session.
This layer also makes sure that the data from a different application is not interchanged. For example, if we run the Internet browser, chat application, and download manager at the same time, this layer will be responsible for establishing the session for every single application and ensure that they remain separated from other applications.
There are three communication methods that are used by this layer: the simplex, half-duplex, or full-duplex method.
In the simplex method, data can only be transferred by one party, so the other cannot transfer any data. This method is no longer common in use, since we need applications that can interact with each other.
In the half-duplex method, any data can be transferred to all the involved devices, but only one device can transfer the data in the time, after it completes the sending process. Then, the others can also send and transfer data.
The full-duplex method can transfer data to all the devices at the same time. To send and receive data, this method uses different paths.
THE PRESENTATION LAYER
The Presentation layer role is used to determine the data that has been sent, to translate the data into the appropriate format, and then to present it. For example, we send an MP3 file over the network and the file is split up into several segments. Then, using the header information on the segment, this layer will construct the file by translating the segments.
Moreover, this layer is responsible for data compression and decompression because all the data transmitted over the Internet is compressed to save the bandwidth. This layer is also responsible for data encryption and decryption in order to secure communication between two devices.
THE APPLICATION LAYER
The Application layer deals with the computer application that is used by a user. Only the application that connects to a network will connect to this layer. This layer contains several protocols that are needed by a user, which are as follows:
The Domain Name System (DNS): This protocol is the one that finds the hostname of an IP address. With this system, we do not need to memorize every IP address any longer, just the hostname. We can easily remember a word in the hostname instead of a bunch of numbers in the IP address.
The Hypertext Transfer Protocol (HTTP): This protocol is the one that transmits data over the Internet on web pages. We also have the HTTPS format that is used to send encrypted data for security issues.
The File Transfer Protocol (FTP): This protocol is the one that is used to transfer files from or to an FTP server.
The Trivial FTP (TFTP): This protocol is similar to FTP, which is used to send smaller files.
The Dynamic Host Configuration Protocol (DHCP): This protocol is a method that is used to assign the TCP/IP configuration dynamically.
The Post Office Protocol (POP3): This protocol is an electronic mail protocol used to get back e-mails from POP3 servers. The server is usually hosted by an Internet Service Provider (ISP).
The Simple Mail Transfer Protocol (SMTP): This protocol is in contrast with POP3 and is used to send electronic mails.
The Internet Message Access Protocol (IMAP): This protocol is used to receive e-mail messages. With this protocol, users can save their e-mail messages on their folder on a local computer.
The Simple Network Management Protocol (SNMP): This protocol is used to manage network devices (routers and switches) and detect problems to report them before they become significant.
The Server Message Block (SMB): This protocol is an FTP that is used on Microsoft networks primarily for file and printer sharing.
This layer also decides whether enough network resources are available for network access. For instance, if you want to surf the Internet using an Internet browser, the Application layer decides whether access to the Internet is available using HTTP.
We can divide all the seven layers into two section layers: the Upper Layer and Lower Layer. The upper layer is responsible for interacting with the user and is less concerned about the low-level details, whereas the lower layer is responsible for transferring data over the network, such as formatting and encoding.
There are FIVE LAYERS in TCP/IP Model and SEVEN LAYERS in OSI Reference Model.
The primary difference between our five-layer model and the seven-layer OSI model is that the OSI model abstracts the application layer into three layers total.
The physical layer represents the physical devices that interconnect computers. This includes the specifications for the networking cables and the connectors that join devices together along with specifications describing how signals are sent over these connections. The physical layer is all about cabling, connectors and sending signals.
The second layer in our model is known as the data link layer. Also called the network interface or the network access layer. The data link layer is responsible for defining a common way of interpreting the signals, so network devices can communicate. Lots of protocols exist at the data link layer, but the most common is known as Ethernet.
The third layer, the network layer is also sometimes called the Internet layer. It's this layer that allows different networks to communicate with each other through devices known as routers.
The most common protocol used at this layer is known as IP or Internet Protocol. IP is the heart of the Internet and most small networks around the world.
While the data link layer is responsible for getting data across a
single link, the network layer is responsible for getting data
delivered across a collection of networks.
While the network layer delivers data between two individual nodes, the transport layer sorts out which client and server programs are supposed to get that data. The transport layer Protocol is known as TCP or Transmission Control Protocol and UDP or User Datagram Protocol.
The big difference between the two is that TCP provides mechanisms to
ensure that data is reliably delivered while UDP does not.
The network layer, in our case IP, is responsible for getting data
from one node to another. The transport layer, mostly TCP and UDP, is
responsible for ensuring that data gets to the right applications
running on those nodes.
The fifth layer is known as the application layer. There are lots of different protocols at this layer, and as you might have guessed from the name, they are application-specific. Protocols used to allow you to browse the web or send receive emails are some common ones. Application Layer Protocols are HTTP, SMTP, etc.
You can think of layers like different aspects of a package being
delivered. The physical layer is the delivery truck and the
roads. The data link layer is how the delivery trucks get from
one intersection to the next over and over. The network layer
identifies which roads need to be taken to get from address A to
address B. The transport layer ensures that the delivery
driver knows how to knock on your door to tell you your package has
arrived. And the application layer is the contents of the
package itself.

Data Link Layer

I've been reading about TCP/IP layers and I've gotten a bit confused.
When we talk about the Data Link Layer it is said that it is responsible for end-to-end communication, but yet it states that the DLL receives datagram and encapsulates it into a frame and forwards it to the physical layer.
I would like to know which one it really is, whether the DLL sends the datagram to the destination datagram, or to the physical layer?
The TCP/IP model specifies the responsiblities of various layers required to abstract away the technicality of tranporting network packets from one endpoint to another. The data link layer is responsible for sending packets between two endpoints which are directly connected by a medium (e.g. ethernet cable, optic fibre, radio waves) by identifying each endpoint by a unique address (MAC address). The physical layer has the responsibility of transporting the bits of data over the medium (e.g. translating a bit to light pulses in an optic fibre), this layer is handled by hardware. The datalink layer handles the sending to an endpoint, while the physical layer handles the passing of bits on the medium (the data link packet is 'translated' to the representation of data on the medium).

When exactly are network packets created?

At which point in message transmission from client to host (or vice versa) is the message actually sliced into packets?
From my current understanding, the application puts an entire file in the socket and hands it over to TCP entirely. TCP first buffers the file/message, and when the time is right (when is the time right?) cuts chunks of the buffer data (creates packets) and adds TCP headers to transform chunks into segments.
Why do we talk about packets in the application layer, if there are no packets in the application layer at all? Just whole files... This doesn't add right.
Can someone confirm my understanding?
A TCP-based application has a message to send. What the message is depends on the application — it could be just a small request, or a whole file. It passes the message to the transport layer (TCP), which chops up the message into segments and passes them one by one to the network layer (Internet Protocol). The network layer adds a header to each packet, and passes it to the link layer (Ethernet), which handles frames.
So, in principle, we have:
messages at the application layer;
segments at the transport layer;
packets at the network layer; and
frames at the link layer.
In practice, however, people are not that pedantic, and tend to mix the notions up. You'll often hear people speak about TCP packets (the correct term would be IP packets with a TCP payload), and they will even speak about the application sending packets (the correct formulation would be that the application passes messages to the transport layer). Most of the time the inexact terminology is not a problem, since context disambiguates things.
The data are sliced into, and encapsulated by segments at the transport layer (UDP, TCP). The segments are encapsulated by packets by the network layer (IPv4, IPv6, etc.). The packets are encapsulated by frames at the data-link layer (ethernet, etc.).

Definition of Network Units: Fragment, Segment, Packet, Frame, Datagram

What units are used in network terminology? Where do we use them?
I know the following - but I'm not sure what their meaning is:
Fragment
Segment
Packet
Frame
Datagram
Can they be assigned to a specific OSI-Layer? Is it more complex?
Taking from Section 1.2 in TCP/IP Illustrated: Vol 1 by Richard Stevens et al.,
consider the 4 layered TCP/IP stack:
+-------------+-------------------------+
| Application | Telnet, FTP, etc |
+-------------+-------------------------+
| Transport | TCP, UDP |
+-------------+-------------------------+
| Network | IP, ICMP |
+-------------+-------------------------+
| Link | drivers, interface card |
+-------------+-------------------------+
Segment: If the transport protocol is TCP, the unit of data sent from TCP to
network layer is called Segment.
Datagram: This is used in 2 layers. If the network protocol is IP, the unit of
data is called Datagram. At transport layer, if protocol is UDP, we use datagram
there as well. Hence, we differentiate them as UDP Datagram, IP Datagram.
Frame: Physical layer representation.
Packet: It is a more generic term used either transport layer or network layer.
TCP Packet, UDP Packet, IP Packet etc. I have not seen it to represent
Physical layer data units.
Fragment: My guess here is that when a unit of data is chopped up by a
protocol to fit the MTU size, the resultant unit of data is called Fragments.
But I am guessing.
These terms are used to refer at which OSI layer we are referring to, the data remain same but the headers and trailers are getting added or removed.
In Phy layer i.e. physical layer the actual data is in "bits" i.e. 0 and 1.
When it reaches to data link layer or Layer 2 it becomes "frame" with source and destination mac address getting added.
When it reaches the third layer or the networking layer it becomes a "packet" with source and destination IP address attached to it.
Finally it become "segment" at Layer 4 or TCP/IP layer. Basically "segment" term is used for TCP connections and "datagrams" for UDP.
So what about other layers like : session, presentation and application ? In these layers the data is termed as "PDU" or "protocol data unit".
So when someone says, that a "frame" is being received by a networking device, then you know that the device is switch.
Router receives a packet and process it.
The answer above is complete. Nevertheless, I think the term packet came from packet switching if I remembered that correctly ..
There are 2 types :
Circuit switching is a methodology of implementing a telecommunications network in which two network nodes establish a dedicated communications channel (circuit) through the network before the nodes may communicate. The circuit guarantees the full bandwidth of the channel and remains connected for the duration of the communication session. The circuit functions as if the nodes were physically connected as with an electrical circuit.(Wiki)
Packet switching is a digital networking communications method that groups all transmitted data – regardless of content, type, or structure – into suitably sized blocks, called packets.(Wiki)
I would have defined it myself, but just to be sure.
So here is the Packet Term. In regard of fragment I concur with Josua Schmid's answer.
I agree with the answers above, but it is important to emphasize that this is assuming the TCP/IP stack. If we use the OSI model, which in my opinion is more widespread, we would have the following case:
Transport layer: Segment if TCP, Datagram if UDP
Network layer: Datagram, Fragment can be used if split (it would still be a datagram)
Data-Link layer: Frame in MAC sublayer, frame or bit in LLC sublayer (depends on what level you work with, they are not interchangeable)
Physical layer: Bit
And as mentioned in previous answers packet is more generic, it can be used for Transport, Network or Data-Link layer, but NOT for the physical layer. At this level it has not been "packed" yet. So I would say this is the biggest difference between the TCP/IP Stack model and the OSI model. The OSI model breaks down the physical layer from the TCP/IP stack into two layers: Data Link and Physical.
Hope this helps.
Frame as physical layer representation doesn't sound 100% accurate to me. It is mostly in the data-link layer, which is above the physical.
For a more operational definition, I would say that a frame is a protocol data unit that has means to determine its boundaries. Examples:
an HDLC frame has flags at the beginning and end and a bit stuffing
mechanism
an Ethernet frame uses preamble and SFD
GFP uses HEC frame delineation, like ATM
A cell, as in ATM, just to introduce one term more, is a fixed-length frame.
A packet is instead a protocol data unit that relies on a lower layer unit to determine its boundaries. It may fit exactly in one frame or be broken into fragments if required. In the latter case fragmentation and reassembly mechanisms must be devised. Datagram is mostly a synonym for packet.
An application data stream can be broken into segments. A segment is carried over a datagram, then segments are reassembled into the original application stream. This is typically done by the TCP layer. So in TCP we have application stream over TCP segment over IP datagram over data-link frame. In UDP there is no segmentation, so the UDP datagram is one-to-one mapped onto the IP datagram.
a Datagram is....
A self-contained, independent entity of data carrying sufficient information to be routed from the source to the destination computer without reliance on earlier exchanges between this source and destination computer and the transporting network. (... used in UDP)
a Segment is ....
A protocol data unit which consists a TCP header and an application data piece (packet) which comes from the (upper) Application Layer
Packet: The basic unit of communication between a source and a destination in a network is a packet. Packets are data units within the network layer in the OSI model. The packet is in a Network layer.
Fragment:Packets can often be larger than the maximum size, so each packet is also divided into smaller pieces of data called fragments. The Network layer is responsible for fragmentation.
Segment: A segment is a broken piece of a packet with a TCP header in each of them. segments increase the efficiency of network performance and improve security. Segments are in a Transport Layer.
Frame:Similar to a Packet, frames are small parts of a message in the network. a frame is the unit of data used in the OSI model’s data link layer.
Datagram:The datagram represents a data unit of transfer in networking. Data transmitted in a network is divided into smaller parts called datagrams. Transport layer
In addition, there is something class bit, this is in a Physical layer

Resources