Wednesday, 24 May 2017

Loopback addressing

 


If you remember from the first tutorial we discussed the reservation of two networks for loop-back addressing and what is my IP? If not check it out here.
Let us first talk about what is my IP?

What is my IP (0.0.0.0)?


Whenever we have nodes which don't have a secondary memory such nodes work only on volatile memory (Data gets lost whenever the system is turned off). These types of nodes whenever wants to connect to internet contacts the RARP server for temporary IP.

It forms a packet with the following specification:
Source MAC: - MAC address of the system.
Source IP :- 0.0.0.0
Destination MAC :- FF:FF:FF:FF:FF:FF (This shows that its a broadcast message).
Destination IP:- 255.255.255.255

When this packet travels in the network it is forwarded to all the nodes until it hits a router. The router looks into the destination MAC and finds out that it's a broadcasting packet at data link layer and it should not be forwarded (Yes you got it right broadcasting packets at data link layer are not forwarded by the router).

When the packet reaches the RARP server, the server makes an unicast packet. This packet includes the IP address that is to be assigned to the node. The packet is finally forwarded to the node. When the packet reaches the node unwraps the packet and extracts the IP address from it and uses it till the leased time (time for which the IP is assigned to node).

This is one of the biggest drawbacks of Ipv4 where the entire network is given for a small task. This is overcome by the introduction of Ipv6, where only one IP is assigned for this task and loopback address.

Loopback address


You might have seen the above picture in many places. Let's now understand what they mean when they say there is no place like 127.0.0.1
The entire set of IP addresses that falls in (127.0.0.1 to 127.255.255.254)  are called loopback addresses (Remember the IP’s 127.0.0.0 and 127.255.255.255 are not included in loopback addresses, because they are used for Limited broadcast address and Directed broadcast address). These addresses are used for many things, some of which are:

  • Client server testing.
  • To check self-connectivity.
  • NIC debugging.

When we create a website it’s very obvious that we need a client and a server. If we want to test our code for client and server we can run the client and server code in the same computer with different port addresses and later ping our server. If we get a reply from the server it means the server is working properly. Following are the content of the packet which is sent from client to server and vice versa.

Packet sent from client side:

Dummy msg
Src port: 8080
Dest port: 80
Src IP: 192.168.100.31
Dest IP: 127.0.0.1

Packet sent from server side:

Dummy msg
Src port: 80
Dest port: 8080
SrcIP:192.168.100.31
Dest IP: 127.0.0.1

The Loopback addresses can also be used to check the proper functioning of the NIC. To do that we need to open the command prompt and type the following command: Ping 127.0.0.1
If you see the following output it means the NIC is working properly.

Capture1.PNG

When you ping yourself the packet goes only till the data link and returns back. If the NIC is working properly then only the packet returns back. If you get request timed out it means that your NIC has some fault.
Hope this was helpful. Leave your questions, answers and suggestions in the comment section below. And make sure to like us on Facebook and follow on Google+.

Thank you!