1. ## TCP/IP Addressing & Subnetting

Hey guys, found this on the net and thought it could be of some intrest to you Internet Buffs out there . Now I'm hoping you know what this is about, obviously by the name of the thread...

Every IP address can be broken down into 2 parts, the Network ID(netid) and the Host ID (hostid). All hosts on the same network must have the same netid. Each of these hosts must have a hostid that is unique in relation to the netid. IP addresses are divided into 8 octets with each having a maximum value of 255. We view IP addresses in decimal notation such as xxx.xxx.xxx.xxx, but it is actually utilized as binary data so one must be able to convert addresses back and forth.

CONVERTING IP ADDRESSES BACK AND FORTH
Code:
```
Decimal          Binary
128-------------10000000
64---------------01000000
32---------------00100000
16---------------00010000
8-----------------00001000
4-----------------00000100
2-----------------00000010
1-----------------00000001```
When converting binary data to decimal, a "0" is equal to 0. "1" is equal to the number that corresponds to the field it is in. For example, the number 213 would be 11010101 in binary notation. This is calculated as follows:
128+64+0+16+0+4+0+1=213.

Remember that this only represents 1 octet of 8 bits, while a full IP address is 32 bits made up of 4 octets. This being true, the IP address 213.128.68.130 would look like 11010101 10000000 01000100 10000010. If you understand this then you are a geek and all of your friends will laugh at you. Believe me - I know!

CLASSES
Code:
```
Class          Range
A-------------10000000
B-------------01000000
C-------------00100000```
IP addresses can be class A, B or C.
• Class A addresses are for networks with a large number of hosts. The first octet is the netid and the 3 remaining octets are the hostid.
• Class B addresses are used in medium to large networks with the first 2 octets making up the netid and the remaining 2 are the hostid.
• A class C is for smaller networks with the first 3 octets making up the netid and the last octet comprising the hostid.

------------------------------------------------------

SUBNETTING

A subnet mask blocks out a portion of an IP address and is used to differentiate between the hostid and netid. The default subnet masks are as follows:

Code:
```
Class          Default Subnet          # Of Subnets          # Of Hosts Per Subnet
Class A------255.0.0.0---------------126-------------------16,777,214
Class B------255.255.0.0------------16,384------------------65,534
Class C------255.255.255.0---------2,097,152---------------254```
In these cases, the part of the IP address blocked out by 255 is the netid.

The table above shows the default subnet masks. What subnet mask do you use when you want more that 1 subnet? Lets say, for example, that you want 8 subnets and will be using a class C address. The first thing you want to do is convert the number of subnets into binary, so our example would be 00001000. Moving from left to right, drop all zeros until you get to the first "1". For us that would leave 1000. It takes 4 bits to make 8 in binary so we add a "1" to the first 4 high order bits of the 4th octet of the subnet mask (since it is class C) as follows:
11111111.11111111.11111111.11110000 = 255.255.255.240.

There is our subnet mask. Lets try another one...Lets say that you are the network administrator for a chain of dry cleaning stores in New York and you have stores in 20 different neighborhoods and you want to have a separate subnet on your network for each store. It will be a class B network. First, we convert 20 to binary - 00010100. We drop all zeros before the first "1" and that leaves 10100. It takes 5 bits to make 20 in binary so we add a "1" to the first 5 high order bits which gives:
11111111.11111111.11111000.00000000 = 255.255.248.0.

The following table shows a comparison between the different subnet masks.

Code:
```
Mask            # of Subnets          ClassA Hosts          ClassB Hosts          ClassC Hosts
192------------2-----------------------4,194,302-----------16,382----------------62
224------------6-----------------------2,097,150-----------8,190------------------30
240------------14----------------------1,048,574----------4,094------------------14
248------------30----------------------524,286-------------2,046------------------6
252------------62----------------------262,142-------------1,022------------------2
254------------126--------------------131,070--------------510---------------------Invalid
255------------254--------------------65,534----------------254---------------------Invalid```

2. Thanks WebCarnage. If people need some help understanding the binary side of this, here's a link to a tutorial I wrote on this subject. Read it here.

3. Good post [WebCarnage], keep em coming

4. Yep, that's some good stuff there, definitely worthwhile reading. Good job, [WebCarnage]!

5. Remember that this only represents 1 octet of 8 bits, while a full IP address is 32 bits made up of 4 octets. This being true, the IP address 213.128.68.130 would look like 11010101 10000000 01000100 10000010. If you understand this then you are a geek and all of your friends will laugh at you. Believe me - I know!
What are we when we can move binary into hex?

6. as far as the classes go class A is set aside for large companys, government, corperations or extremly larde networks with a massive amount of hostsand a limited amount of networks.
the first octec is the net class A 1-126 B 128-191.255.0.0 and C 192-223.255.255.0
class B are set aside for schools, organizations or mid sized networks
and class C are for home users small bussinesses and smaller networks. this class can have many networks but fewr hosts class Cn.n.n.h class B n.n.h.h class A n.h.h.h
these were created before the internet. before that it was ARPA net which was defense
and government oriented.
but as u may or may not know the class C is relativley small compared to the other classes
because it was never thought that they would need many IPs for home pc use.
subnetting was to alleviate the need of more IPs and create many LANS (Local Area Network) but class C is running out.
I have heard that they have devised a new classless IP network, but am unsure of how.
With the implementation of CIDR in 1994 it allowed the internet to grow by more efficiently aggregate routing info.
in other words a single entry in a routing table can represent the addressspaces of many networks. which reduces the size of routing tables which increses scalability.
there is muc more to this i just gave u a taste
thanx

7. I like your post [webcarnage]. I always wanted to know how to convert ips to binary but thought it would be a bit harder than that and nice tutorial also smirc.

8. i read the post on binary to hex above and if you dont know how to convert its really easy
this may be a refresher for most but there are those who dont know

say we took 10110011.11101001.10110101.01011011
now thats a bg # right well split the octet in two
we will take the first one 10110011 split it in two right down the middle 1011/0011
now all u do is deal with each side the left side is 11 but in hex its B
hex is 0,1,2,3,4,5,6,7,8,9 instead of 10 ,10 is a 11 is b 12 c 13d 14 e 15f
so the first half of the octet is B the second half is 3
so your answer in hex is B3 the next octet is E9 the next is B5 and the last is 5B
and 1 more 11111111 convert 1111/1111 is FF in hex
i hope this simple conversion helps
have fun!

9. Excellent and informative post, WC.

10. hey that was really helpful WC keep posting....

intruder...

Page 1 of 2 12 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•