Protocols
Various applications communicate using different protocols used in application layer:
Web Apps: HTTP, HTTPS
Mails: POP, SMTP, IMAP
DNS, FTP, SSH, etc.
Layer | Application Layer |
---|---|
Protocols | DNS, HTTP, FTP, SSH, .. |
Data Unit | Message |
IP Address
We learned previously that each server has an IP address.
- It is very difficult to memorize the IP address.
- Things get more complicated when, as users, we access various websites and services.
- It becomes quite a challenge when the addresses of those services are dynamic.
Accessing Websites
URL - Uniform Resource Locator
Every object (image, html document) has a unique path (URL) on the web server
Domain Name
Domain Registrars
Domain Name Registrars manage the reservation of internet domain names.
DNS: Domain Name System
DNS is a global and highly distributed network service.
DNS is a translation service .
- It resolves strings of letters into IP address.
IP Addresses of these servers may change, which will appropriately be updated.
DNS Server
There are five primary types of DNS servers:
Root Name Servers.
TLD Name Servers.
Authoritative Name Servers.
Caching Name Servers.
Recursive Name Servers.
Root Name Servers redirect to appropriate TLD Name Server.
TLD Name Server redirect to appropriate Authoritative Name Server for the domain.
Authoritative Name Server gives the appropriate IP for the domain.
Caching and Recursive Name Servers are provided by ISP. These reduce the load on the root, tld, authoritative name servers.
Root Server
- Any domain name registered in the DNS is a domain name.
- Domain names are organized in subordinate levels (subdomains) of the DNS root domain, which is nameless.
DNS Resolution
The first step is always to contact a root named server.
The root servers will respond to a local DNS server with the TLD name server that should be queried like (.in). For each TLD in existence, there is a TLD name server.
The TLD name servers will respond again to the Local DNS server with what authoritative DNS server(.ccbp.in) to contact.
The Local DNS server could be redirected at the authoritative server for ccbp.in which would finally provide the actual IP of the server in question.
Recursive & Caching Name Servers
- Recursive name servers are ones that perform full DNS resolution requests.
- Performs a fully recursive resolution to discover the correct IP for www.facebook.com. This involves a bunch of steps we'll cover in just a moment.
Since the domain name learning.ccbp.in had just been looked up, the local name server still has the IP that it resolved to stored and is able to deliver that back to your computer without having to perform a full lookup.
DNS
DNS uses UDP for the transport layer instead of TCP.
UDP is connectionless.
A single DNS request and its response can usually fit inside of a single UDP datagram.
DNS Record Types
DNS servers create a DNS record.
- It provides important information about a domain or hostname, particularly its current IP address.
- DNS record type allows for different kinds of DNS resolutions to take place.
Record Type | Abbreviation | Description |
---|---|---|
A | Address Mapping record | A record is used to point a certain domain name at a certain IPv4 IP address. |
AAAA | IP Version 6 Address record | A record is used to point a certain domain name at a certain IPv6 IP address. |
CNAME | Canonical Name record | A CNAME record is used to redirect traffic from one domain to another |
MX | Mail exchanger record | Mx record is used in order to deliver email to the correct server. |
NS | Name Server records | It allows you to delegate the DNS of one of your subdomains to a different nameserver. |
TXT | Text Record | Typically carries machine-readable data |
Web
Web is a "Client-Server Application".
A standard for document formats (HTML).
Web Browsers.
Web Servers.
Relies on HTTP, HTTPS application-layer protocols which rely on TCP.
Client-Server Architecture
- In a client-server architecture, there is an always-on host, called the server, which services requests from many other hosts, called clients.
A classic example is the “Web application” for which an always-on Web server services requests from browsers running on client hosts.
Web Servers
They host Web objects, each addressable by a URL.
A Web server is always ON, with a fixed IP address.
80 is default port used by a HTTP web server.
HTTP
Request & Response
The messages sent by the client usually a Web browser, are called requests.
The messages sent by the server as an answer are called responses.
Request
A HTTP request consists of a Request Header and a Request Body.
A Request Header contains various info like:
Host : (Example: developer.mozilla.org)
Method : (Example: GET).
Path : (Example: /).
HTTP version : (Example: HTTP/1.1).
HTTP Message Format - Request
HTTP Method
GET : retrieves data, like a blog article.
POST : creates data, like a new blog article.
PUT : replaces data, like an existing blog article.
DELETE : deletes data, like an existing blog article.
Response
HTTP Message Format - Response
HTTP Response Codes
A HTTP response of a Response Header and a Response Body.
A Response Header contains various info like:
Response Code : (1XX, 2XX, 3XX, 4XX, 5XX).
Content Type : (e.g.: text/html, image/png).
Content Length.
HyperText Transfer Protocol
Computer Networks
Transferring Data Over Network
- The header (and footer) and the data together form the Protocol Data Unit (PDU) for the next layer.
- The process continues until reaching the lowest-level layer (physical layer or network access layer), from which the data is transmitted to the receiving device.
- The receiving device reverses the process, de-encapsulating the data at each layer with the header and footer information directing the operations.
- Then the application finally uses the data.
- The process is continued until all data is transmitted and received.
HTTPS Protocol
HTTP Secure Protocol encrypts the data between the Browser and Server.
Protects the privacy and security of the users.
Protects the integrity of the website.
Uses 443 port by default.