'

Basic Networking Howto.

July 16th, 2008 by Andrea Matesi 1011 Views

 

Given my many job roles have always had something Networking-related, today I felt like posting a summary of the topic (I may always refer to in case I forget how networking works).

The following takes into account the structure of LAN Networks with the TCP/IP Suite of Protocols.

Admittedly, in the past I have fallen "victim of ignorance" when talking about IP Addresses/Subnets-Subnet Mask, Broadcasts and Binary conversions.

 

Whomever invented the IPv4 suite of protocols, introduced the Classes concept to better separate and distinguish one Network from another.

Normally, the difference between class A, B and C addresses lies in the first 4 bits of the first octet.

Octet: a simple series of 8 bits that make up an IP Address.

Octet example: 1 1 1 1 1 1 1 1 (eight binary numbers, each number is a bit aka binary digit).

So "1111 1111" translates to 255 on decimal (try the conversion with your calculator!).

 

By its definition, a "Class A" address has the FIRST bit of the octet ALWAYS set to ZERO, so -> | 0 1 1 1 1 1 1 1 | translates to 127.

'Though there is an exception to the rule - The 127 Class A address is "Reserved for loopback", so it has been artificially established by its definition that the range for "Class A" Networks is 1..126 (126 is | 0 1 1 1 1 1 1 0 | ) while the loopback range has been marked as special and it'll always refer to "YOUR_PC").

 

Class B address definitions have their SECOND bit of the octet set to ZERO, so -> | 1 0 0 0 0 0 0 0 | translates to 128, therefore the range assigned to class B is 128..191 (191 is | 1 0 1 1 1 1 1 1 | ).

No special rules for Class B as you can see.

 

A Class C address has its THIRD bit of the octet set to ZERO, so -> | 1 1 0 0 0 0 0 0 | translates to 192.

The equivalent range assigned to class C is therefore 192..203 (203 is | 1 1 0 1 1 1 1 1 | ).

 

Class D is another form of Class, intuitively, Class D ranges from 224..239 (wich is | 1 1 1 0 0 0 0 0 | to | 1 1 1 0 1 1 1 1 |), where ZERO lies on the fourth bit position.

 

After the preview, now let's analyze how subnetting works.

 

To understand subnetting, it is important to remember that, inside a Network, there are some constraints:

  1. A Network has a well-defined IP Address that usually finishes with a zero (ex. 192.168.1.0) [there are some special cases whereas a Network Address doesn't finish with a zero 'though].
  2. A Network can't exist without a Broadcast address. The Broadcast Address is built upon the Network Address by switching the last bits to 1, i.e.: N:192.168.1.0 - B:192.168.1.255).
  3. The Network is an address that gets masked to a Subnet Mask (in fact a Network can also be called Subnet - they are synonims).
  4. There is only a limited number of possible addresses (based on the Subnet mask).

It is almost impossible to make a huge single Ethernet Network (like a pure Class B - 65536 hosts), without considering subnetting, because the network would become clogged, slow and unmaintainable (what happens, technically speaking, is "collisions"). The "collision"-issue is due to broadcasting: when you have a huge segment, and a single client "broadcasts", this broadcast is spread to all the (65536) hosts belonging to the network(!) Said in other words, if a computer Broadcasts, all the other hosts that belong to the same network have to stop what they're doing and listed.

So this is why you'll have to logically separate one network from the other - Broadcasts are limited (by design) to live only within a Subnet.

This is the reason why you'll use subnetting - by separating one Network Segment from another Network Segment, and by joining them accordingly by using a router (any device with two Network I/Fs and forwarding rules may be called as such), you'll limit the "Broadcast Domain".

In other words, when Network Segment A experiences a Broadcast that hits the router device, by default, the router device won't propagate the Broadcast to the other Network Segment B.

 

Enter Subnet Mask.

The Subnet Mask is an IP-like address composed of binary ONES and ZEROS. The SM is a layer applied to an IP Address to "identify" and distinguish a what is the Network+Broadcast and what IP Addresses would get assigned to the hosts.

 

