How does modern computer networking work?

Application Layer

Protocols Used in Application Layer are:

1. Hyper Text Transfer Protocol(HTTP):

This is a basis for data communication in the internet. The data communication starts with a request sent from a client and ends with the response received from a web server.

Various Methods used are:

  1. GET Method: Requests a representation of the specified resource. Requests using GET should only retrieve data.
  2. HEAD Method: Asks for a response identical to that of a GET request, but without the response body.
  3. POST Method: Used to submit an entity to the specified resource, often causing a change in state or side effects on the server.
  4. PUT Method: Replaces all current representations of the target resource with the request payload.

HTTP Request:

A simple request message from a client computer consists of the following components:

  1. A request line to get a required resource. It contains Method, Path and HTTP version.
  2. Headers. They contain name value pairs.
  3. An empty line.
  4. A message body which is optional. Contains extra information to be delivered to the server.

HTTP Response:

A simple response from the server contains the following components:

  1. HTTP Status Code. It contains HTTP version, Status code and Response
  2. Headers. They contain name value pairs.
  3. An empty line.
  4. A message body which is optional. Contains extra information to be delivered to the host.

Types of Status Code: For example 404 or 502 error code,

  1. 1XX: Information regarding message
  2. 2XX: Information regarding success
  3. 3XX: Information regarding Re directional
  4. 4XX: Information regarding Client
  5. 5XX: Information regarding Server

HTTPS OVER HTTP ?

HTTPS is the secured HTTP protocol required to send and receive information securely over internet. Nowadays it is mandatory for all websites to have HTTPS protocol to have secured internet.

Besides the security and encryption, the communication structure of HTTPS protocol remains same as HTTP protocol as explained above.

2.Domain Name System(DNS):

It’s like a global phone book of the internet which contains numeric addresses instead of alphabetic addresses. DNS is a protocol used for exchanging information on the internet, using domain names as the upper layer to match to IP address as the layer beneath it.

End users access information using domain names, not IP addresses, for example, you are searching for my blog, now instead of remembering the site’s IP address number, you just have to remember the site’s name to connect and access information from it.

There are 4 DNS servers involved in loading a webpage:

  1. DNS recursor A server designed to receive queries from client machines through applications such as web browsers and resolve these queries. Caching is a data persistence process that helps short-circuit the necessary requests by serving the requested resource record earlier in the DNS lookup.
    1. The recursor can be thought of as a librarian who is asked to go find a particular book somewhere in a library.
  2. Root nameserver – The root server is the first step in translating human readable host names into IP addresses.
    1. It can be thought of like an index in a library that points to different racks of books – typically it serves as a reference to other more specific locations.
  3. TLD nameserver – The top level domain server (TLD) is the next step in the search for a specific IP address, and it hosts the last portion of a host name, for example .in or .com.
    1. It can be thought of as a specific rack of books in a library.
  4. Authoritative nameserver – The authoritative nameserver is the last stop in the nameserver query. If the authoritative name server has access to the requested record, it will return the IP address for the requested host name back to the DNS Recursor that made the initial request.
    1. It can be thought of as a dictionary on a rack of books, in which a specific name can be translated into its definition.

What is a DNS resolver?

The DNS resolver is the first stop in the DNS lookup, and it is responsible for dealing with the client that made the initial request. The resolver starts the sequence of queries that ultimately leads to a URL being translated into the necessary IP address.

DNS Query and Response:

The DNS messages are sent over UDP( smaller than 512 bytes for common requests and responses) or TCP. 

  1. Question Section:This is a section consisting of one or more question records. It is present on both query and response messages.
  2. Answer Section: This is a section consisting of one or more resource records. It is present only on response messages. This section includes the answer from the server to the client (resolver).
  3. Authoritative Section: This is a section consisting of one or more resource records. It is present only on response messages. This section gives information (domain name) about one or more authoritative servers for the query.
  4. Additional Information Section: This is a section consisting of one or more resource records. It is present only on response messages. This section provides additional information that may help the resolver.

Information about flags in header:

  1. QR (query/response): This is a 1-bit subfield that defines the type of message. If it is 0, the message is a query. If it is 1, the message is a response.
  2. OpCode: This is a 4-bit subfield that defines the type of query or response (0 if standard, 1 if inverse, and 2 if a server status request).
  3. AA (authoritative answer): This is a 1-bit subfield. When it is set (value of 1)it means that the name server is an authoritative server. It is used only in a response message.
  4. TC (truncated): This is a 1-bit subfield. When it is set (value of 1), it means that the response was more than 512 bytes and truncated to 512.
  5. RD (recursion desired): This is a 1-bit subfield. When it is set (value of 1) it means the client desires a recursive answer.
  6. RA (recursion available): This is a 1-bit subfield. When it is set in the response, it means that a recursive response is available.
  7. Reserved: This is a 3-bit subfield set to 000.
  8. RCode: This is a 4-bit field that shows the status of the error in the response.

3.Email Protocols:

When ever we are sending mail from Bob to Alice, the protocol followed will be,

  1. Bob will send the email to his mail server using SMTP.
  2. Bob’s server is going to check if Alice also has the same mail server.
    1. If they have same mail server then mail server will allow Alice to pull mail directly from it. An example for Inter organization mail communication.
    2. If they have different Mail server then, Bob’s mail server will send the mail to Alice’s mail server and then Alice will be able to pull her mail from her mail server.

Q.What do you mean by a Port and a Socket?

  1. Port: Just as the IP address identifies the computer, The network port identifies the application or service running on the computer.
    1. A port number uses 16 bits and so can therefore have a value from 0 to 65535 decimal
  2. Socket: A connection between two computers uses a socket. It is a tuple of IP address and Port.
  1. Host A has an application running on port 7, It creates a socket or an endpoint to send /receive information.
  2. Host B also has an application running on port 81, It creates a socket or an endpoint to send/ receive information.
  3. Host A and B can communicate over internet/network using their respective sockets.
For more information on Sockets and ports,
  1. http://www.steves-internet-guide.com/tcpip-ports-sockets/
  2. For code on Socket programming in java and python

One thought on “How does modern computer networking work?

Leave a comment