At which OSI layer a user-generated data resides?Understanding Internet Protocol Suite; The Internet LayerWhen does the three way handshake take place in relation to data flowing down the OSI stack?In which OSI/TCP-IP model layers do BGP, RIP protocols belong?What is purpose of router?Does every application use the layers of the OSI model?Encapsulation and decapsulation basics for OSI layerOSI model peer communicationDoes the OSI model support connectionless communication in the transport layer?Do protocols ever have standards that affect multiple layers of networking?How to explain the data flow of OSI model layers in a single picture

The mask Morokei glitched off my companion

Why is `abs()` implemented differently?

What happens to the Time Stone

Is Cola "probably the best-known" Latin word in the world? If not, which might it be?

How can I support myself financially as a 17 year old with a loan?

How can I get a job without pushing my family's income into a higher tax bracket?

Gibbs Free Energy Notation

What is Shri Venkateshwara Mangalasasana stotram recited for?

Python password manager

How can I close a gap between my fence and my neighbor's that's on his side of the property line?

If Earth is tilted, why is Polaris always above the same spot?

Alias to source .bashrc after it's been edited?

Identifying my late father's D&D stuff found in the attic

Should one double the thirds or the fifth in chords?

Quoting Yourself

Filling cracks with epoxy after Tung oil

Catholic vs Protestant Support for Nazism in Germany

Is it cheaper to drop cargo than to land it?

Junior developer struggles: how to communicate with management?

Why is parseInt(021, 8) === 15?

When and why did journal article titles become descriptive, rather than creatively allusive?

Roll Dice to get a random number between 1 and 150

Why is Arya visibly scared in the library in S8E3?

What happens if I start too many background jobs?



At which OSI layer a user-generated data resides?


Understanding Internet Protocol Suite; The Internet LayerWhen does the three way handshake take place in relation to data flowing down the OSI stack?In which OSI/TCP-IP model layers do BGP, RIP protocols belong?What is purpose of router?Does every application use the layers of the OSI model?Encapsulation and decapsulation basics for OSI layerOSI model peer communicationDoes the OSI model support connectionless communication in the transport layer?Do protocols ever have standards that affect multiple layers of networking?How to explain the data flow of OSI model layers in a single picture













2















I am getting a bit confused about which OSI layer is being used to store user-generated data.



As far as I understand the process of encapsulation, the higher layers (starting with layer 7 - application layer) are interacting with their neighbor layers one step below when passing down the data that a user/program intends to send.



So, at which of those OSI layers will the data settle down?



TCP has header and data structure, IP has header and data structure, Ethernet has header and data structure, so I'm not sure in which OSI layer the user generated data is stored during data transmission on IP networks.




One of the reasons why I ask, is uncertainty regarding a hypothetical situation - suppose we have two hosts A and B (both of them on the same vlan 10) separated by two L2 switches:



A--------SW1-------SW2--------B



In this topology, since both hosts are in VLAN 10, we don't need an L3 device in order to allow communication between the hosts. But is there any practical use of L2-only communication? Will I be able to setup the host A as a web server so that the host B could access the web communicating only using MAC addresses? Will the user data be passed down from the application layer straight to the Ethernet frame, bypassing TCP and IP layers?



Thank you










