If I got it right, TCP and IP packets are created normally by software running in the kernel. So when I as a user open up a socket of type TCP/IP and send a message, the kernel takes care of all those protocols details such as splitting the message to packets, prepending TCP and IP headers, etc.

Now, if I understand correctly, a layer 2 frame are technology specific - so a frame will look differently if you use Ethernet, WiFi, or any other layer 2 technology. so my question is: does this mean that the layer 2 protocol headers are generated and handled by the NIC device driver?

  • Did any answer help you? if so, you should accept the answer so that the question does not keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer.
    – Ron Maupin
    Dec 23, 2021 at 21:46

1 Answer 1


More or less, yes. The application will simply pass it's data up the stack. It's up to the subsequent layers to break that message down into packets, by understand enough about the next layer to not make it impossible. (i.e. a TCP packet can be 64k, but the ethernet interface's MTU is 1500, so don't give it more than that.) Each layer will add whatever its protocol requires.

(Some layer-2 protocols don't really care what they're handed. ATM, for example, will break the payload into as many cells as necessary.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.