Wednesday, July 4, 2007

IP addressing and subnetting.

There are over 100 different protocols in the TCP/IP protocol suite. IP (Internet Protocol) is one of the protocols in the TCP/IP protocol suite. The primary function of the IP is addressing and routing. An IP address is 32 bit long.
Logically, we write the IP address like this: 202.221.100.121 Notice that when we look at an IP address, we see 4 parts, separated by dots. This is because IP has a hierarchical structure. Looking at this IP address we can identify that it's a class C address because the first octet is 202 (between 192 and 223).
When the computer sees an IP address, it does not see any dots that separate the octets. The computer sees the same address like this: 11001010110111010110010001111001
The software responsible for interpreting the IP address (the software that's installed when you install TCP/IP protocol on your computer) determines the class of IP address by looking at the first 3 bits (leading bits) of the address.
Class A address will always start with 0Class B address will always start with 10Class C address will always start with 110
IP address carries two pieces of information: The first part of IP address is a network address, and the second part is a HOST address. Just exactly how many bits of the address represents the Network address is determined by the class of address and the subnet mask.
In our example, computer reads the fist 3 bits of the address and right away determines that it's a class C address. For the computer it means that the first 3 octets (first 24 bits) is a network address, and the rest is the Host address.

Sometimes it is necessary to divide a network into smaller logical groups. This is called subnetting.
Advantages of subnetting are: Reduced network congestion, Increase in network performance.
To implement subnetting, we borrow some of the bits from the host address and use them for the subnet address.
In our earlier example, we have IP address 202.221.100.121, or 11001010110111010110010001111001. The first 24 bits is a network address (because it's a class C network), and the last 8 bits are HOST address. Network: 110010101101110101100100 Host: 01111001
Lets suppose we have a whole class C network assigned to us 110010101101110101100100. We can have 254 addresses available for us to use on our network. If we need to divide our network into 5 subnets, we would need to borrow 3 bits from the host address portion to use them to identify subnet address. We will have only 5 bits left to use for host addresses. We can have only 32 combinations with 5 bits, minus 2 because we cannot have addresses with all 1s or all 0s. So now we can have 5 subnets with 30 hosts on each one, totaling 150 hosts. Additionally, every subnet must have one host address reserved for the router interface because we need to use routers to connect our subnets. Now we down to 29 addresses available for our computers on our 5 subnets. 29x5=145
In the process of subnetting we lost many of available addresses (From 254 down to 145)
In order to implement subnetting, we use subnet masks to let our computers know how many bits from IP address will be used for the network address, and how many for the host address.
The default subnet mask for class C address is 255.255.255.0, in binary it looks like this:11111111111111111111111100000000
In order to borrow 3 bits from the host address part, we must create a custom subnet mask like this:11111111111111111111111111100000 or 255.255.255.224
When deciding on a subnet musk, remember that you need 1 network ID (separate subnet) for each WAN connection in addition to each subnet. What it means is that if you have 2 offices separated by a WAN link, you need at least 3 subnets: one for each office and one just for a WAN link. The WAN link itself will probably only need 2 IP addresses (one for WAN router interface on each router). As you can see, you would waste a lot of IP addresses just for the WAN link (an entire range of IP addresses for one subnet).
Also remember that you need an IP address for every computer, network printer, other networking devices plus a router interface on each subnet. So, if you are planning a subnet, and have 28 computers and 2 network printers, you need at least 31 IP addresses for it (remember at least one for the router interface).
Remember that the subnet mask must be the same for entire network being subnetted. Subnet mask is not a part of an IP address, it is not included in the packets' address header and not transmitted over the network, it is something that you manually assign to every computer on the network. (or can be assigned by the DHCP server along with IP address and default gateway)
Computers look at the subnet mask to determine if the destination IP address is on a local or remote network. If it's determined to be on a local subnet, it will be sent to the destination computer, using destination computer's MAC address (physical address). The MAC address will either be found in ARP cache or the ARP protocol will be used to find the destination's MAC address.
If after looking at destination's IP address and comparing it to the subnet mask, it's determined that the destination computer is on a remote subnet, the packets will be sent to the default gateway (router). Each subnet must have at least one default gateway address, and this address must be local to the subnet.
Incorrectly configured subnet masks can cause serious problems. If sending computer decides that the destination IP address is on the local network, when in fact it's on a remote network, the packet will never be sent to router, and will be dropped after several attempts to find the remote IP on the local network.

Just like IP address, subnet mask is 32 bits long. The number of 1s in the subnet mask is called "prefix notation" . An IP address 219.34.29.114 with subnet musk 255.255.255.240 can be written like this: 219.34.29.114/28 because the subnet mask of 255.255.255.240 has 28 1s and 4 0s (looks like this: 11111111111111111111111111110000)

When planning your subnets, always plan for growth. If you need 500 host IDs on each subnet on a class B network, choose a subnet mask of 255.255.252.0, not 255.255.255.254. Because if you will later decide to add 11 more computers on any subnet, you will have to change the subnet mask and will have to reconfigure every workstation and router on your entire network.
A subnet mask of 255.255.255.128 can be used on the class C network in order to maximize the number of available addresses when subnetting a class C network. In order for it to work, all routers on the network must be able to understand this type of mask.
Cisco router can understand subnet 0, but it must be enabled in the router by issuing "ip subnet-zero" command.The problem with this type of mask is that it only uses one bit to identify the subnet address, and it can only be 1 or 0. Older router may not be able to understand this subnet mask and interpret it as illegal subnet mask.

26 comments:

Anonymous said...

Can anyone recommend the best Software Deployment program for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central remote control
? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

Anonymous said...

If you wish for to grow your knowledge just keep visiting this website
and be updated with the newest gossip posted here.
Also see my page: forja

Anonymous said...

I'm amazed, I have to admit. Rarely do I come across a blog that's equally educative and amusing, and let
me tell you, you have hit the nail on the head.
The problem is an issue that too few men and women are speaking intelligently about.
I am very happy that I stumbled across this in my hunt for something regarding this.
Feel free to surf my web page - InstalaciĆ³n geotermia en Madrid

Anonymous said...

When someone writes an piece of writing he/she keeps
the idea of a user in his/her brain that how a user can
know it. So that's why this piece of writing is amazing. Thanks!

Also visit my web blog - bleeding hemorrhoids treatment
my site: hemorrhoid treatment at home

Anonymous said...

Hello there! I could have sworn I've been to this website before but after checking through some of the post I realized it's new to me.
Anyhow, I'm definitely delighted I found it and I'll be bookmarking and checking back often!


Also visit my web-site User:ElaineLa - ChemPRIME
Also see my page: consolidate your student loans

Anonymous said...

Heya i'm for the first time here. I found this board and I find It truly useful & it helped me out much. I hope to give something back and help others like you aided me.

my site :: diets that work for women

Anonymous said...

Hi there, just wanted to tell you, I enjoyed this article.

It was practical. Keep on posting!

Also visit my web site plus de followers

Anonymous said...

Hi! This post could not be written any better! Reading this post
reminds me of my previous room mate! He always kept talking
about this. I will forward this write-up to him. Pretty sure he will have a good read.
Thank you for sharing!

my website: best paying work from home jobs
My site: best business ideas for 2011

Anonymous said...

An impressive share! I've just forwarded this onto a coworker who had been conducting a little research on this. And he actually bought me dinner simply because I found it for him... lol. So allow me to reword this.... Thanks for the meal!! But yeah, thanks for spending some time to talk about this subject here on your web site.

Also visit my web page - graduate certificate

Anonymous said...

Hey, I think your website might be having browser compatibility issues.

When I look at your blog site in Safari,
it looks fine but when opening in Internet Explorer, it has some overlapping.
I just wanted to give you a quick heads up!
Other then that, amazing blog!

my blog post :: thinkstr.com/blog/642360/storage-dayton/

Anonymous said...

One other issue is that if you are in a circumstances where you will not have
a cosigner then you may actually want to try to wear
out all of your financing options. You can find many awards and other scholarships that will
ensure that you get money to help with college expenses.

Thx for the post.

My page: dating online sites

Anonymous said...

It's appropriate time to make a few plans for the future and it is time to be happy. I have read this post and if I could I desire to suggest you few attention-grabbing things or tips. Maybe you can write subsequent articles referring to this article. I desire to learn more issues about it!

My web blog: speed dating online

Anonymous said...

Wow! This could be one particular of the most beneficial blogs We've ever arrive across on this subject. Actually Fantastic. I am also an expert in this topic so I can understand your hard work.

my website uberspace.de

Anonymous said...

I relish, lead to I discovered exactly what I used to be looking for.
You have ended my four day lengthy hunt! God Bless you man.
Have a nice day. Bye

Also visit my web page impalaclub.co.ke

Anonymous said...

naturally like your web site however you have to test the spelling on
quite a few of your posts. Several of them are rife with spelling issues and I in finding it very troublesome to
tell the truth on the other hand I will surely come back again.


Feel free to surf to my homepage golftitan.com

Anonymous said...

I will right away clutch your rss as I can not to find your email subscription hyperlink or
e-newsletter service. Do you've any? Please let me realize in order that I may just subscribe. Thanks.

my homepage: estariawiki.justgalak.com

Anonymous said...

to grain and other complex carbohydrates will help you have more energy while having less.

Good blog post.

my page :: free dating sites in usa

Anonymous said...

Normally I don't learn article on blogs, however I wish to say that this write-up very forced me to check out and do it! Your writing taste has been amazed me. Thank you, quite nice post.

Also visit my homepage ... wiki.sheilabishop.com

Anonymous said...

I have to express my appreciation for your kind-heartedness for individuals who actually need assistance with that area.
Your real dedication to passing the message throughout ended up being remarkably powerful and has really
made most people much like me to realize their ambitions.

This useful hints and tips implies a lot to me and still more to my mates.
Regards; from each one of us.

Feel free to visit my weblog ... www.coldpros.com

Anonymous said...

It�s really a cool and helpful piece of information.
I�m happy that you simply shared this helpful info with
us. Please stay us up to date like this. Thanks for sharing.



my web page :: facebook for sex

Anonymous said...

Simply want to say your article is as astonishing.
The clearness in your put up is simply cool and i can suppose you're an expert on this subject. Fine along with your permission let me to clutch your RSS feed to stay up to date with drawing close post. Thank you a million and please keep up the rewarding work.

Also visit my web blog :: cyber sex

Anonymous said...

r ideas.

Here is my website :: cyber sex

Anonymous said...

I constantly emailed this weblog post page to all my
contacts, because if like to read it afterward my
links will too.

Also visit my site safe diets

Anonymous said...

I would like to thank you for the efforts you have put in
writing this site. I'm hoping to see the same high-grade blog posts from you later on as well. In fact, your creative writing abilities has inspired me to get my very own blog now ;)

Feel free to visit my weblog good diet plans for women

Anonymous said...

Off seasons reasons some shoes is usually[url=http://niketrainersuksale.webeden.co.uk]Nike Blazers UK[/url]
little while won't make a probability to[url=http://tomscanadaoutlet.snappages.com]Toms Shoes Canada[/url]
wear such shoes came across[url=http://addnikecanadastore.snappages.com]Nike Shoes For Women[/url]
rightly pitch both of them nside the[url=http://louboutintrainersuk.blog.co.uk]http://louboutintrainersuk.blog.co.uk[/url]
set upright place into to avoid dispensable wickedness to shoes[url=http://salelouisvuittonuk.webeden.co.uk]Louis Vuitton Bags[/url]

If your insole in information is rotten, could stress to command of a like a soft engagement and splash gently scrub. To fit acclaimed that, steer clear of using chemical cleaning agents cleaning, or they frequently current the insole the outside of fabric off.[url=http://shoppradabagsuk.webeden.co.uk]Prada Outlet[/url]

Anonymous said...

Does your site have a contact page? I'm having a tough time locating it but, I'd like to shoot you an
e-mail. I've got some suggestions for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it develop over time.

Feel free to visit my web page: telephonie