Skip to content

Linux Foundations / Follow traffic and find the fault ยท Step 5 of 46

Lesson: Application LayerSwitch
โ† Linux Foundations

Network operations

Application Layer

The protocols programs speak, from DNS and HTTP to SSH, and how to try them from the shell.

The application layer is where programs agree on what their messages mean. The layers below move the bytes. This layer says "give me this page" or "what is the address of this name?".

Common protocols

| Protocol | Purpose | Usual port | |---|---|---| | HTTP | web, unencrypted | TCP 80 | | HTTPS | web over TLS | TCP 443 | | SSH | secure remote login | TCP 22 | | DNS | name lookups | UDP and TCP 53 | | SMTP | sending mail between servers | TCP 25 |

These are conventions. A server can be configured to listen elsewhere. HTTP/3 runs over UDP.

DNS: names to addresses

People remember names, but IP delivers to addresses. DNS looks names up.

$ dig +short example.com
93.184.215.14

Your result may differ and may have several lines. dig is often in a package called dnsutils, bind9-dnsutils or bind-utils, depending on the distribution. To ask the way most programs on your system do, including the /etc/hosts file, use:

$ getent hosts localhost

Which source is consulted first is set in /etc/nsswitch.conf.

HTTP

HTTP is a request and response protocol. The client sends a method such as GET, a path and headers. The server replies with a status code.

$ curl -I https://example.com
HTTP/2 200
content-type: text/html

The output is shortened.

-I asks for headers only. Codes starting with 2 mean success, 3 redirection, 4 a problem with the request and 5 a server error. 404 means not found.

SSH

SSH gives you an encrypted shell on another machine:

On the first connection it shows the server's key fingerprint. Check it against a value you trust before accepting. A later warning that the key changed deserves investigation.

Try it

Look up a name with getent hosts, then request its headers with curl -I. Note the status code. Then list what is listening on your own machine:

$ ss -tln

This shows listening TCP sockets with numeric ports. Match any you recognise to the table above. The networking and SSH lab lets you practise safely.

Check your understanding

Application Layer

All 4 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.