All about ip address - A tutorial by Gaurav Kumar

                                       ehicalhackers@yahoo.com

 

BACK TO MAIN PAGE  ____________________________________________________________________________

Other tutorial by Gaurav Kumar-

NETBIOS BASED HACKING TUTORIAL

_____________________________________________________________________________

Preface

Dear reader, in the following page I will teach you about ip addresses. Understanding  ip address concepts is very important for any hacker or a computer networking professional. Please note that this tutorial is for beginners.

 

Contents-

What is an ip address

IP addressing  system

What is my ip address?

More about IP Addresses

A B and C Class networks

Getting ip address of other computers

Getting IP address of visitors of your site

 

The tutorial begins. . .

 

                                What is an ip address and uniqueness of ip addresses

Every computer has its own ip address. This address must be unique for a particular network. Let suppose there is a LAN ( Local Area Network ) . In a LAN we connect 2 or more computers together to make a network so that they can share one or more services. A typical example is the network of a school or of a cyber cafe where computers are connected to share hard disk and internet connection respectively. Now consider a computer on  a LAN. To communicate to other computers it must have a unique ip address. If two computers have the same ip address they both or one of them won't be able to work on network because  every computer on any network communicates with other computer using ip address and if two computers have the same ip address , other computers won't be able to figure out that to which of the two computers they have to communicate as both of them have the same ip address.

GO TO TOP

                                              IP addressing system

Every ip address is of the form abc.def.ghi.jkl

For example 192.168.1.160 is a valid ip address. There are four octets in an IP address. The maximum value that a octet can have is 255 and minimum is 0. In our example 192 is the first octet . 0 is the second one and so on. An ip address is a 32 bit address. Let me change this ip address to bit format . The bit format of the above ip address is

11000000 10101000 00000001 10100000

Now as I know the binary arithmetic I have transformed this ip address. If you don't know the binary arithmetic don't worry I will teach a simple way of doing this. Just start windows calculator by clicking on Start then clicking on Run.. and type calc and press the OK button . A new window will pop up that and that is a windows in built calculator. If you are running this for first time you will be shown Standard view . Switch to Scientific view by click on View on Menu bar and then selecting scientific .

To change the number 192 to bit format just type 192 and then select bin on the left half of the calculator. The calculator will display the bit format.

Now there are other formats like octal and hex but we need not go in details . Just remember that  ip address of  a computer remains same regardless of the format . So  connecting to a computer  having an ip address 192.168.1.160 is same as connecting to a computer having ip address C0.A8.1.A0 (in the octal format)

GO TO TOP

                                             What is my ip address?

Now  you understand that every computer has its own ip address regardless whether it is on a network or not . You must the thinking that if a computer is not on a network then why it will require an ip address and what is the ip address of this computer. IP address is required not only for communicating to other computers but also for one more reason . There are many softwares that require to test themselves whether your computer has capability to connect to internet so there is a 'built in' ip address known as Loop Back ip address that always refer to the computer you are working on. This ip address is 127.0.0.1

Now you want to know your ip address. If you are not working on a LAN you may use the inbuilt windows utility known as WINIPCFG . To run this program Click on Start and click on RUN...and type winipcfg and press OK .

You will be able to see your ip address in the utility . Please note that if you are not connected to internet you will see your ip address as 127.0.01 and is you are connected to internet you will see the ip address as provided by the ISP . The ip address provided by the ISPs generally change each time you connect.                                               

If you are working on a LAN you are having your own LAN ip. To find it out first find out your computer name . To do so right click on Network Neighborhood and click on properties and then click on Identification tab . Your computer name is shown there. Let suppose your computer name is COMPUTER1

Open command prompt by clicking on Start then moving to Programs and then clicking on  Command Prompt. You will get the command prompt as 

C:\windows>

To toggle to full screen mode and window mode please use the key combination ALT+ENTER

To exit command prompt type exit and hit enter key.

Just type in the command

C:\windows>tracert COMPUTER1

please change COMPUTER1 to the name you get in the identification tab of the properties of Network Neighborhood . You will get the result

Tracing route to COMPUTER1[192.168.0.1]
over a maximum of 30 hops:

1   <1 ms  <1 ms  <1 ms  [192.168.0.1]
Trace complete.

The numbers in the brackets 192.168.0.1 is your LAN ip. Your LAN ip may be different . Alternatively you can use winipcfg to view the ip address but the above method is a general method that can be used to get the ip address of any computer on a LAN

