Sunday, January 10, 2016

Playing with IP Addresses- Part 1

All the devices connected to the internet are assigned a unique identification number called the IP-Address, where IP stands for the Internet Protocol. Although there have been several versions of the Internet Protocol, only two of them IPv4 (version 4) and IPv6(version 6) are popular.

The IP addresses can be static or dynamically assigned. 


Static IP is one that remains the same, every time the device connects to the internet. Generally, a static IP address is used by servers, that ought to maintain the same IP addresses. Static IP addresses are leased by the Internet Service Providers(ISPs). 

Dynamic IP address, on the other hand, may or may not remain the same. Dynamic IP addresses are most common, and generally used by clients, like you and me, to connect to the internet. Under most of the circumstances, clients do not require a static IP address. 

To check one's own IP address one can use the 'ipconfig' utility. Here's how to do it:
  1.  Open the terminal. On a Windows PC, this can be done be searching for 'cmd', or typing 'cmd' in the 'Run' window and pressing Enter.
  2. Type 'ipconfig'(without quotes) and press enter. This will display some information about the current network card. In order to obtain info about all the network interface cards, use:

    ipconfig /all


PING

To get the IP address of a server, 'ping' utility is used. 'ping' stands for Packet Internet Groper.
When you 'ping' a server, certain packets are sent to it. In most of the cases, if the server is up and running correctly, it acknowledges the packets received, and we receive a response.

This is used to know if a server is operating, and if one is able to establish a connection with the server.

To 'ping' a server, open the terminal(steps mentioned before) and enter 'ping <server domain name or IP Address>'
For example, to ping a server having IP address 4.2.2.2, the following command is written in the command prompt:

 ping 4.2.2.2  
This sends 4 packets to the server and waits for a few milliseconds to receive a reply from the server.
In the above screenshot, as I am receiving a reply from 4.2.2.2, this means that I can successfully establish a connection to 4.2.2.2. 

In case of failure, one gets other messages such as 'Request timed out', or a reply from some other IP address (Destination host unreachable), indicating that a connection could not be established successfully to the destined server. 


Note that, we can also provide a domain name directly instead of an IP address. This means that instead of writing ping 4.2.2.2, we can write ping google.com

 ping google.com  

You might have observed that every time, only four packets are sent, and a reply or a reply timed out is computed only for these 4 packets. 

To send packets continuously, not restricted to 4, we use the /t option in  the ping command.

 ping 4.2.2.2 /t  
This would send out packets continuously until Control-C is pressed.

Are there any other options available other than /t ? Sure there are many. To get a list of all these options with a brief description about all of these, one can use /? with the command.
 ping /?  

No comments:

Post a Comment