Skip to main content

Localhost

 Q)Why 127.0.0.1 is known as localhost and why it is common for every system?

-> This address is also known as the Loopback address, which means any request sent to this address is again sent back to the same machine.

-> Here internal communication will be happening, so that no internet is required.

-> We can test our application so safely without connecting to the internet, which helps us to create a controlled environment for the application to interact without affecting the outside world.


A possible question may arise?

Q) But every device will have a unique IP address know? Then how 127.0.0.1 is a localhost to every system?

->The range of IP addresses from 127.0.0.0 to 127.255.255.255 are specially reserved for loopback addresses by the Central Internet Authority  (IANA - Internet Assigned Numbers Authority)

-> When we use the external communication(i.e., connecting to the internet to access the resources over the network), we require a unique IP address for accessing those resources.

-> Whereas in Internal communication you don't need any unique IP address as you are not communicating over the internet, the request returns to the same machine itself.

-> Localhost facilitates internal communication for the device itself.

-> Technically any address in this range could be used for loopback, by convention, almost all operating systems and applications rely on 127.0.0.1 for loopback functionality majorly.


A possible question may arise?

Q) So can I use 127.0.0.2 as my localhost address?

 Yes, we can use this as our localhost address, but:

-> 127.0.0.1 is the universally accepted standard loopback address across all operating systems and applications.

-> Raises unnecessary conflicts, there is no real benefit of using other IP addresses than 127.0.0.1, sticking with the standard one simplifies configurations and avoids potential confusion.


A possible question may arise?

Q) If widely used is 127.0.0.1 then why to reserve the IP address up to 127.255.255.255?

-> Reserving the whole block prevents accidental assignment of these addresses for external purposes.

-> Having them all reserved ensures they won't be mistakenly used for internet communication, which could lead to unexpected behavior.

-> While creating the protocol in the past, they had no clarity on how many IP addresses to assign as loopback addresses, so that's why for future-proofing they have registered from 127.0.0.0 to 127.255.255.255 



Feel free to Comment and Thank you for reading my blog :)


Comments

Popular posts from this blog

How web applications loads?

Ever imagined how a webpage is loading when we just enter that site name. Here I am gonna tell you how that works actually. Let's take an example website say 'www.abcd.com' , here "abcd" is called the domain name.  We will be having a system called 'Domain name System' which helps to translate domain names to IP addresses. So, first, when we type a website in our browser, our browser sends the request to the DNS server, and the DNS server gives the IP address of that website to our browser, now that IP address points to the respective server and gathers all required files for website loading and again it gives to the browser and at last, the browser will display us the webpage. In the above picture as we can see a website name 'www.abcd.com'. The following steps were done to load the webpage. User searches for 'www.abcd.com' in the web browser. The browser sends the website name to the 'DNS server' and requests it to give the IP add...

How DNS server works internally?

  DNS-Domain Name System is a system that translates website names to IP addresses.   As you can see in the above picture we have taken a website "www.rahulsai.com" so now the following steps will describe how DNS works internally. 1. We will enter a website in our web browser, here we took "www.rahulsai.com" 2. Now this website will go to the ISP(Internet Service Provider) from ISP it will go to the DNS resolver. Here the resolver will be operated by the ISP. So now this will start looking at the website name in its local cache if it is found then it will return to the web browser. 3. If the website is not found in the local cache then the resolver sends the request to the "ROOT SERVER". The root server will be checking the TLD(Top Level Domain) of the website. Note1: There are a total of 13 root servers across the globe. Note2: TLD-Top level Domain are .com, .dev, .org, etc which come after the domain name and are known as TLD. For ex: www....

Working of VPN

VPN also known as a Virtual Private Network, this is used to establish a secure connection over the internet. By using the VPN we can surf over the web anonymously and our data will travel in encrypted form so that our data is not intercepted by other people. Why we use a VPN? Let us consider a situation, you are somewhere in a public place and you are connected to public Wi-Fi, Imagine you are entering a website and you want to enter sensitive data like your username and password, If any hacker connected to that public Wi-Fi then he can intercept all data what you are entering since you and the hacker are connected to the same Wi-Fi. So here if we use a VPN, our connection becomes private and the hacker will not be able to get our data since it will be in the encrypted form. How does a VPN work? Usually, the working flow of connecting to a web application is: In the browser we will enter the domain name --- Using the DNS this domain name converts into an IP address --- It goes to ISP ...