I have assumed that you are using windows 98 . If you are using Windows NT  the process will remain same except that command prompt may look some what different.

GO TO TOP

 

                                          MORE ABOUT IP ADDRESSES

Every ip address consists of two parts - a network address and a host address . All computers in a network have the same network address and while the host address is unique to the computer only .The network address can occupy one to three octets from the left while the rest are reserved for host . For example , the ip address 192.168.0.1 has the host address 1 and the network address as 192.168.0 . You may think that this network can support 256 hosts(0 to 255) but in reality it can support 254 hosts because 0 and 255 are reserved.

GO TO TOP

                                               A B and C Class networks

The number of octets reserved for the network address and the value of first octet determine the class to which the network belongs. The internet divides network into mainly three classes.

Class A address-

NOTE - N stands for network address and H for host address.

This address takes the form N.H.H.H . The N (network address is setup by NIC) and H by network administrator. If a US network is connected to the internet the network address has to be allotted by InterNIC - a body that distributes network addresses. N here takes values from 1 to 127. Columbia university has the value 15 . These address were allotted to very large organizations but are not longer assigned now.

Class B address-

It uses the first two octets as network address. Last two octets are used for host address. It can take values from 128 to 191. Many ISPs use this class.

Class C address-

Here the network address uses the first three octets and last one is used for host address. The first octet varies from 192 to 223. This class is used by small networks.

In short, we have

 

                             Class                                           Range

                                A                             0.0.0.0 to 127.255.255.255

                                B                             128.0.0.0 to 191.255.255.255

                                C                             192.0.0.0 to 223.255.255.255

                                D                             224.0.0.0 to 239.255.255.255

                                E                             240.0.0.0 to 247.255.255.255

GO TO TOP

                                        Getting ip address of other computers

You can easily get the ip address of websites. Lets us take an example.

Suppose you want to get the ip address of www.yahoo.com . To do so simply launch MS-DOS command prompt and type ping www.yahoo.com . You will get the following response.

C:\windows>ping www.yahoo.com

Pinging yahoo.com [216.115.108.245] with 32 bytes of data:

Request timed out.

Request timed out.

Request timed out.

Request timed out.

Here 216.115.108.245 is the ip address of www.yahoo.com

Similarly if you want to get the ip address of a computer named comp1 on  a LAN make sure that you are also on that LAN and then type ping comp1 at the command prompt and you will get the ip address of comp1.

Now let suppose you want to get the ip address of your friend's computer who is online. Here are the methods.

GO TO TOP

                                                 Using ICQ

Just ask your friend to join you on ICQ and start chatting with him , while you are chatting launch MS-DOS command prompt and type netstat -n and you will get the ip address of your friend. Please note that you should not use any other internet related software because that can add one more ip address in the output of netstat -n command. Here is a sample output

Active Connections

Proto     Local Address      Foreign Address           State
TCP     192.168.0.1:3537   203.195.136.156:2869   ESTABLISHED   

In this case 192.168.0.1 is your ip address and 203.195.136.156 is the ip address of your friend.

                                       Using MSN and YAHOO MESSENGERS

In case of these messengers direct connection is not established between the two persons who are chatting instead the messages are sent via Yahoo or MSN messenger servers. So if you use the netstat -n command you will not find the ip address of your friend but of Yahoo or MSN messenger servers. Lets play a trick. Just ask your friend that you are sending him some important file via SEND FILE option of your messenger. While the file is being transferred run command netstat -n and you will find that a new ip address is listed there. This is the ip address of your friend because in case if a file is transferred via SEND FILE option of messengers a direct connection is made between your computer and yours friend computer.

 

                                   GETTING IP ADDRESS OF VISITORS OF YOUR SITE

If you have a site , you may wish to record the ip address of the visitors who view your webpage. To do so you may include following script in the HTML code of your webpage

<HTML>

<BODY>

<SCRIPT>

 var ip = new java.net.InetAddress.getLocalHost();

 var ipStr = new java.lang.String(ip);

 document.writeln(ipStr.substring(ipStr.indexOf("/")+1));

 </SCRIPT>

</body>

</HTML>

END OF TUTORIAL

GO TO TOP

The above tutorial has been written by Gaurav Kumar. To contact me send me a mail to

                                            ethicalhackers@yahoo.com 

_____________________________________________________________________

Other tutorial by Gaurav Kumar-

NETBIOS BASED HACKING TUTORIAL  BY GAURAV KUMAR

_____________________________________________________________________