Creating Protocol Data Units (Encapsulation demo)
This is a discussion on how a simple phrase such as “Hi” turns into hundreds of bits as it gets encapsulated.
- [#ncapxmpl]: Early decisions
For this example, we are going to make some decisions here: The machine sending the message is 192.0.2.102 and we want to communicate to 192.0.2.10 on the SMTP TCP port. We'll also need some sample MAC addresses: we'll assume 192.0.2.102 is 4E-28-5A-61-20-C5 and 192.0.2.10 is 4E-28-5A-61-20-C5.
- The message
Normally when contacting an SMTP port, the first outgoing message will be a four character version of “HELLO”, possibly with the first two letters swapped (“HELO” for SMTP or “EHLO” to specify ESMTP).
However, to make this very simple, we are going to abbreviate even that, to “Hi”.
Look up Code Page 437 (or an ASCII chart). ASCII-Codes.com (code page 437) seems to provide a decent showing of codes in Decimal, Hexadecimal, and Code Page 437. From this, we can get H=72 i=105 or 0x4869 (H is 0x48 and i is 0x69). super-fast converting between binary and hexadecimal shows us that is equivilent to the following two bits:
Now, if this is the simple message that we want to send over TCP, we need to prepare a TCP segment (sometimes called a TCP datagram).
Now, if we are at the Application Layer of the TCP/IP model, the next layer down to communicate with is the Transport Layer of the TCP/IP model. If we are discussing the OSI Model, we essentially do the same thing (have the Application Layer send information to the Transport Layer), though perhaps a bit less directly.
For further details, see making a TCP segment.
We now have an example TCP segment. However, we do need to get this sent to the desired IP address...
- Creating an IPv4 packet
- Data Link Layer
This involves more bits, but fewer categories. Therefore, this will likely involve less reading than the prior layers.
See: Making an Ethernet frame.
- Layer 1