HacksLand | The computer science playground

Posted by Thilan Dissanayaka on Aug 12, 2019
In this tutorial I'm going to cover an important topic in networking. Yes it's internet protocol. Internet and every other networks are built on some rules. We cal them network protocols. When developing a network what do you expect? The primary goal is to communicate with other devices those are connected to the network. So there should be a way to identify each device. If not how we can send data to a device?. Think about following example. There are 6 computers and all of these are in a one small network. Now computer A wants send some data to computer B . So sender want to include the name of receiver in data if not this data packet cannot be delivered to destination. Now when receiver getting the data he also want to know from where he receiving this data. So the name of sender also included in data packet. Now there are couple of things to notice. First the name of computer must be unique. If there are hundred PCs there should be hundred names. Second thing is this name should be short and easily presentable. Take the words computer A and computer B. Both of them are long 10 characters. That means we should allocate 10 bytes (80 bits) for that. If the name is more longer size of that also go higher. So different names get different lengths and sizes. That is not nice. The solution to this problem is a number with a fixed length. We call this number as IP address. If we get this long story shortly there is a unique number for every device that connected to a network. At this time there are two IP address schemes. IPV4 and IPV6. The most used version is IPV4. So we are going to talk more about IPV4. In IPV4 we use 32 bits for a IP address. That means 4 bytes. Actually a IP address looks like this.
``11000000.10101000.00111000.01100101``
There are 4 parts . Above address is In binary format. For easy reading we use IP address in decimal .like this one. 192.168.56.101 . When we think about a one byte (8bits) it can contain 256 different values. So it contains 0 to 255. (00000000 to 11111111). In IPV6 we use 128 bits (16 bytes). A IPV6 address will look like following.
``2606:4700::c629:d7a2``
. I hope you got a clear idea about this concept. Now move onto next topics. When we think about a LAN above concept is OK and can be full satisfied. But think about internet. You know that a LAN is a network of small number of computers those located in a local aria. But in Internet there are many small networks. All of these networks contain lot of computers and other networked devices. Now in above pic, computer A is in Network 1 and computer B is in Network 2. When computer A sending a massage to computer B , he need to know the name of receiver and the name of the network that receiver is located on.Because computer B is not in same network. This is the time things getting interested. As a solution to this problem we divide IP address to two parts. One is network ID. It contains the name of network. Second part is host id. That one contains the name of device. Let's take an example.
``11000000.10101000.00111000.01100101``

Hi, I'm Thilan. An engineering student from SriLanka. I love to code with Python, JavaScript PHP and C.

Sep 22

Hi guys, I thought to start a tutorial serious on cryptography. Because its an essential subject to....

Mar 23

Metasploit is an awesome tool. It can be used to automate the exploitation process , generate shell....

Aug 12

You know that variable is a memory space ant it contains a value. When we talk in low level that's....