A trainee analyst is reading a firewall log that names services only by TCP port. Match each port to the service that uses it.
Choose the match for each entry. Every match has to be right.
Once a message reaches the right computer it still has to reach the right program, and the sender has to decide whether to check that it arrived. Two transport protocols do this work: TCP confirms that everything arrived and resends what is lost. UDP sends and does not confirm. Port numbers name the program at each end. No background is assumed. Firewall rules, scan reports and most network attacks are described in these terms.
An illustrative example
At home, Maya is on a video call with her sister while her laptop downloads a large folder of holiday photographs. For a moment the Wi-Fi falters. The picture freezes, three or four words are lost, and the call carries on as if nothing had happened.
The download pauses too. When it finishes, every photograph opens perfectly. Not one is damaged or missing a corner.
Why did the network replace every missing piece of the photographs and none of the missing words?
The , layer 4, carries data between two programs. It offers two services, and the program chooses between them.
The Transmission Control Protocol (TCP) is like recorded delivery. The two ends first agree to talk. Every piece is numbered, the receiver confirms what arrived, and anything missing is sent again. is connection-oriented and reliable.
The User Datagram Protocol (UDP) is like dropping postcards in a postbox. Each one is sent on its own, with no agreement beforehand, no confirmation and no resending. is connectionless, and its delivery is described as best effort.
| Point | TCP | UDP |
|---|---|---|
| Before sending | Sets up a connection with a handshake | Nothing: it just sends |
| Lost data | Detected and sent again | Stays lost unless the program itself asks again |
| Order | Delivered in the order sent | May arrive in any order |
| Cost | More delay and a larger header | Little delay and a small header |
| Unit of data | Segment | |
| Typical uses | Web pages, email, file transfer, remote login | Name lookups, voice and video calls, handing out addresses |
| Protocol number in the IP header | 6 | 17 |
Maya's call and her download
The call used UDP. A word that arrives a second late is useless, so nothing is sent again and the call moves on. The download used TCP. Getting every byte mattered more than speed, so each lost piece was sent again.
Before any data moves, TCP runs a three-way handshake. Each message carries flags: single bits in the TCP header that mark what the message is for.
Before any data moves, TCP runs a three-way handshake between a client and a server. Each message is marked by flags, single bits in the TCP header. The figure shows the three messages crossing in order, with time running down, and the state each end is in.
The short form is SYN, SYN-ACK, ACK. After the second step the server holds a half-open connection: it has set aside memory for a caller who has not yet confirmed. That waiting state is what flooding attacks on TCP abuse.
Closing takes four steps. One side sends FIN, for finish, and the other acknowledges it. Then the second side sends its own FIN and receives an acknowledgement. A segment with the RST flag, for reset, ends a connection at once with no exchange.
These six are the classic flags. Two later ones, ECE and CWR, signal congestion on the network.
TCP numbers every byte it sends. The sequence number says where a segment's data belongs in the stream. The acknowledgement number tells the sender which byte the receiver expects next. A gap in the acknowledgements shows that something was lost, and the sender sends it again.
Starting sequence numbers are chosen to be hard to predict. If an outsider could guess them, forged segments could be slipped into someone else's connection.
The window is the amount of data the receiver is ready to accept. A busy receiver advertises a smaller window and the sender slows down. This is flow control.
An IP address brings a packet to the right computer. A port brings it to the right program on that computer. A port is a number from 0 to 65,535 carried in the transport header. TCP and UDP each have their own set of ports.
A program that offers a service listens on a known port: a web server on TCP port 443, for example. The program that calls it picks a spare high-numbered port for its own end, so that the reply can find its way back.
An IP address and a port together are a socket, written as 203.0.113.20:443. One TCP connection is a pair of sockets, one at each end, and that pair is what tells two conversations apart.
| Range | Name | Used for |
|---|---|---|
| 0 to 1,023 | Well-known, or system, ports | Standard services such as web, mail and name lookup |
| 1,024 to 49,151 | Registered, or user, ports | Particular products, by registration |
| 49,152 to 65,535 | Dynamic, private or | The temporary port a calling program picks for itself |
rules, scan reports and log entries name a service by its port number alone. These are the numbers met most often. Unless UDP is stated, the service uses TCP.
| Port | Service | What it does |
|---|---|---|
| 20, 21 and 990 | FTP and FTPS | File Transfer Protocol: 21 carries the commands and 20 the files. FTPS sends the commands on 990, with TLS, the encryption used for web pages |
| 22 | SSH | Secure Shell: encrypted remote login and file copy |
| 23 | Telnet | Remote login with nothing encrypted |
| 25, 465 and 587 | SMTP | Simple Mail Transfer Protocol: passes email between servers on 25. A user's mail program sends on 465, with TLS, or on 587 |
| 53 | DNS | Domain Name System: turns names into addresses. UDP for lookups, TCP for large transfers |
| 67 and 68 | DHCP | Dynamic Host Configuration Protocol: hands out addresses. UDP |
| 69 | TFTP | Trivial File Transfer Protocol: simple file copy with no login. UDP |
| 80 | HTTP | Web pages, not encrypted |
| 110 and 995 | POP3 and POP3S | Post Office Protocol: collects email from a server. POP3S on 995 adds TLS |
| 123 | NTP | Network Time Protocol: keeps clocks in step. UDP |
| 143 and 993 | IMAP and IMAPS | Internet Message Access Protocol: reads email kept on a server. IMAPS on 993 adds TLS |
| 443 | HTTPS | Web pages, encrypted |
| Port | Service | What it does |
|---|---|---|
| 49 | TACACS+ | Checks administrators who sign in to network devices |
| 88 | Kerberos | Sign-in service that issues tickets. TCP and UDP |
| 161 and 162 | SNMP | Simple Network Management Protocol: monitors devices. UDP |
| 389 | LDAP | Lightweight Directory Access Protocol: looks up people and devices in a directory |
| 445 | SMB | Server Message Block: Windows file sharing |
| 500 and 4500 | IKE | Internet Key Exchange: agrees the keys for IPsec, which encrypts packets. UDP |
| 514 | Syslog | Sends log messages to a central collector. UDP |
| 636 | LDAPS | LDAP, encrypted |
| 1433 | SQL Server | Microsoft's database service |
| 1701 and 1723 | L2TP and PPTP | Two older ways to make a private link across the internet: L2TP on UDP 1701, PPTP on TCP 1723 |
| 1812 and 1813 | RADIUS | Checks users who join a network and records their use. UDP |
| 3389 | RDP | Remote Desktop Protocol: a Windows screen shown over the network |
A regional council's firewall administrator proposes four changes to reduce exposure. The security manager must approve the list. Staff must still be able to browse the web. The council has no remote workers and no outside suppliers who sign in to its systems.
Which proposed change would MOST disrupt the council's work?
Answer: A. Blocking UDP port 53 outbound from the council's name server
Read a scan report for one web server and say what open, closed and filtered each prove about the port and about the path to it.
Loading the preview.
3 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.
These questions are drafts that no named reviewer has approved yet.
Question 1 of 3
A trainee analyst is reading a firewall log that names services only by TCP port. Match each port to the service that uses it.
Choose the match for each entry. Every match has to be right.
TCP is connection-oriented: it sets up a connection with a handshake, sends lost data again and delivers in the order sent. UDP is connectionless: it just sends, lost data stays lost and datagrams may arrive in any order. TCP is protocol 6 and UDP is protocol 17.
The client sends SYN with its starting sequence number. The server replies with SYN and ACK. The client sends ACK, and the connection is open. After the second step the server holds a half-open connection, with memory set aside for a caller who has not confirmed, which flooding attacks abuse.
FIN, for finish, means the sender has no more data and wishes to close. RST, for reset, ends the connection immediately, for example when no program is listening on the port. The window is the amount of data the receiver is ready to accept; a smaller window slows the sender, which is flow control.
A socket is an IP address and a port together, such as 203.0.113.20:443. Ports 0 to 1,023 are well-known, or system, ports. Ports 1,024 to 49,151 are registered, or user, ports. Ports 49,152 to 65,535 are dynamic, private or ephemeral ports.
Port 22 is SSH, encrypted remote login. Port 23 is Telnet, remote login with nothing encrypted. Port 53 is DNS. Port 389 is LDAP, and 636 is LDAPS. Port 445 is SMB, Windows file sharing. Port 3389 is RDP, the Remote Desktop Protocol.