Interviewing "Internet"
Tags: internet, dns, ipaddress, ipv4
Published: 2020-07-26 15:39:43

###What is Internet ? 

In Simple words, Networks of Networks ([Computer Networks]) forms a Internetwork which is nothing but Internet 

- - -

###What are Computer networks ? 

A part of Computer network is in-fact the device which you are reading on – Your Personal device (*laptop, desktop or a mobile*).  

Your Laptop/Desktop would be connected to WIFI router or a Modem through Ethernet cable. 

In case you are on a Mobile device, wireless signals are exchanged with a Mobile data transceiver. 

> Data would then hop across various Intermediary Servers through Networking Hardware(Fibre Optics) and WIFI to  Internet Service Providers (ISP's) and Domain Name Systems (DNS), Root/TLD(Top Level Domain)/Authoritative Servers to fetch from the server where the website is hosted, packet the response back, route through Inter-networks and serve requested content to the user. 

> Bunch of hybrid, heterogenous and autonomous  devices connected together forms a Computer Network 

- - -

###What's DNS ? 

Simply put, it’s a Phonebook for internet. A DNS Server maps  Internet-connected-Device's name (Domain Name) its corresponding Address (IP Address).

There are wide variety of DNS Servers each having a specific task to perform.  

1. Internet Service Provider (DNS Resolver) takes a web request from a User's machine, looks up its Cache to check if they can resolve it into a IP Address.

2. If the given Domain Name(www.google.com) was never request/cached before in an ISP/DNS Resolver, the Resolver checks with a Root Server. 

3. Root Servers checks the the extension(.com, .net etc) and provides respective TLD server's details back to Resolver.

3. Resolver checks with respective TLD server(.COM server or .GOV server) which gets the IP address from Administrative Server and returns the same back to the End User's Machine (Host who requested)

4. Using the Domain's IP Address, the End User's Machine will receive the requested Resource/Website (in Chunks/Packets). Packets, further gets sequenced and gets displayed on to a web browser or receiving module on End User's machine.

- - -

###What's Internet Protocol and IP Address ? 

Let's take an example where when a person needs to communicate with others we call one another by our Names (Example: Angela/Mathew). But... would a name suffice; to uniquely identify and contact an individual when they are not nearby ? Probably not ! When one needs to contact/communicate, let's say to communicate with Angela, we need something more specific or a Unique Identifier like a Telephone/Mobile Number or a Mailing Address to locate her amongst others ( Or Probably Other Angela's :-) )

> **Internet Protocol(IP)** is a standardised set of rules and guidelines which allows devices to send and receive data over internet. The protocol defines of rules, syntax, handshakes and error handling/recovery methods. IP enables a host to  send packets of Data to a Destination wrapping the IP Address of the Destination System. 

> **IP Address** is a bunch of numbers which is allocated to each device that’s connected to a Computer Network.  The allocation of these IP addresses are managed by **IANA** (Internet Assigned Numbers Authority) - Part of **ICANN** (Internet Corporation for Assigned Names and Numbers). 

There are two flavours to represent a host's IP Address –  
* IP version 4 (IPv4)
* IP version 6 (IPv6)

- - -

###What's IPv4 ? 

> **IPv4** is 4th generation or version of Internet Protocol. In its simplicity and human readable form; it forms the backbone of "standardised protocol methods" used to communicate across devices in Internet.  

An Address comprises of 32 Bits to represent a host. These 32 bits are divided further into 8 bits with a dot between every 8 bits 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/z6vg36pail9jhwi3thq7.jpg)

Hence there are 4 Octets in an IPv4 Address. 
Each Octet range from a  
* Minimum value of 0 (where every bit is 0) 
* Maximum value of 255 (where all 8 bits have a value of 1). 

```
IPv4 Range : 0.0.0.0 ==> 255.255.255.255 
```

_Example:_  
```
11000000.00101010.00000001.10000000 {Binary} 
192.42.1.128 {Decimal} 
```

Though a Machine reads an IP Address in Binary always, For simplicity we convert this into Decimal most of the times. With each bit occupying 0 or 1, 
> The total number of IP Addresses that are possible 
> = 2^32 
> = 47 Billion Addresses

- - -

###What's IPv6 and why do we need it ? 

_"We are indeed running out of IPv4 Addresses"_  
With ever growing demand for IP addresses and organisations reserving more than what they actually need, Address space of IPv4 will run out soon. 
Adding to this, Classification of IP addresses and the way Networks and Hosts are allocated within each class; further, allocates these Networks and _thereby IP addresses_ to Organisations which goes unutilised. 

**Hence IPv6 was Born.**

> IPv6 (Internet Protocol Version 6), in comparison with IPv4 is an Enlarged Address space which stores and identifies an IP Address of a Machine in 128 bits instead of Standard 32 bits with IPv4. The Addresses are Denoted in HexaDecimal. 

_Example:_

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kneo5jba0dwnvib4osuq.jpg)
 

> With each bit occupying 0 or 1, the total number of IP > Addresses that are possible 
> = 2^128 
> = 340 trillion-trillion-trillion Addresses !!! ( Isn't that a crazy Number !)

And yes, Thats right, One of the reasons why we need IPv6 and it's infact gaining momentum and legacy systems are trying to comply to IPv6 by upgrading their kernel/machines.  

- - -

###Who owns and manages Internet ? 

Internet is not governed or managed by any organisation. 

But rather is amalgamation of smaller computer networks. These Autonomous networks, owned by ISP's and Government Organisations are inter-connected (LAN Or WAN) with the help of Wired Ethernet cables or WiFi or Fibre Optics.  

 - - -

###Connected systems being Autonomous, who sets the standards ? 

There are certain guiding principles or protocols that these Autonomous organisations follow in order for peering systems to exchange data over Internet 

> IETF created Internet Standards and they ensure connected devices function without any data exchange/compatibility issues 

> ICANN/IANA manages the task of registering and mapping domain names with IP Addresses 

 - - -

###How to fetch my IP Address ? 

Command to get IPv4 Address of a machine -

> Mac Terminal Command: `ifconfig | grep inet`
```
MacBook-Pro:~ Device$ ifconfig | grep "inet " 
inet 127.0.0.1 netmask 0xff000000  
inet <MyDeviceIP> netmask 0xffffff00 broadcast <NetworkBroadCastIP> 
```
 
MyDeviceIP - is the IP Address of your Machine
127.0.0.1 - This is called localhost !! Used by OS to communicate to itself - Also called Loopback Address

> Windows Command Prompt: `ipconfig (check for Ipv4)`

- - -

###How to get IP Address of a website ? 

One can get a IP Address by pinging the respective Domain as shown below

> Mac/Windows Terminal Command: `ping google.com` 
```
MacBook-Pro:~ Device$ ping google.com 
PING google.com (216.58.203.142): 56 data bytes 
64 bytes from 216.58.203.142: icmp_seq=0 ttl=118 time=26.165 ms  
```
_Note that the IP Address of certain web servers keep changing as they keep adding new servers to handle the load._

At the point in time (when this blog was created) the IPv4 Address of google.com from the machine is 216.58.203.142