An IP address is made of bits (one or zeros).

When you specify a SM, you'll have to apply this mask to the IP address to precisely identify what the Network is.

Example:
IP: 192.168.1.0 - netmask: 255.255.255.0

Open questions:

  1. What is the class?
  2. What is the network?
  3. What is the Broadcast?
  4. What IP address the Network's hosts should have?

Answers:

  1. The Class of the Network is Class C, because 192 translates to | 1 1 0 0 0 0 0 0 | and the ZERO lies on the third bit.
  2. The Network is 192.168.1.0, because the subnet mask is composed of all | 1 1 1 1 1 1 1 1 | on the first 3 octets, and when we have all 1s on the octet, we want to distinguish the network part from the host part [by assigning a 1 to the net and a 0 to the host]. This is how it works intuitively, in reality it is the result of a logical AND operation.
  3. The Broadcast address is 192.168.1.255, that is because all the host bits part should be set to all 1s, since the hosts part of the network is the 0 of the 192.168.1.0 network, and we set them to all 1s ( | 1 1 1 1 1 1 1 1 | -> 255 decimal).
  4. Any host inside this network could have an address such as 192.168.1.14 or 192.168.1.254 or whatever.

Answer 3 Explanation:
For the matter, please remember that a logical AND operation always returns a 1 only when two 1s are available and a 0 "always wins" so:

0 AND 0 -> 0;

0 AND 1 -> 0;

1 AND 0 -> 0;

1 AND 1 -> 1;

If you put into column IP plus Subnet Mask, and you apply the AND operation to them, you'd get the right Network address:

IP: | 1 1 0 0 0 0 0 0 | . | 1 0 1 0 1 0 0 0 | . | 0 0 0 0 0 0 0 1 | . | 0 0 0 0 0 0 0 0 |

AND

M: | 1 1 1 1 1 1 1 1 | . | 1 1 1 1 1 1 1 1 | . | 1 1 1 1 1 1 1 1 | . | 0 0 0 0 0 0 0 0 |

gives you the right Network Address:

N: | 1 1 0 0 0 0 0 0 | . | 1 0 1 0 1 0 0 0 | . | 0 0 0 0 0 0 0 1 | . | 0 0 0 0 0 0 0 0 |

192.168.1.0

Addendum:

Today we can find some address expressed in the form IP.Address/number (like 192.168.1.0/24).

What this mean is simple: It is a network that dedicates the first 24 bits on the Subnet Mask (as 1s for the network part), and the rest 8 bits as 0s (on the hosts part). So we intuitively identify this network as 192.168.1.0 (given by the AND operation between the IP and the Subnet Mask,  192.168.1.0 AND 255.255.255.0 -> CONVERTED TO BINARY -> AND OPERATION -> CONVERT THE RESULT TO DECIMAL -> 192.168.1.0 as Network Address).

That seems all.

[UPDATE-2012-03-22]: Article reviewed and cleaned (garbage info now fixed).

[UPDATE-2012-03-22] "BIGGER THAN?!" BINARY TABLE:

128 64 32 16 8 4 2 1

This table is fundamental and allows you to quickly and intuitively convert ANY Decimal Number [up to 255] to Binary.

Example: 221 TO BIN = ?

221 >= 128? 1

221 - 128 = 93.

93 >= 64? 1

93 - 64 = 29

29 >= 32? 0

29 >= 16? 1

29 - 16 = 13

13 >= 8? 1

13 - 8 = 5

5 >= 4? 1

5 - 4 = 1

1 >= 2? 0

1 >= 1? 1

221 to BIN = 1101 1101 :D

Senior Professional Network and Computer Systems Engineer during work hours and father when home.

Andrea strives to deliver outstanding customer service and heaps of love towards his family.

In this Ad-sponsored space, Andrea shares his quest for "ultimate" IT knowledge, meticulously brought to you in an easy to read format.

Rate this post

Posted in Network Engineering | Comments Off on Basic Networking Howto.

Comments are closed.