share|improve this question


























    2















    I am getting a bit confused about which OSI layer is being used to store user-generated data.



    As far as I understand the process of encapsulation, the higher layers (starting with layer 7 - application layer) are interacting with their neighbor layers one step below when passing down the data that a user/program intends to send.



    So, at which of those OSI layers will the data settle down?



    TCP has header and data structure, IP has header and data structure, Ethernet has header and data structure, so I'm not sure in which OSI layer the user generated data is stored during data transmission on IP networks.




    One of the reasons why I ask, is uncertainty regarding a hypothetical situation - suppose we have two hosts A and B (both of them on the same vlan 10) separated by two L2 switches:



    A--------SW1-------SW2--------B



    In this topology, since both hosts are in VLAN 10, we don't need an L3 device in order to allow communication between the hosts. But is there any practical use of L2-only communication? Will I be able to setup the host A as a web server so that the host B could access the web communicating only using MAC addresses? Will the user data be passed down from the application layer straight to the Ethernet frame, bypassing TCP and IP layers?



    Thank you










    share|improve this question
























      2












      2








      2


      1






      I am getting a bit confused about which OSI layer is being used to store user-generated data.



      As far as I understand the process of encapsulation, the higher layers (starting with layer 7 - application layer) are interacting with their neighbor layers one step below when passing down the data that a user/program intends to send.



      So, at which of those OSI layers will the data settle down?



      TCP has header and data structure, IP has header and data structure, Ethernet has header and data structure, so I'm not sure in which OSI layer the user generated data is stored during data transmission on IP networks.




      One of the reasons why I ask, is uncertainty regarding a hypothetical situation - suppose we have two hosts A and B (both of them on the same vlan 10) separated by two L2 switches:



      A--------SW1-------SW2--------B



      In this topology, since both hosts are in VLAN 10, we don't need an L3 device in order to allow communication between the hosts. But is there any practical use of L2-only communication? Will I be able to setup the host A as a web server so that the host B could access the web communicating only using MAC addresses? Will the user data be passed down from the application layer straight to the Ethernet frame, bypassing TCP and IP layers?



      Thank you










      share|improve this question














      I am getting a bit confused about which OSI layer is being used to store user-generated data.



      As far as I understand the process of encapsulation, the higher layers (starting with layer 7 - application layer) are interacting with their neighbor layers one step below when passing down the data that a user/program intends to send.



      So, at which of those OSI layers will the data settle down?



      TCP has header and data structure, IP has header and data structure, Ethernet has header and data structure, so I'm not sure in which OSI layer the user generated data is stored during data transmission on IP networks.




      One of the reasons why I ask, is uncertainty regarding a hypothetical situation - suppose we have two hosts A and B (both of them on the same vlan 10) separated by two L2 switches:



      A--------SW1-------SW2--------B



      In this topology, since both hosts are in VLAN 10, we don't need an L3 device in order to allow communication between the hosts. But is there any practical use of L2-only communication? Will I be able to setup the host A as a web server so that the host B could access the web communicating only using MAC addresses? Will the user data be passed down from the application layer straight to the Ethernet frame, bypassing TCP and IP layers?



      Thank you







      osi






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 29 at 8:06









      kamokobakamokoba

      153111




      153111




















          2 Answers
          2






          active

          oldest

          votes


















          6














          The OSI seven layer model is an abstraction whose purpose is to clarify concepts and make it easier to compare different networking approaches: such as the differences between internet protocol and X.25. It is not a standard that is used in actually implementing networking.



          If you're studying the internet protocol, it is much easier to understand it if you approach it in its own terms.



          Your example is very common: exactly how a desktop computers most usually communicate with printers, which are usually on the same LAN as their client computers. Assuming a TCP connection, the desktop opens a TCP connection, often to port 9100 on the printer, and starts sending PostScript or other printer-specific data. Other very common printer protocols used UDP over IP over ethernet. The exact same mechanism is used for HTTP to a web server on the LAN, or SSH to a local server.



          • The TCP connection consists of segments, just as always

          • The segments are sent in IP packets, just as always

          • The IP packets are sent as ethernet frames, just as always

          It is in fact one of the central, brilliant, ideas of the internet protocol: we're going to use the same higher-level (HTTP/IP) protocols over our local ethernet just the same as if we're crossing an ocean. Previously, computers would very frequently use a LAN-based protocol across the ethernet and something else modem-based for long-haul. In that period, if you wanted your program to communicate with a faraway host, you had to rewrite it. In the internet way, the communicating processes don't know or care if the other end is on the same computer, same room, or same planet.



          To directly answer the question: yes, we use all the layers even when communicating locally. (The single exception: if we're communicating within a single host, IP packets are transported across the operating system without ever meeting layer 2: the memory containing the IP packet from the sending process is mapped or copied to the memory of the receiving process.)



          Would it be possible to put, say, HTTP directly inside ethernet frames? Certainly, and you could easily write a server and client to do this. But it's a terrible idea. It would only work across a LAN. And you'd have to solve problems like: a) what do you do if a frame is corrupted? b) how do you maximise bandwidth and use full duplex communication? c) How do you use it at new site with Token Ring not ethernet? d) how do you use it from the ethernet site to the Token Ring site? Excellent solutions to these problems are already available: a) TCP ack mechanism, b) TCP sliding windows, c) IP packetising, d) IP forwarding.



          (For simplicity of explanation I've omitted the non-ethernet cases, security blocking, permissions, tunnelling and other real-world complexities.)






          share|improve this answer

























          • "we use all the layers even when communicating locally" - so in this case, TCP and IP processes will just pass the received data from the upper layers without doing anything to that data (adding headers, etc.), right? And continuing my example topology with L2 communication - so it would be possible to setup a web server on one host and the user on another host could access a web service by typing MAC address in the URL (however impractical it could be)?

            – kamokoba
            Mar 29 at 8:56







          • 1





            No, exactly the opposite. The TCP process segments the data stream, adds TCP headers and sends the segments in packets, just as if it's sending far away. The IP process adds IP headers just as if its sending far away. The ether process puts it in a frame, just as if its sending far away. The ethernet destination is the other host on the LAN, not the router. That is the only difference.

            – jonathanjo
            Mar 29 at 8:58







          • 1





            You could send HTTP over anything at all: handwritten, morse code, UUCP. See second-last para of answer re HTTP directly over ether and why we don't do it. It's the magical benefit of the layering is that it is as easy (ie, cheap) to send across the world as across the room, and is the reason the internet grew in the way it did.

            – jonathanjo
            Mar 29 at 9:05






          • 1





            No again I'm afraid! If there is no IP address, there will be no IP packetising, no TCP. Direct L2 communication is very specialised, normally only L2 issues such as STP (switch adjacency). In a sense ARP is "direct on L2", but only ever used where there is IP or similar addressing on top, ie where an L3 is being used.

            – jonathanjo
            Mar 29 at 9:32






          • 1





            If there is segmentation, headers, TCP etc, then you are using all the layers even if it's just across a LAN. Specifically, we are using L3 even if there is no router. The one thing that isn't happening is IP forwarding, but forwarding is only one of the main features of IP.

            – jonathanjo
            Mar 29 at 9:38


















          7














          Data isn't stored in a network, it is transported.



          User data is transported as payload by the application-layer protocol (L7) - HTTP, FTP, SMTP, ...



          For instance, if you write some text and send that per email it can be encapsulated in an RFC2822 structure (L6), transmitted per SMTP (L7), encapsulated in TCP (L4), in IPv4 (L3), Ethernet frame (L2), Ethernet PHY (L1). Each protocol layer requires the next one underneath, there's no shortcutting.



          The network layering takes care of enabling the communication on the the very same host, over a direct cable link, a switch in between, a single router, or many routers across the world.



          You need at least one router when the end nodes don't share a common L2 network (across a switch). Note that the full stack is used within the hosts in any case. With a link across a simple switch (common L2 network) there is just no need for a L3 device (router) in between.



          In no case does the application-layer protocol decide that it interfaces directly with L2 because it wouldn't need anything else. Application-layer protocols that sit right on top of L2 do exist but they're designed that way.



          The differences in the various scenarios are how the data entity is actually transported.



          • same host: Encapsulation ends at L3, L4 or even higher. The host stack passes the application-layer flows between the applications and that's it.

          • direct cable link: Encapsulation is done L7 -> L4 -> L3 -> L2 -> L1, the line-coded data is transmitted and the destination host reverses the process L1 -> L2 -> L3 -> L4 -> L7.

          • same switch/common L2 network: as before but the line-coded data is transmitted to the switch where L1 is removed, the destination MAC is extracted from the L2 frame, the according port looked up in the switch's MAC database, and the frame sent out that port, newly L1 encoded. En/decapsulation is L7 -> L4 -> L3 -> L2 -> L1 (to switch) -> L2 -> L1 (to host) -> L2 -> L3 -> L4 -> L7.

          • with a router in between and a switch between each host and the router, the router removes the L2 frame from the L3 packet, decides where to forward (based on its routing table), again encapsulates in an L2 frame, and so on. The en/decapsulation would look like L7 -> L4 -> L3 -> L2 -> L1 (to switch) -> L2 -> L1 (to router) -> L2 -> L3 -> L2 -> L1 (to other switch) -> L2 -> L1 (to host) -> L2 -> L3 -> L4 -> L7.





          share|improve this answer

























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "496"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fnetworkengineering.stackexchange.com%2fquestions%2f58109%2fat-which-osi-layer-a-user-generated-data-resides%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            6














            The OSI seven layer model is an abstraction whose purpose is to clarify concepts and make it easier to compare different networking approaches: such as the differences between internet protocol and X.25. It is not a standard that is used in actually implementing networking.



            If you're studying the internet protocol, it is much easier to understand it if you approach it in its own terms.



            Your example is very common: exactly how a desktop computers most usually communicate with printers, which are usually on the same LAN as their client computers. Assuming a TCP connection, the desktop opens a TCP connection, often to port 9100 on the printer, and starts sending PostScript or other printer-specific data. Other very common printer protocols used UDP over IP over ethernet. The exact same mechanism is used for HTTP to a web server on the LAN, or SSH to a local server.



            • The TCP connection consists of segments, just as always

            • The segments are sent in IP packets, just as always

            • The IP packets are sent as ethernet frames, just as always

            It is in fact one of the central, brilliant, ideas of the internet protocol: we're going to use the same higher-level (HTTP/IP) protocols over our local ethernet just the same as if we're crossing an ocean. Previously, computers would very frequently use a LAN-based protocol across the ethernet and something else modem-based for long-haul. In that period, if you wanted your program to communicate with a faraway host, you had to rewrite it. In the internet way, the communicating processes don't know or care if the other end is on the same computer, same room, or same planet.



            To directly answer the question: yes, we use all the layers even when communicating locally. (The single exception: if we're communicating within a single host, IP packets are transported across the operating system without ever meeting layer 2: the memory containing the IP packet from the sending process is mapped or copied to the memory of the receiving process.)



            Would it be possible to put, say, HTTP directly inside ethernet frames? Certainly, and you could easily write a server and client to do this. But it's a terrible idea. It would only work across a LAN. And you'd have to solve problems like: a) what do you do if a frame is corrupted? b) how do you maximise bandwidth and use full duplex communication? c) How do you use it at new site with Token Ring not ethernet? d) how do you use it from the ethernet site to the Token Ring site? Excellent solutions to these problems are already available: a) TCP ack mechanism, b) TCP sliding windows, c) IP packetising, d) IP forwarding.



            (For simplicity of explanation I've omitted the non-ethernet cases, security blocking, permissions, tunnelling and other real-world complexities.)






            share|improve this answer

























            • "we use all the layers even when communicating locally" - so in this case, TCP and IP processes will just pass the received data from the upper layers without doing anything to that data (adding headers, etc.), right? And continuing my example topology with L2 communication - so it would be possible to setup a web server on one host and the user on another host could access a web service by typing MAC address in the URL (however impractical it could be)?

              – kamokoba
              Mar 29 at 8:56







            • 1





              No, exactly the opposite. The TCP process segments the data stream, adds TCP headers and sends the segments in packets, just as if it's sending far away. The IP process adds IP headers just as if its sending far away. The ether process puts it in a frame, just as if its sending far away. The ethernet destination is the other host on the LAN, not the router. That is the only difference.

              – jonathanjo
              Mar 29 at 8:58







            • 1





              You could send HTTP over anything at all: handwritten, morse code, UUCP. See second-last para of answer re HTTP directly over ether and why we don't do it. It's the magical benefit of the layering is that it is as easy (ie, cheap) to send across the world as across the room, and is the reason the internet grew in the way it did.

              – jonathanjo
              Mar 29 at 9:05






            • 1





              No again I'm afraid! If there is no IP address, there will be no IP packetising, no TCP. Direct L2 communication is very specialised, normally only L2 issues such as STP (switch adjacency). In a sense ARP is "direct on L2", but only ever used where there is IP or similar addressing on top, ie where an L3 is being used.

              – jonathanjo
              Mar 29 at 9:32






            • 1





              If there is segmentation, headers, TCP etc, then you are using all the layers even if it's just across a LAN. Specifically, we are using L3 even if there is no router. The one thing that isn't happening is IP forwarding, but forwarding is only one of the main features of IP.

              – jonathanjo
              Mar 29 at 9:38















            6














            The OSI seven layer model is an abstraction whose purpose is to clarify concepts and make it easier to compare different networking approaches: such as the differences between internet protocol and X.25. It is not a standard that is used in actually implementing networking.



            If you're studying the internet protocol, it is much easier to understand it if you approach it in its own terms.



            Your example is very common: exactly how a desktop computers most usually communicate with printers, which are usually on the same LAN as their client computers. Assuming a TCP connection, the desktop opens a TCP connection, often to port 9100 on the printer, and starts sending PostScript or other printer-specific data. Other very common printer protocols used UDP over IP over ethernet. The exact same mechanism is used for HTTP to a web server on the LAN, or SSH to a local server.



            • The TCP connection consists of segments, just as always

            • The segments are sent in IP packets, just as always

            • The IP packets are sent as ethernet frames, just as always

            It is in fact one of the central, brilliant, ideas of the internet protocol: we're going to use the same higher-level (HTTP/IP) protocols over our local ethernet just the same as if we're crossing an ocean. Previously, computers would very frequently use a LAN-based protocol across the ethernet and something else modem-based for long-haul. In that period, if you wanted your program to communicate with a faraway host, you had to rewrite it. In the internet way, the communicating processes don't know or care if the other end is on the same computer, same room, or same planet.



            To directly answer the question: yes, we use all the layers even when communicating locally. (The single exception: if we're communicating within a single host, IP packets are transported across the operating system without ever meeting layer 2: the memory containing the IP packet from the sending process is mapped or copied to the memory of the receiving process.)



            Would it be possible to put, say, HTTP directly inside ethernet frames? Certainly, and you could easily write a server and client to do this. But it's a terrible idea. It would only work across a LAN. And you'd have to solve problems like: a) what do you do if a frame is corrupted? b) how do you maximise bandwidth and use full duplex communication? c) How do you use it at new site with Token Ring not ethernet? d) how do you use it from the ethernet site to the Token Ring site? Excellent solutions to these problems are already available: a) TCP ack mechanism, b) TCP sliding windows, c) IP packetising, d) IP forwarding.



            (For simplicity of explanation I've omitted the non-ethernet cases, security blocking, permissions, tunnelling and other real-world complexities.)






            share|improve this answer

























            • "we use all the layers even when communicating locally" - so in this case, TCP and IP processes will just pass the received data from the upper layers without doing anything to that data (adding headers, etc.), right? And continuing my example topology with L2 communication - so it would be possible to setup a web server on one host and the user on another host could access a web service by typing MAC address in the URL (however impractical it could be)?

              – kamokoba
              Mar 29 at 8:56







            • 1





              No, exactly the opposite. The TCP process segments the data stream, adds TCP headers and sends the segments in packets, just as if it's sending far away. The IP process adds IP headers just as if its sending far away. The ether process puts it in a frame, just as if its sending far away. The ethernet destination is the other host on the LAN, not the router. That is the only difference.

              – jonathanjo
              Mar 29 at 8:58







            • 1





              You could send HTTP over anything at all: handwritten, morse code, UUCP. See second-last para of answer re HTTP directly over ether and why we don't do it. It's the magical benefit of the layering is that it is as easy (ie, cheap) to send across the world as across the room, and is the reason the internet grew in the way it did.

              – jonathanjo
              Mar 29 at 9:05






            • 1





              No again I'm afraid! If there is no IP address, there will be no IP packetising, no TCP. Direct L2 communication is very specialised, normally only L2 issues such as STP (switch adjacency). In a sense ARP is "direct on L2", but only ever used where there is IP or similar addressing on top, ie where an L3 is being used.

              – jonathanjo
              Mar 29 at 9:32






            • 1





              If there is segmentation, headers, TCP etc, then you are using all the layers even if it's just across a LAN. Specifically, we are using L3 even if there is no router. The one thing that isn't happening is IP forwarding, but forwarding is only one of the main features of IP.

              – jonathanjo
              Mar 29 at 9:38













            6












            6








            6







            The OSI seven layer model is an abstraction whose purpose is to clarify concepts and make it easier to compare different networking approaches: such as the differences between internet protocol and X.25. It is not a standard that is used in actually implementing networking.



            If you're studying the internet protocol, it is much easier to understand it if you approach it in its own terms.



            Your example is very common: exactly how a desktop computers most usually communicate with printers, which are usually on the same LAN as their client computers. Assuming a TCP connection, the desktop opens a TCP connection, often to port 9100 on the printer, and starts sending PostScript or other printer-specific data. Other very common printer protocols used UDP over IP over ethernet. The exact same mechanism is used for HTTP to a web server on the LAN, or SSH to a local server.



            • The TCP connection consists of segments, just as always

            • The segments are sent in IP packets, just as always

            • The IP packets are sent as ethernet frames, just as always

            It is in fact one of the central, brilliant, ideas of the internet protocol: we're going to use the same higher-level (HTTP/IP) protocols over our local ethernet just the same as if we're crossing an ocean. Previously, computers would very frequently use a LAN-based protocol across the ethernet and something else modem-based for long-haul. In that period, if you wanted your program to communicate with a faraway host, you had to rewrite it. In the internet way, the communicating processes don't know or care if the other end is on the same computer, same room, or same planet.



            To directly answer the question: yes, we use all the layers even when communicating locally. (The single exception: if we're communicating within a single host, IP packets are transported across the operating system without ever meeting layer 2: the memory containing the IP packet from the sending process is mapped or copied to the memory of the receiving process.)



            Would it be possible to put, say, HTTP directly inside ethernet frames? Certainly, and you could easily write a server and client to do this. But it's a terrible idea. It would only work across a LAN. And you'd have to solve problems like: a) what do you do if a frame is corrupted? b) how do you maximise bandwidth and use full duplex communication? c) How do you use it at new site with Token Ring not ethernet? d) how do you use it from the ethernet site to the Token Ring site? Excellent solutions to these problems are already available: a) TCP ack mechanism, b) TCP sliding windows, c) IP packetising, d) IP forwarding.



            (For simplicity of explanation I've omitted the non-ethernet cases, security blocking, permissions, tunnelling and other real-world complexities.)






            share|improve this answer















            The OSI seven layer model is an abstraction whose purpose is to clarify concepts and make it easier to compare different networking approaches: such as the differences between internet protocol and X.25. It is not a standard that is used in actually implementing networking.



            If you're studying the internet protocol, it is much easier to understand it if you approach it in its own terms.



            Your example is very common: exactly how a desktop computers most usually communicate with printers, which are usually on the same LAN as their client computers. Assuming a TCP connection, the desktop opens a TCP connection, often to port 9100 on the printer, and starts sending PostScript or other printer-specific data. Other very common printer protocols used UDP over IP over ethernet. The exact same mechanism is used for HTTP to a web server on the LAN, or SSH to a local server.



            • The TCP connection consists of segments, just as always

            • The segments are sent in IP packets, just as always

            • The IP packets are sent as ethernet frames, just as always

            It is in fact one of the central, brilliant, ideas of the internet protocol: we're going to use the same higher-level (HTTP/IP) protocols over our local ethernet just the same as if we're crossing an ocean. Previously, computers would very frequently use a LAN-based protocol across the ethernet and something else modem-based for long-haul. In that period, if you wanted your program to communicate with a faraway host, you had to rewrite it. In the internet way, the communicating processes don't know or care if the other end is on the same computer, same room, or same planet.



            To directly answer the question: yes, we use all the layers even when communicating locally. (The single exception: if we're communicating within a single host, IP packets are transported across the operating system without ever meeting layer 2: the memory containing the IP packet from the sending process is mapped or copied to the memory of the receiving process.)



            Would it be possible to put, say, HTTP directly inside ethernet frames? Certainly, and you could easily write a server and client to do this. But it's a terrible idea. It would only work across a LAN. And you'd have to solve problems like: a) what do you do if a frame is corrupted? b) how do you maximise bandwidth and use full duplex communication? c) How do you use it at new site with Token Ring not ethernet? d) how do you use it from the ethernet site to the Token Ring site? Excellent solutions to these problems are already available: a) TCP ack mechanism, b) TCP sliding windows, c) IP packetising, d) IP forwarding.



            (For simplicity of explanation I've omitted the non-ethernet cases, security blocking, permissions, tunnelling and other real-world complexities.)







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 29 at 8:56

























            answered Mar 29 at 8:38









            jonathanjojonathanjo

            12.6k1938




            12.6k1938












            • "we use all the layers even when communicating locally" - so in this case, TCP and IP processes will just pass the received data from the upper layers without doing anything to that data (adding headers, etc.), right? And continuing my example topology with L2 communication - so it would be possible to setup a web server on one host and the user on another host could access a web service by typing MAC address in the URL (however impractical it could be)?

              – kamokoba
              Mar 29 at 8:56







            • 1





              No, exactly the opposite. The TCP process segments the data stream, adds TCP headers and sends the segments in packets, just as if it's sending far away. The IP process adds IP headers just as if its sending far away. The ether process puts it in a frame, just as if its sending far away. The ethernet destination is the other host on the LAN, not the router. That is the only difference.

              – jonathanjo
              Mar 29 at 8:58







            • 1





              You could send HTTP over anything at all: handwritten, morse code, UUCP. See second-last para of answer re HTTP directly over ether and why we don't do it. It's the magical benefit of the layering is that it is as easy (ie, cheap) to send across the world as across the room, and is the reason the internet grew in the way it did.

              – jonathanjo
              Mar 29 at 9:05






            • 1





              No again I'm afraid! If there is no IP address, there will be no IP packetising, no TCP. Direct L2 communication is very specialised, normally only L2 issues such as STP (switch adjacency). In a sense ARP is "direct on L2", but only ever used where there is IP or similar addressing on top, ie where an L3 is being used.

              – jonathanjo
              Mar 29 at 9:32






            • 1





              If there is segmentation, headers, TCP etc, then you are using all the layers even if it's just across a LAN. Specifically, we are using L3 even if there is no router. The one thing that isn't happening is IP forwarding, but forwarding is only one of the main features of IP.

              – jonathanjo
              Mar 29 at 9:38

















            • "we use all the layers even when communicating locally" - so in this case, TCP and IP processes will just pass the received data from the upper layers without doing anything to that data (adding headers, etc.), right? And continuing my example topology with L2 communication - so it would be possible to setup a web server on one host and the user on another host could access a web service by typing MAC address in the URL (however impractical it could be)?

              – kamokoba
              Mar 29 at 8:56







            • 1





              No, exactly the opposite. The TCP process segments the data stream, adds TCP headers and sends the segments in packets, just as if it's sending far away. The IP process adds IP headers just as if its sending far away. The ether process puts it in a frame, just as if its sending far away. The ethernet destination is the other host on the LAN, not the router. That is the only difference.

              – jonathanjo
              Mar 29 at 8:58







            • 1





              You could send HTTP over anything at all: handwritten, morse code, UUCP. See second-last para of answer re HTTP directly over ether and why we don't do it. It's the magical benefit of the layering is that it is as easy (ie, cheap) to send across the world as across the room, and is the reason the internet grew in the way it did.

              – jonathanjo
              Mar 29 at 9:05






            • 1





              No again I'm afraid! If there is no IP address, there will be no IP packetising, no TCP. Direct L2 communication is very specialised, normally only L2 issues such as STP (switch adjacency). In a sense ARP is "direct on L2", but only ever used where there is IP or similar addressing on top, ie where an L3 is being used.

              – jonathanjo
              Mar 29 at 9:32






            • 1





              If there is segmentation, headers, TCP etc, then you are using all the layers even if it's just across a LAN. Specifically, we are using L3 even if there is no router. The one thing that isn't happening is IP forwarding, but forwarding is only one of the main features of IP.

              – jonathanjo
              Mar 29 at 9:38
















            "we use all the layers even when communicating locally" - so in this case, TCP and IP processes will just pass the received data from the upper layers without doing anything to that data (adding headers, etc.), right? And continuing my example topology with L2 communication - so it would be possible to setup a web server on one host and the user on another host could access a web service by typing MAC address in the URL (however impractical it could be)?

            – kamokoba
            Mar 29 at 8:56






            "we use all the layers even when communicating locally" - so in this case, TCP and IP processes will just pass the received data from the upper layers without doing anything to that data (adding headers, etc.), right? And continuing my example topology with L2 communication - so it would be possible to setup a web server on one host and the user on another host could access a web service by typing MAC address in the URL (however impractical it could be)?

            – kamokoba
            Mar 29 at 8:56





            1




            1





            No, exactly the opposite. The TCP process segments the data stream, adds TCP headers and sends the segments in packets, just as if it's sending far away. The IP process adds IP headers just as if its sending far away. The ether process puts it in a frame, just as if its sending far away. The ethernet destination is the other host on the LAN, not the router. That is the only difference.

            – jonathanjo
            Mar 29 at 8:58






            No, exactly the opposite. The TCP process segments the data stream, adds TCP headers and sends the segments in packets, just as if it's sending far away. The IP process adds IP headers just as if its sending far away. The ether process puts it in a frame, just as if its sending far away. The ethernet destination is the other host on the LAN, not the router. That is the only difference.

            – jonathanjo
            Mar 29 at 8:58





            1




            1





            You could send HTTP over anything at all: handwritten, morse code, UUCP. See second-last para of answer re HTTP directly over ether and why we don't do it. It's the magical benefit of the layering is that it is as easy (ie, cheap) to send across the world as across the room, and is the reason the internet grew in the way it did.

            – jonathanjo
            Mar 29 at 9:05





            You could send HTTP over anything at all: handwritten, morse code, UUCP. See second-last para of answer re HTTP directly over ether and why we don't do it. It's the magical benefit of the layering is that it is as easy (ie, cheap) to send across the world as across the room, and is the reason the internet grew in the way it did.

            – jonathanjo
            Mar 29 at 9:05




            1




            1





            No again I'm afraid! If there is no IP address, there will be no IP packetising, no TCP. Direct L2 communication is very specialised, normally only L2 issues such as STP (switch adjacency). In a sense ARP is "direct on L2", but only ever used where there is IP or similar addressing on top, ie where an L3 is being used.

            – jonathanjo
            Mar 29 at 9:32





            No again I'm afraid! If there is no IP address, there will be no IP packetising, no TCP. Direct L2 communication is very specialised, normally only L2 issues such as STP (switch adjacency). In a sense ARP is "direct on L2", but only ever used where there is IP or similar addressing on top, ie where an L3 is being used.

            – jonathanjo
            Mar 29 at 9:32




            1




            1





            If there is segmentation, headers, TCP etc, then you are using all the layers even if it's just across a LAN. Specifically, we are using L3 even if there is no router. The one thing that isn't happening is IP forwarding, but forwarding is only one of the main features of IP.

            – jonathanjo
            Mar 29 at 9:38





            If there is segmentation, headers, TCP etc, then you are using all the layers even if it's just across a LAN. Specifically, we are using L3 even if there is no router. The one thing that isn't happening is IP forwarding, but forwarding is only one of the main features of IP.

            – jonathanjo
            Mar 29 at 9:38











            7














            Data isn't stored in a network, it is transported.



            User data is transported as payload by the application-layer protocol (L7) - HTTP, FTP, SMTP, ...



            For instance, if you write some text and send that per email it can be encapsulated in an RFC2822 structure (L6), transmitted per SMTP (L7), encapsulated in TCP (L4), in IPv4 (L3), Ethernet frame (L2), Ethernet PHY (L1). Each protocol layer requires the next one underneath, there's no shortcutting.



            The network layering takes care of enabling the communication on the the very same host, over a direct cable link, a switch in between, a single router, or many routers across the world.



            You need at least one router when the end nodes don't share a common L2 network (across a switch). Note that the full stack is used within the hosts in any case. With a link across a simple switch (common L2 network) there is just no need for a L3 device (router) in between.



            In no case does the application-layer protocol decide that it interfaces directly with L2 because it wouldn't need anything else. Application-layer protocols that sit right on top of L2 do exist but they're designed that way.



            The differences in the various scenarios are how the data entity is actually transported.



            • same host: Encapsulation ends at L3, L4 or even higher. The host stack passes the application-layer flows between the applications and that's it.

            • direct cable link: Encapsulation is done L7 -> L4 -> L3 -> L2 -> L1, the line-coded data is transmitted and the destination host reverses the process L1 -> L2 -> L3 -> L4 -> L7.

            • same switch/common L2 network: as before but the line-coded data is transmitted to the switch where L1 is removed, the destination MAC is extracted from the L2 frame, the according port looked up in the switch's MAC database, and the frame sent out that port, newly L1 encoded. En/decapsulation is L7 -> L4 -> L3 -> L2 -> L1 (to switch) -> L2 -> L1 (to host) -> L2 -> L3 -> L4 -> L7.

            • with a router in between and a switch between each host and the router, the router removes the L2 frame from the L3 packet, decides where to forward (based on its routing table), again encapsulates in an L2 frame, and so on. The en/decapsulation would look like L7 -> L4 -> L3 -> L2 -> L1 (to switch) -> L2 -> L1 (to router) -> L2 -> L3 -> L2 -> L1 (to other switch) -> L2 -> L1 (to host) -> L2 -> L3 -> L4 -> L7.





            share|improve this answer





























              7














              Data isn't stored in a network, it is transported.



              User data is transported as payload by the application-layer protocol (L7) - HTTP, FTP, SMTP, ...



              For instance, if you write some text and send that per email it can be encapsulated in an RFC2822 structure (L6), transmitted per SMTP (L7), encapsulated in TCP (L4), in IPv4 (L3), Ethernet frame (L2), Ethernet PHY (L1). Each protocol layer requires the next one underneath, there's no shortcutting.



              The network layering takes care of enabling the communication on the the very same host, over a direct cable link, a switch in between, a single router, or many routers across the world.



              You need at least one router when the end nodes don't share a common L2 network (across a switch). Note that the full stack is used within the hosts in any case. With a link across a simple switch (common L2 network) there is just no need for a L3 device (router) in between.



              In no case does the application-layer protocol decide that it interfaces directly with L2 because it wouldn't need anything else. Application-layer protocols that sit right on top of L2 do exist but they're designed that way.



              The differences in the various scenarios are how the data entity is actually transported.



              • same host: Encapsulation ends at L3, L4 or even higher. The host stack passes the application-layer flows between the applications and that's it.

              • direct cable link: Encapsulation is done L7 -> L4 -> L3 -> L2 -> L1, the line-coded data is transmitted and the destination host reverses the process L1 -> L2 -> L3 -> L4 -> L7.

              • same switch/common L2 network: as before but the line-coded data is transmitted to the switch where L1 is removed, the destination MAC is extracted from the L2 frame, the according port looked up in the switch's MAC database, and the frame sent out that port, newly L1 encoded. En/decapsulation is L7 -> L4 -> L3 -> L2 -> L1 (to switch) -> L2 -> L1 (to host) -> L2 -> L3 -> L4 -> L7.

              • with a router in between and a switch between each host and the router, the router removes the L2 frame from the L3 packet, decides where to forward (based on its routing table), again encapsulates in an L2 frame, and so on. The en/decapsulation would look like L7 -> L4 -> L3 -> L2 -> L1 (to switch) -> L2 -> L1 (to router) -> L2 -> L3 -> L2 -> L1 (to other switch) -> L2 -> L1 (to host) -> L2 -> L3 -> L4 -> L7.





              share|improve this answer



























                7












                7








                7







                Data isn't stored in a network, it is transported.



                User data is transported as payload by the application-layer protocol (L7) - HTTP, FTP, SMTP, ...



                For instance, if you write some text and send that per email it can be encapsulated in an RFC2822 structure (L6), transmitted per SMTP (L7), encapsulated in TCP (L4), in IPv4 (L3), Ethernet frame (L2), Ethernet PHY (L1). Each protocol layer requires the next one underneath, there's no shortcutting.



                The network layering takes care of enabling the communication on the the very same host, over a direct cable link, a switch in between, a single router, or many routers across the world.



                You need at least one router when the end nodes don't share a common L2 network (across a switch). Note that the full stack is used within the hosts in any case. With a link across a simple switch (common L2 network) there is just no need for a L3 device (router) in between.



                In no case does the application-layer protocol decide that it interfaces directly with L2 because it wouldn't need anything else. Application-layer protocols that sit right on top of L2 do exist but they're designed that way.



                The differences in the various scenarios are how the data entity is actually transported.



                • same host: Encapsulation ends at L3, L4 or even higher. The host stack passes the application-layer flows between the applications and that's it.

                • direct cable link: Encapsulation is done L7 -> L4 -> L3 -> L2 -> L1, the line-coded data is transmitted and the destination host reverses the process L1 -> L2 -> L3 -> L4 -> L7.

                • same switch/common L2 network: as before but the line-coded data is transmitted to the switch where L1 is removed, the destination MAC is extracted from the L2 frame, the according port looked up in the switch's MAC database, and the frame sent out that port, newly L1 encoded. En/decapsulation is L7 -> L4 -> L3 -> L2 -> L1 (to switch) -> L2 -> L1 (to host) -> L2 -> L3 -> L4 -> L7.

                • with a router in between and a switch between each host and the router, the router removes the L2 frame from the L3 packet, decides where to forward (based on its routing table), again encapsulates in an L2 frame, and so on. The en/decapsulation would look like L7 -> L4 -> L3 -> L2 -> L1 (to switch) -> L2 -> L1 (to router) -> L2 -> L3 -> L2 -> L1 (to other switch) -> L2 -> L1 (to host) -> L2 -> L3 -> L4 -> L7.





                share|improve this answer















                Data isn't stored in a network, it is transported.



                User data is transported as payload by the application-layer protocol (L7) - HTTP, FTP, SMTP, ...



                For instance, if you write some text and send that per email it can be encapsulated in an RFC2822 structure (L6), transmitted per SMTP (L7), encapsulated in TCP (L4), in IPv4 (L3), Ethernet frame (L2), Ethernet PHY (L1). Each protocol layer requires the next one underneath, there's no shortcutting.



                The network layering takes care of enabling the communication on the the very same host, over a direct cable link, a switch in between, a single router, or many routers across the world.



                You need at least one router when the end nodes don't share a common L2 network (across a switch). Note that the full stack is used within the hosts in any case. With a link across a simple switch (common L2 network) there is just no need for a L3 device (router) in between.



                In no case does the application-layer protocol decide that it interfaces directly with L2 because it wouldn't need anything else. Application-layer protocols that sit right on top of L2 do exist but they're designed that way.



                The differences in the various scenarios are how the data entity is actually transported.



                • same host: Encapsulation ends at L3, L4 or even higher. The host stack passes the application-layer flows between the applications and that's it.

                • direct cable link: Encapsulation is done L7 -> L4 -> L3 -> L2 -> L1, the line-coded data is transmitted and the destination host reverses the process L1 -> L2 -> L3 -> L4 -> L7.

                • same switch/common L2 network: as before but the line-coded data is transmitted to the switch where L1 is removed, the destination MAC is extracted from the L2 frame, the according port looked up in the switch's MAC database, and the frame sent out that port, newly L1 encoded. En/decapsulation is L7 -> L4 -> L3 -> L2 -> L1 (to switch) -> L2 -> L1 (to host) -> L2 -> L3 -> L4 -> L7.

                • with a router in between and a switch between each host and the router, the router removes the L2 frame from the L3 packet, decides where to forward (based on its routing table), again encapsulates in an L2 frame, and so on. The en/decapsulation would look like L7 -> L4 -> L3 -> L2 -> L1 (to switch) -> L2 -> L1 (to router) -> L2 -> L3 -> L2 -> L1 (to other switch) -> L2 -> L1 (to host) -> L2 -> L3 -> L4 -> L7.






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 29 at 15:44

























                answered Mar 29 at 8:41









                Zac67Zac67

                33.8k22167




                33.8k22167



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Network Engineering Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fnetworkengineering.stackexchange.com%2fquestions%2f58109%2fat-which-osi-layer-a-user-generated-data-resides%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Færeyskur hestur Heimild | Tengill | Tilvísanir | LeiðsagnarvalRossið - síða um færeyska hrossið á færeyskuGott ár hjá færeyska hestinum

                    He _____ here since 1970 . Answer needed [closed]What does “since he was so high” mean?Meaning of “catch birds for”?How do I ensure “since” takes the meaning I want?“Who cares here” meaningWhat does “right round toward” mean?the time tense (had now been detected)What does the phrase “ring around the roses” mean here?Correct usage of “visited upon”Meaning of “foiled rail sabotage bid”It was the third time I had gone to Rome or It is the third time I had been to Rome

                    Bunad