Skip to main content

IPV4 Address - Subnetting Tutorial

IPV4 Address

IPV4 Address is 32bit.

IPV4 has public and private IP Address.

Public IP Addresses is routable over the internet.

Private IP Addresses as it names implies is private,  which is basically for private use and is not routable over the internet. Use by private companies or private individuals.

Logically, private IP just goes with the saying. What happens in LA stays in LA. Likewise a private IP Address if it use at home then that IP Address stays at home. It won’t even go out to the neighbor, unless you have a Wifi and the neighbor crack your Wifi or wireless password, then that’s an exemption.

Private IP Address Classes and Range

Class A
10.0.0.0 – 10.255.255.255
Class B
172.16.0.0 – 172.31.255.255
Class C
192.168.0.0 – 192.168.255.255


IPV4 is 32 bit or four octets, each octet  is separated by dot or period.

Example of an IPV4 Address, if you count the number of x it’s  32 x’es.

xxx xxxx . xxxx xxxx . xxxx xxxx . xxxx xxx

Since IPV4 is  32 bit, so it is compose of  32 bits of either 1’s or  0’s.

Example in binary is: 1100 0000 . 1010 1000 . 0000 0001 . 0000 0001

Decimal equivalent  of above binary address is a private IP which is 192.168.1.1

If you’re tired of doing manually the conversion, pull out windows calculator to verify.

But if you’re preparing for a Cisco Certification suggests you do the conversion manually for practice and use windows calculator to verify the correct answer.

If you issue the command  “IPCONFIG” in a Windows OS.

It will always  display the result with a standard format, which is an IP Address, Subnet Mask and Gateway.

But if you issue “IPCONFIG /ALL” it will have more detailed result but I’m not going to talk about it.

IP Address gives a unique information of the device or a computer in the network so it will be able to communicate with other computers or devices on the network.

If there’s a duplicate IP Address on the network, Windows OS normally will prompt a message like “IP Conflict Address”.  And the computer or device is disconnected from the network.

Subnet mask, is used to extract information about the host address and the network address.

Gateway  is like the baseline of the communication on the local network, a common setup in local network, is that a  gateway IP Address is the IP Address of the router. But of course it’s not always a router it depends on the setup of your network.

In the CISCO world or network environment, “Gateway of last resort” is a common phrase.

If you’re preparing for a Network Certification such as Cisco Certification.

CCNA certification requires the candidate to have a solid knowledge of subnetting.

To determine the host address and the network address, is the job of the subnet mask.

So how does a subnet mask does it job?

IPV4  Address is 32 bit, so it’s prefix length will start from prefix 1 until prefix 32.

So the IP Prefix Length table will be like this: (it’s just in two rows just for a good display, but it will be better to write it down in one row)

/1
/2
/3
/4
/5
/6
/7
/8
/9
/10
/11
/12
/13
/14
/15
/16
/17
/18
/19
/20
/21
/22
/23
/24
/25
/26
/27
/28
/29
/30
/31
/32


Private IPV4 Address has Class A, Class B and Class C. Class A IP Address is sometimes called an /8 network, likewise a Class  B is /16 and Class C is /24.

/8, /16, /24 refers to the number of bits used by the network address.

Class A will have a subnet mask of 255.0.0.0 (/8)

Class B will have a subnet mask of 255.255.0.0. (/16)

Class C will have a subnet mask of 255.255.255.0 (/24)


In binary Class A will be 1111 1111 . 0 . 0 . 0

Class B – 1111 1111 . 1111 1111 . 0 . 0

Class C – 1111 1111 . 1111 1111 . 1111 1111 . 0

If you pop up a Windows calculator and convert binary 1111 1111 to decimal, answer would be 255.

Why 255? Because that’s the way it is?

      To come up with 255, it has this decimal value.

Let’ use the Prefix Table:

/1
/2
/3
/4
/5
/6
/7
/8

128
64
32
16
8
4
2
1
 add all = 255

/9
/10
/11
/12
/13
/14
/15
/16

