11 August, 2016 - 22:27 — Od0_

Prerequisites:

Basic computer skills

How do you get online? Loaded question, but there are way in which we can understand everything. This is a basic primer on networking and IPV4 addressing. In order to keep this digestible I am going to split this up into a two part series. This first one will focus on the basics of IPV4 addressing and subnetting.

Lets dive into how we can connect to our networks. When you turn on your computer in the morning there are steps taken to allow you to connect and get to the assets of said network. The first steps is that your client will broadcast out to your network telling everyone that it’s here and needs a pass to get onto the network (more on this later). The pass comes in the form of your IP address which your DHCP server assigns to your computer. Once you have that address you are free to roam around, and take advantage of those network assets (shared drives, etc.).

Easy right? Let’s look at how our IP addresses are structured and assigned. In the old days you had to assign addresses manually to each computer and IP addresses are we plentiful. Each computer got an individual IP address. Meaning the two computers you had each had their own and the three I had each had their own. All that changed when NAT (network address translating) came along and allowed us to create networks under our one public IP addresses. It allows us to create all sorts of networks.

Quick note before moving on. We are going to dissect IPV4 addressing as I know this best. It is still widely used and will be for quite some time. That said, IPV6 which is what will address the issue of public IPs running out. As it stands we are at 232of addresses (4,294,967,296) with IPV6 it uses a 128-bit addresses which give us about 2128(340,282,366,920,938,000,000,000,000,000,000,000,000 unique addresses). To give you an idea that’s about 54 million addresses for each square meter of the Earth’s surface.

Let’s look at the anatomy of our IP address. Each host is given one made up of four 8-bit decimal values from 0 to 255 separated by periods (example 192.168.16.100). Each 8-bit set of numbers are referred to as octets. For each address we have both host identifying information and network identifying information. We can tell which is which by the numbers in each address. How we tell is given away by the class of IP address we encounter.

Classful IP addressing is broken into three distinct classes. Each class has it’s own subnet mask and determines the amount of hosts that are possible for your subnet. It is a consideration taken before setting up your network. How large do you need to able to scale to accommodate a growing business or personal network. Now a subnet mask is another 32-bit value made up of binary 1 bits and 0 bits. When comparing to an IP address, the bits corresponding to the 1s in the mask are the network bits and the 0s in the mask are the host bits. For example the address we used earlier of 192.168.16.100 has a subnet mask of 255.255.255.0 which translates to 11111111.11111111.11111111.00000000. The first three octets (192.168.16) identify the network and the last one identifies the host (100).

Now we have three different classes that we can use to break up our subnets each one has a set number of hosts and a different subnet mask to go with each one. Below is a table of addresses

What’s been described above has even more layers to it. It’s simple the number of hosts depends on the class of IP network and the subnet mask. What I’ve described it CIDR IP addressing. Classless Internet Domain Routing (CIDR), pronounced "cider," represents addresses using the network/mask style. The notation can tell us a lot about the network. So let’s look at one:

An example would be 192.168.43.0/26. We know the network bits the /26 tells us our subnet mask. I know what you’re thinking “it’s a Class A, isn’t it just 255.255.255.0?” No it is not. The /26 indicates to us the bits allotted to the subnet mask so let’s break it down:

Let me explain. We have the /26 which tells us that we have 26 spaces that are 1-bits and six that are 0-bits. So we take our notation and layout our 32-bit address and each octet with all 1s comes to 255:

We see that for the first three octets so we know the subnet mask starts with 255.255.255. Now the tricky part is the one with the 0s in it. We can break that down just as easily:

For each bit that is 1 we get the value of that bit, but for each one that is 0 we get 0. So for the last octet we take the value of the first two bits and add them up to get our address which is 192. So our full subnet mask comes out to 255.255.255.192.

So now that we know that how do we calculate how many subnets we can make from that or how many hosts we can get from it? We do that by looking at the last octet of our subnet mask. We have two equations to remember: 2n; N is the number of 0-bits we borrowed. In this case it would be 26=64which is the number of subnets we can get from this subnet mask. The second equation calculates the number of hosts we can give addresses to for every subnet. The equation is 2n-2, so in this case we get 26- 2 =62. So we get 62 hosts per subnet.

Now this is only a basic primer for subnetting. We have only scratched the surface. Knowing how to do this stuff in your head is important because you will have a more thorough understanding of how your network is designed. That said you can also use a subnet calculator to save you time. There is much more involved and I can write whole papers on supernetting. The next tutorial we will break down how these addresses are signed and the various goings on from the main server to your computer.

This is a good online subnet calculator I’ve used in the past:

http://www.subnet-calculator.com/

More networking resources:

https://en.wikipedia.org/wiki/Subnetwork

http://www.enterprisenetworkingplanet.com/netsp/article.php/3566521/Netw...