{"id":22004,"date":"2025-12-03T12:47:28","date_gmt":"2025-12-03T07:47:28","guid":{"rendered":"https:\/\/afzalbadshah.com\/?p=22004"},"modified":"2025-12-03T12:47:30","modified_gmt":"2025-12-03T07:47:30","slug":"understanding-application-layer-protocols","status":"publish","type":"post","link":"https:\/\/afzalbadshah.com\/index.php\/2025\/12\/03\/understanding-application-layer-protocols\/","title":{"rendered":"Understanding Application Layer Protocols"},"content":{"rendered":"\n<p>The Application Layer sits at the very top of network architecture and provides the interface between human-facing applications (web browsers, mobile apps, email clients, file transfer tools) and the underlying network. A user never sees layers 2, 3, or 4 directly; instead, they interact with services like browsing a website, sending an email, accessing cloud storage, or opening an app. All these actions are possible only because <strong>Application Layer protocols define how data is formatted, requested, transferred, and displayed.<\/strong><\/p>\n\n\n\n<p>A formal definition is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"The Application Layer is the top layer of the TCP\/IP model responsible for providing network services directly to end users and applications, enabling communication such as web browsing, email transfer, file access, and name resolution.\"\n<\/code><\/pre>\n\n\n\n<p>Different applications require different rules. For example, a browser needs a protocol to fetch webpages (HTTP\/HTTPS); emails need their own structured communication (SMTP + MIME); name lookup requires DNS; file transfer needs FTP. This tutorial covers five foundational protocols a BS student must understand both theoretically and practically.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>DNS \u2013 Domain Name System<\/strong><\/h2>\n\n\n\n<p>Humans think in <em>names<\/em> (google.com), while machines communicate using <em>numeric IPs<\/em> (142.250.195.78). DNS bridges this gap. Without DNS, the Internet would feel like memorizing phone numbers for every contact.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"DNS is a distributed naming system that translates human-readable domain names into machine-understandable IP addresses.\"\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How DNS Works (Simple Real-Life Flow)<\/strong><\/h3>\n\n\n\n<p>When you open a website:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Your computer needs the IP of that domain.<\/li>\n\n\n\n<li>It asks a local DNS resolver.<\/li>\n\n\n\n<li>If not found, the resolver queries authoritative DNS servers.<\/li>\n\n\n\n<li>The IP is returned and cached.<\/li>\n\n\n\n<li>The browser connects to that IP.<\/li>\n<\/ol>\n\n\n\n<p>DNS uses different record types, each serving a specific purpose in the name\u2011to\u2011IP translation process. An overview of the most important record types is:<\/p>\n\n\n\n<p>A: maps a domain name to an IPv4 address.<br>AAAA: maps a domain name to an IPv6 address.<br>MX: identifies the mail server for the domain.<br>CNAME: creates an alias that points to another domain.<\/p>\n\n\n\n<p>In practice, these records simply help the resolver decide which information to return when a user requests a domain. When captured in Wireshark, these records appear inside DNS responses, typically transmitted over UDP on port 53.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Wireshark Hands-On: Observing DNS Traffic<\/strong><\/h3>\n\n\n\n<p><strong>Step 1:<\/strong> Start Wireshark \u2192 select your active interface.<br><strong>Step 2:<\/strong> Apply DNS filter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dns\n<\/code><\/pre>\n\n\n\n<p><strong>Step 3:<\/strong> Open any website, e.g., <a href=\"http:\/\/www.wikipedia.org\/\">www.wikipedia.org<\/a>.<br>You will see:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Standard DNS query<\/li>\n\n\n\n<li>Standard DNS response<\/li>\n\n\n\n<li>&#8220;A&#8221; or &#8220;AAAA&#8221; records<\/li>\n<\/ul>\n\n\n\n<p>In the packet details, observe:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Query name<\/li>\n\n\n\n<li>Response IP<\/li>\n\n\n\n<li>Time taken<\/li>\n\n\n\n<li>Whether recursion was requested<\/li>\n<\/ul>\n\n\n\n<p>This confirms how DNS converts names to addresses.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>HTTP and HTTPS \u2013 Web Access Protocols<\/strong><\/h2>\n\n\n\n<p>Every time you open a webpage, watch YouTube, search Google, or use any web app, you are using HTTP\/HTTPS.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"HTTP is a stateless, request\u2013response protocol used for transferring web resources between a client and a web server.\"\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\"HTTPS is the secure version of HTTP that uses TLS\/SSL encryption to protect the confidentiality and integrity of data.\"\n<\/code><\/pre>\n\n\n\n<p>HTTP is like sending a request letter to a shopkeeper; HTTPS is the same but inside a locked envelope.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How HTTP Works<\/strong><\/h3>\n\n\n\n<p>When you type a URL:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Browser sends an HTTP request to the server.<\/li>\n\n\n\n<li>Server responds with an HTTP response.<\/li>\n\n\n\n<li>Browser renders the webpage.<\/li>\n<\/ol>\n\n\n\n<p>A request has:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Request line \u2192 e.g., <code>GET \/index.html HTTP\/1.1<\/code><\/li>\n\n\n\n<li>Headers \u2192 host, user-agent, cookies<\/li>\n\n\n\n<li>Optional body \u2192 used in POST forms<\/li>\n<\/ul>\n\n\n\n<p>HTTPS works exactly the same but encrypted.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Wireshark Hands-On: Observing HTTP\/HTTPS<\/strong><\/h3>\n\n\n\n<p>For HTTP:<br>Use filter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http\n<\/code><\/pre>\n\n\n\n<p>Visit a non-HTTPS site such as <a href=\"http:\/\/neverssl.com\/\">http:\/\/neverssl.com<\/a>.<br>Observe:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>GET request<\/li>\n\n\n\n<li>Response code (200 OK, 404 Not Found)<\/li>\n\n\n\n<li>Headers<\/li>\n\n\n\n<li>Content-Type<\/li>\n<\/ul>\n\n\n\n<p>For HTTPS:<br>Use filter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tls\n<\/code><\/pre>\n\n\n\n<p>You will not see the actual message content because it is encrypted, but you will observe:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>TLS handshake<\/li>\n\n\n\n<li>Certificate exchange<\/li>\n\n\n\n<li>Encrypted application data<\/li>\n<\/ul>\n\n\n\n<p>This clearly shows the difference between HTTP (visible) and HTTPS (encrypted).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>SMTP \u2013 Sending Emails<\/strong><\/h2>\n\n\n\n<p>Email communication uses SMTP. When you click \u201cSend,\u201d your mail server transfers your message to the recipient\u2019s server using SMTP. It is a reliable, store-and-forward mechanism.<\/p>\n\n\n\n<p>A precise definition:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"SMTP is a protocol used to transfer outgoing email messages from a client to a mail server and between mail servers.\"\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How SMTP Works<\/strong><\/h3>\n\n\n\n<p>A simplified flow:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>SMTP client connects to SMTP server (port 25).<\/li>\n\n\n\n<li>Server greets with <code>220<\/code>.<\/li>\n\n\n\n<li>Client sends:\n<ul class=\"wp-block-list\">\n<li>HELO<\/li>\n\n\n\n<li>MAIL FROM:<\/li>\n\n\n\n<li>RCPT TO:<\/li>\n\n\n\n<li>DATA<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Server accepts the message.<\/li>\n\n\n\n<li>Server forwards it to the recipient&#8217;s mail server.<\/li>\n<\/ol>\n\n\n\n<p>SMTP handles sending only. Receiving is handled by POP3\/IMAP.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Wireshark Hands-On: Observing SMTP<\/strong><\/h3>\n\n\n\n<p>Use an email client like Thunderbird.<\/p>\n\n\n\n<p><strong>Step 1:<\/strong> Start Wireshark and filter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>smtp\n<\/code><\/pre>\n\n\n\n<p><strong>Step 2:<\/strong> Send a test email.<\/p>\n\n\n\n<p>You will see:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>HELO \/ EHLO<\/li>\n\n\n\n<li>MAIL FROM<\/li>\n\n\n\n<li>RCPT TO<\/li>\n\n\n\n<li>DATA<\/li>\n\n\n\n<li>Message body<\/li>\n<\/ul>\n\n\n\n<p>This shows the full email conversation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>FTP \u2013 File Transfer Protocol<\/strong><\/h2>\n\n\n\n<p>FTP was designed to move files between computers. Although old, it is still used in hosting panels and legacy systems.<\/p>\n\n\n\n<p>Definition:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"FTP is a protocol that enables file upload and download using separate control and data connections.\"\n<\/code><\/pre>\n\n\n\n<p>It uses two channels:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Control Channel \u2192 Commands (port 21)<\/li>\n\n\n\n<li>Data Channel \u2192 File transfer (port 20)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How FTP Works<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Client connects to server on port 21.<\/li>\n\n\n\n<li>User logs in.<\/li>\n\n\n\n<li>Client sends file transfer commands.<\/li>\n\n\n\n<li>Server opens data channel and transfers file.<\/li>\n<\/ol>\n\n\n\n<p>FTP has two modes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Active mode \u2013 server initiates data connection.<\/li>\n\n\n\n<li>Passive mode \u2013 client initiates connection.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Wireshark Hands-On: Observing FTP<\/strong><\/h3>\n\n\n\n<p><strong>Step 1:<\/strong> Use FileZilla Client or a public FTP server.<br><strong>Step 2:<\/strong> Start Wireshark \u2192 filter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ftp\n<\/code><\/pre>\n\n\n\n<p><strong>Step 3:<\/strong> Log in and download a small file.<\/p>\n\n\n\n<p>You will observe:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>USER and PASS commands<\/li>\n\n\n\n<li>Control messages<\/li>\n\n\n\n<li>Data channel establishment<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>MIME \u2013 Enabling Attachments in Emails<\/strong><\/h2>\n\n\n\n<p>SMTP alone could not send images, PDFs, or audio. MIME extends SMTP to handle multimedia.<\/p>\n\n\n\n<p>Definition:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"MIME is an extension of email protocols that allows transmission of text, images, audio, video, and attachments using standardized encoding formats.\"\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How MIME Works<\/strong><\/h3>\n\n\n\n<p>Inside an email message, MIME:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Defines content type<\/li>\n\n\n\n<li>Divides messages into parts using boundaries<\/li>\n\n\n\n<li>Encodes attachments using Base64<\/li>\n<\/ul>\n\n\n\n<p>A simple MIME snippet:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Content-Type: multipart\/mixed; boundary=\"XYZ123\"\n--XYZ123\nContent-Type: text\/plain\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The Application Layer sits at the very top of network architecture and provides the interface between human-facing applications (web browsers, mobile apps, email clients, file transfer tools) and the underlying network. A user never sees layers 2, 3, or 4 directly; instead, they interact with services like browsing a website, sending an email, accessing cloud storage, or opening an app. All these actions are possible only because Application Layer protocols define how data is formatted, requested, transferred, and displayed. A&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/afzalbadshah.com\/index.php\/2025\/12\/03\/understanding-application-layer-protocols\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":22008,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[352],"tags":[735,737],"class_list":["post-22004","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-computer-networks-courses-2","tag-application-layer","tag-wireshark"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/afzalbadshah.com\/wp-content\/uploads\/2025\/12\/Basics-of-IP-and-Addressing.jpg?fit=1920%2C1080&ssl=1","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pf3emP-5IU","jetpack-related-posts":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/posts\/22004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/comments?post=22004"}],"version-history":[{"count":1,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/posts\/22004\/revisions"}],"predecessor-version":[{"id":22010,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/posts\/22004\/revisions\/22010"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/media\/22008"}],"wp:attachment":[{"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/media?parent=22004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/categories?post=22004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afzalbadshah.com\/index.php\/wp-json\/wp\/v2\/tags?post=22004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}