128
64
32
16
8
4
2
1
add all = 255

/17
/18
/19
/20
/21
/22
/23
/24

128
64
32
16
8
4
2
1
add all = 255

/25
/26
/27
/28
/29
/30
/31
/32

128
64
32
16
8
4
2
1
add all = 255

So that’s the mystery behind the subnet mask, as you can see there’s  a pattern.

Now let’s derive the Subnet Mask value from the table above:


/1
/2
/3
/4
/5
/6
/7
/8

128
64
32
16
8
4
2
1

128 + 0 = 128
128 + 64 = 192
192 + 32 = 224
224 + 16 = 240
240 + 8 = 248
248 + 4 = 252
252 + 2 = 254
254 + 1 = 255
Subnet Mask
128
192
224
240
248
252
254
255

.
/9
/10
/11
/12
/13
/14
/15
/16

128
64
32
16
8
4
2
1

128 + 0 = 128
128 + 64 = 192
192 + 32 = 224
224 + 16 = 240
240 + 8 = 248
248 + 4 = 252
252 + 2 = 254
254 + 1 = 255
Subnet Mask
128
192
224
240
248
252
254
255

.
/17
/18
/19
/20
/21
/22
/23
/24

128
64
32
16
8
4
2
1

128 + 0 = 128
128 + 64 = 192
192 + 32 = 224
224 + 16 = 240
240 + 8 = 248
248 + 4 = 252
252 + 2 = 254
254 + 1 = 255
Subnet Mask
128
192
224
240
248
252
254
255

.
/25
/26
/27
/28
/29
/30
/31
/32

128
64
32
16
8
4
2
1

128 + 0 = 128
128 + 64 = 192
192 + 32 = 224
224 + 16 = 240
240 + 8 = 248
248 + 4 = 252
252 + 2 = 254
254 + 1 = 255
Subnet Mask
128
192
224
240
248
252
254
255


If you notice the table, there’s a pattern for the subnet mask.

It’s always  128, 192, 224, 240, 248, 252, 254 and 255.

Let’s take an example of:  10.11.1.0 /10

So it’s a Class A IP Address but the subnet mask falls on the 2nd octet.

IP Address: 10.11.1.0  Subnet Mask: 255.192.0.0

Subnet mask is /10 and based on the table above /10 is equivalent to 192.

If you will notice below the increment is 64.

Like: 10.0.0.1 to 10.63.255.254 and the next subnet is 10.64.0.0. and next subnet is 10.128.0.0

Why is it a 64 increment?

If you look at the table above, you will notice that /10 falls under a 64 bit decimal value.

But there’s an easy way, you can always minus the subnet number by  256.

So, 256 – 192 = 64

So you will have this range:

Subnet          ,   Valid Hosts                       ,   Broadcast      
10.0.0.0        ,   10.0.0.1 to 10.63.255.254         ,   10.63.255.255  
10.64.0.0       ,   10.64.0.1 to 10.127.255.254       ,   10.127.255.255 
10.128.0.0      ,   10.128.0.1 to 10.191.255.254      ,   10.191.255.255 
10.192.0.0      ,   10.192.0.1 to 10.255.255.254      ,   10.255.255.255 
11.0.0.0        ,   11.0.0.1 to 11.63.255.254         ,   11.63.255.255  
11.64.0.0       ,   11.64.0.1 to 11.127.255.254       ,   11.127.255.255 
11.128.0.0      ,   11.128.0.1 to 11.191.255.254      ,   11.191.255.255 
11.192.0.0      ,   11.192.0.1 to 11.255.255.254      ,   11.255.255.255 
12.0.0.0        ,   12.0.0.1 to 12.63.255.254         ,   12.63.255.255  
12.64.0.0       ,   12.64.0.1 to 12.127.255.254       ,   12.127.255.255 
12.128.0.0      ,   12.128.0.1 to 12.191.255.254      ,   12.191.255.255 
12.192.0.0      ,   12.192.0.1 to 12.255.255.254      ,   12.255.255.255 
13.0.0.0        ,   13.0.0.1 to 13.63.255.254         ,   13.63.255.255  
13.64.0.0       ,   13.64.0.1 to 13.127.255.254       ,   13.127.255.255 
13.128.0.0      ,   13.128.0.1 to 13.191.255.254      ,   13.191.255.255 
13.192.0.0      ,   13.192.0.1 to 13.255.255.254      ,   13.255.255.255 
14.0.0.0        ,   14.0.0.1 to 14.63.255.254         ,   14.63.255.255  
14.64.0.0       ,   14.64.0.1 to 14.127.255.254       ,   14.127.255.255 
14.128.0.0      ,   14.128.0.1 to 14.191.255.254      ,   14.191.255.255 
14.192.0.0      ,   14.192.0.1 to 14.255.255.254      ,   14.255.255.255 


