Based on the Linux Master 2 exam syllabusReport an error
7 Application (Application) The service the user meets HTTP · FTP · SMTP · DNS
6 Presentation (Presentation) Encryption · compression · encoding JPEG · ASCII · SSL
5 Session (Session) Manages start and end of connections
─────────────────────────────────────────────────────────────
4 Transport (Transport) End-to-end delivery, reliability TCP · UDP Segment
3 Network (Network) Path selection, addressing IP · ICMP Packet
2 Data Link (Data Link) Delivery within one network, error detection MAC · Ethernet Frame
1 Physical (Physical) Converts to electrical signals Cable · hub Bit| Layer | Name | What it does | Typical device | Data unit |
|---|---|---|---|---|
| 7 | Application | User services | Gateway | Data |
| 6 | Presentation | Encryption, compression, format conversion | Data | |
| 5 | Session | Keeps connections alive, synchronization | Data | |
| 4 | Transport | End-to-end reliability, ports | Gateway | Segment |
| 3 | Network | Path selection (routing), IP addresses | Router | Packet |
| 2 | Data Link | Delivery within one network, MAC addresses | Bridge, switch | Frame |
| 1 | Physical | Sends electrical signals | Repeater, hub | Bit |
You must be able to map layer numbers to names instantly. Questions look like "What is layer 3?" → Network, or "Which layer is a router?" → Layer 3.
| Layer | Address |
|---|---|
| Layer 2 | MAC address (physical address, 48 bits) |
| Layer 3 | IP address (logical address) |
| Layer 4 | Port number |
00:1a:2b:3c:4d:5e. One hex digit is 4 bits, so 12 × 4 = 48 bits. The first half (24 bits) is the manufacturer number, and the second half is a serial number assigned by the manufacturer.Many questions do not ask for the layer name directly but give a description and ask which layer it is. Use the clue words in the sentence to sort them out.
| If the sentence contains this | Layer |
|---|---|
| Electrical/mechanical characteristics, cable, signal, bit transmission | 1 Physical |
| Between two adjacent devices, frame, MAC address, error detection | 2 Data Link |
| Path setup (routing), logical address (IP), packet | 3 Network |
| End-to-end, port, flow control, retransmission | 4 Transport |
| Dialog control, setting up/maintaining/releasing a connection, synchronization points | 5 Session |
| Encryption, compression, code/format conversion | 6 Presentation |
| Provides services to users, mail/web/file transfer | 7 Application |
| Device | Layer | What it looks at | What it does |
|---|---|---|---|
| Repeater | 1 | Looks at nothing | Amplifies the weakened signal and sends it farther |
| Hub | 1 | Looks at nothing | Sends incoming signals out to all ports |
| Bridge | 2 | MAC address | Connects two segments and passes along only the frames that are needed |
| Switch | 2 | MAC address | Sends only to the port where the destination MAC is connected |
| Router | 3 | IP address | Connects different networks and chooses paths |
| Gateway | 4~7 | Upper-layer content | Translates between networks with different protocols and connects them |
On the sending side, data goes from the upper layers down to the lower layers, and each layer adds one header. The receiving side goes back up and strips them off one by one.
7~5 Application data [ Data ]
4 Transport + TCP header (port numbers) [ TCP | Data ] Segment
3 Network + IP header (IP addresses) [ IP | TCP | Data ] Packet
2 Data Link + Ethernet header (MAC addresses) [ MAC | IP | TCP | Data | FCS ] Frame
1 Physical Converted to 0/1 signals and sent BitThe real Internet runs on the TCP/IP model, not OSI.
OSI 7 layers TCP/IP 4 layers
──────────────────────────────────────────────
7 Application ┐
6 Presentation ├──────────────► 4 Application (Application)
5 Session ┘
4 Transport ───────────────► 3 Transport (Transport)
3 Network ───────────────► 2 Internet (Internet)
2 Data Link ┐
1 Physical ┘──────────────► 1 Network Access| TCP/IP layer | OSI layers grouped | Typical protocols |
|---|---|---|
| Application | 7·6·5 | HTTP, FTP, SMTP, DNS |
| Transport | 4 | TCP, UDP |
| Internet | 3 | IP, ICMP, ARP |
| Network Access | 2·1 | Ethernet |
| Protocol | What it does | What to remember |
|---|---|---|
| IP | Adds addresses and delivers to the destination. It does not guarantee arrival | Connectionless |
| ICMP | Messages that report errors and status | The protocol ping uses |
| ARP | Finds out IP address → MAC address | The arp command |
| RARP | Finds out MAC address → IP address | The opposite of ARP (Reverse) |
| Item | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented (3-way handshake) | Connectionless |
| Reliability | Guaranteed (retransmission, ordering) | Not guaranteed |
| Speed | Slower | Faster |
| Uses | Web, mail, file transfer | Streaming, DNS, VoIP |
Client Server
│ ──────── SYN ──────────► │ 1 "May I connect?"
│ ◄────── SYN/ACK ───────── │ 2 "Sure, I'll connect too"
│ ──────── ACK ──────────► │ 3 "Confirmed"
│ ◄═════ Data transfer ═════► │| Transport protocol | Services running on top of it |
|---|---|
| TCP | HTTP · HTTPS · FTP · SSH · TELNET · SMTP · POP3 · IMAP |
| UDP | DHCP · SNMP · NTP · TFTP |
| Both | DNS — usually UDP, TCP when the response is large |
| Port | Service |
|---|---|
| 20 / 21 | FTP (data / control) |
| 22 | SSH |
| 23 | TELNET |
| 25 | SMTP (sending mail) |
| 53 | DNS |
| 80 | HTTP |
| 110 | POP3 (receiving mail) |
| 143 | IMAP |
| 443 | HTTPS |
| 631 | CUPS(IPP) |
/etc/services file.| Range | Name | Use |
|---|---|---|
| 0 ~ 1023 | Well-known ports | Fixed assignments for major services |
| 1024 ~ 49151 | Registered ports | Numbers that specific programs register and use |
| 49152 ~ 65535 | Dynamic ports | Numbers a client borrows briefly when it connects |
# /etc/services — service-name port/protocol
ftp 21/tcp
ssh 22/tcp
telnet 23/tcp
smtp 25/tcp
domain 53/udp
http 80/tcpport/protocol. The tcp or udp after it is the transport protocol that service uses.domain. Searching for dns will not find it.netstat and ss on Day 4.Tomorrow we cover how data actually travels — circuit switching and packet switching, plus several communication technologies.
Click a choice to reveal the answer and explanation.
Question 1
Which of the following corresponds to Layer 3 of the OSI 7 layers?
Question 2
Which layer of the OSI 7 layers does a router operate at?
Question 3
Which of the following is a protocol that sends data without establishing a connection, making it fast but not guaranteeing reliability?
Question 4
Which of the following is the default port number used by the SSH service?
Question 5
Which of the following is the data transfer unit of the Data Link layer in the OSI 7 layers?