The 7-layers OSI reference model (important from academic standpoint) and 4-layers TCP/IP model (practically used in day-to-day networking) help you easily understand networking features, devices, layer dependencies, and packet/frames forwarding mechanism/decisions.
Similarly, a packet becomes a frame at the Data Link layer. A frame has the physical address (MAC address) of the two nodes the data is travelling between.
Here's is a quick reference:
- Different protocols are used:
- Application layer: DHCP, DNS, FTP, HTTP, SSH, SSL/TLS, and POP
- Transport layer: TCP (connection-oriented) and UDP (connection-less)
- Network layer: IP (v4 and v6)
- Data Link layer: ARP, OSPF, and Ethernet
ARP protocol maps the MAC address with IP address (MAC-IP translation). Each device maintains its ARP cache. Different software ports are used for different protocols. For example, port 80 for HTTP and port 443 for HTTPS (uses SSL certificate).
NOTE: DNS (used for name system), DHCP (used for host configuration/dynamic IP allocation), SMTP, POP, IMAP (used for e-mail) use TCP at the underlying protocol. On the other hand, FTP (used for file transfer), HTTP/HTTPS (for Web), and SNMP (used for network management) use UDP as the underlying protocol. - Different physical devices are used. For example, switch at the Data Link layer, hub at the Physical layer, and router at the Network layer. A router has 2 IP addresses - public and private IP.
- Different packet forwarding mechanisms are used. For example, a switch's packet forwarding mechanism is based on MAC address (MAC Address table) and a router takes its decisions based on IP addresses (it uses routing table). Hub simply repeats or broadcasts; it has no intelligence.
A switch, with its empty MAC address table, behaves just like a hub in its very first cycle. In the next cycle, it learns the MAC addresses/ports, updates its MAC address table, and thereafter sends the packets intelligently to the respective ports. - Different terminologies for data at different layers: For example, bit (at Physical layer), frames (at the Data Link layer), and packets (at the Network layer).
Similarly, a packet becomes a frame at the Data Link layer. A frame has the physical address (MAC address) of the two nodes the data is travelling between.
Here's is a quick reference:
- At the Transport layer: Data + TCP header = Segment
- At the Network layer: Segment + IP header = Packet
- At the Data Link layer: Packet + Ethernet Header = Frame
Data format at each layer:
- At the Transport layer: [UDP/TCP Header + UDP/TCP Data]
At the Transport layer, TCP (connection-oriented) and UDP (connection-less), both protocols are used. The data unit is Segment for TCP and Datagram for UDP. - At the Network layer: [IP Header + IP Data]: Collectively known as a Packet.
- At the Data Link layer: [Frame Header + Frame Data + Frame Footer]: Collectively known as a Frame/Ethernet Frame.
Details on each type of header:
- For Segment
- TCP Segment: Source Port, Destination Port, Acknowledgement Number, Control Bits, Checksum etc.
- UDP Datagram: Source Port, Destination Port, Checksum etc.
- For Packet
- IPv4 Packet Fields: Version (identifies the IP version - IPv4 or IPv6), Internet Header Length, Time-to-Live, Header Checksum, Source IP Address, Destination IP Address etc.
- IPv6 Packet Fields: Version, Flow Label, Payload Length, Source Address (128-bit), Destination Address (128-bit).
- For Frame
- Generic Frame Fields: Frame Start, Addressing, Type, Control, Data, Error Detection, and Frame Stop
- Ethernet II Frame Fields: Preamble, Destination Address, Source Address, Data, etc.
- IEEE 802.3 Frame Fields: Preamble, Destination Address, Source Address, 802.2 Header and Data, etc.
- IEEE 802.3ac Frame Fields: Preamble, Destination Address, Source Address, 802.1Q VLAN Tag, 802.2 Header and Data etc.
- PPP Frame Fields: Flag, Address, Control, Protocol, Data etc.
- Wireless Frame Fields: Frame Control, Destination Address, Source Address, Receiver Address, Transmitter Address, Frame Body etc.