You can always make your own questions to practice. To verify your answers, you can download a subnet calculator. Boson subnet calculator is one of them and it is free. Just trawl the web and you will be able to find it.

Hope it will help a little bit to those who are struggling on how subnetting works.
Just my 2 cents of advice, to those who will sit for a CCNA Cisco Certification.  Don’t sit for the exam if you can’t subnet within 1 to 2 minutes.

In your examination day, before you click the start button. You can write down the subnet table on a scratch pad provided. So you don’t have to think about it during the exam.


Comments

  1. You can find what is my ipv4 by using simple curl command: curl https://myipv4address.com

    ReplyDelete
    Replies
    1. nowadays, API is commonly used. basically, once you connect to any website you are connecting using your Public IP. Wget, Curl or other commands send an API request and sometimes the data is on JSON format, or other formats. see this one: https://whatismyipaddress.com/api

      Delete

Post a Comment

Popular posts from this blog

Notepad++ convert multiple lines to a single line and vice versa

Notepad++ is an awesome text editing tool, it can accept regex to process the text data. If the data is in a “.csv” format or comma separated values which is basically just a text file that can either be opened using a text editor, excel or even word. Notepad++ can process the contents of the file using regex. Example if the data has multiple rows or lines, and what is needed is to convert the whole lines of data into a single line. Notepad++ can easily do it using regex. However, if the data is on a single line and it needs to be converted into multiple lines or rows then regex can also be used for this case. Here’s an example on how to convert multiple rows or lines into a single line. Example data: Multiple rows, just a sample data. Press Ctrl+H, and  on "Find what" type: [\r\n]+ and on "Replace with" type with: , (white space) --white space is needed if need to have a space in between the data. See image below, "Regular Expression" must be se

WMIC get computer name

WMIC get computer model, manufacturer, computer name and  username. WMIC is a command-line tool and that can generate information about computer model, its manufacturer, its username and other informations depending on the parameters provided. Why would you need a command line tool if there’s a GUI to check? If you have 20 or 100 computers, or even more. It’s quite a big task just checking the GUI to check the computer model and username. If you have remote computers, you need to delegate someone in the remote office or location to check. Or you can just write a batch file or script to automate the task. Here’s the code below on how get computer model, manufacturer and the username. Open an elevated command prompt and type:     wmic computersystem get "Model","Manufacturer", "Name", "UserName" Just copy and paste the code above, the word “computersystem” does not need to be change to a computer name. A

How to check office version from command line

The are quite a few ways to check office version it can be done via registry, PowerShell or VBScript and of course, good old command line can also do it. Checking Windows office version whether it is Office 2010, Office, 2013, Office 2016 or other version is quite important to check compatibility of documents; or just a part of software inventory. For PowerShell this simple snippet can check the office version: $ol = New-Object -ComObject Excel.Application $ol . Version The command line option will tell you where’s the path located; the result will also tell whether office is 32-bit, 64-bit and of course the version of the office as well. Here’s the command that will check the office version and which program directory the file is located which will tell whether it’s 32-bit or 64-bit. Command to search for Excel.exe: DIR C:\ /s excel.exe | find   /i "Directory of"  Above command assumes that program files is on  C: drive. Sample Outpu