How Telnet works

The Network Virtual Terminal

Use the Network Virtual Terminal model to understand how different local terminals exchange characters and control functions.

Telnet had a hard problem to solve. In the 1970s, every vendor’s terminal behaved differently. Different character sets, different line endings, different control keys. Connecting any terminal to any host would have needed a translator for every pair of devices.

Telnet’s answer is an imaginary terminal called the Network Virtual Terminal, or NVT. Neither side has to understand the other’s hardware. Each side translates between its own terminal and this shared network representation.

So the client does not need to know anything about the server’s terminal, and the server does not need to know anything about the client’s device. Each machine does two translations: local to NVT on the way out, NVT to local on the way in.

This is the same trick as an intermediate representation in a compiler, or a common data format between services. Agree on one middle format and you need one translator per device instead of one per pair.

What the base NVT looks like

The base NVT uses seven-bit US-ASCII values inside eight-bit bytes. A carriage return followed by a line feed means “new line”. A carriage return that should not move to a new line is followed by a zero byte:

new line:        CR LF     (bytes 13 10)
carriage return: CR NUL    (bytes 13 0)

The CR NUL form looks odd today. It existed for printers, where “go back to column one without advancing the paper” was a real operation. The rule that matters: on an NVT connection, a bare CR is never sent alone. It is always followed by LF or NUL.

You will see this in practice in the lab module. When you type hello into the lab server, it logs 68656c6c6f0d0a. The 0d0a at the end is the NVT new line: CR LF, bytes 13 and 10 written in hexadecimal.

The NVT also defines a small set of control functions, like interrupting a process or erasing a character. Those travel as IAC commands, which the next module covers in detail.

The starting point, not the ceiling

Options negotiated later can agree on richer behavior: eight-bit data, terminal types, window sizes. The plain NVT is where every connection starts, before either side assumes any of that.

This default is what makes Telnet hard to break. Two implementations that share nothing else can still talk, because both are required to speak plain NVT until negotiation says otherwise. If negotiation fails, you lose the extras. You do not lose the session.

Lesson completed