LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 12-28-2007, 09:41 PM   #1
Gortex
Member
 
Registered: Nov 2005
Location: Enid Ok
Distribution: ubuntu 64 , debian , fedora core , vista ultimate 64, Winows 7 64 ultimate :p
Posts: 219

Rep: Reputation: 30
Subnet question


I am trying to learn how to subnet network address and I would like some one to go over my work and
tell me if i am doing this right


example class c address 192.168.1.0 divided in to 3 subnets that are useable

128 64 32 16 8 4 2 1

knowing that the last and first subnet will be unuseable i am going to borrow 3 bits total

for 7 subnets

this would make my new subnet mask 255.255.255.224


i have borrowed 3 of the 8 bits leaving 5 left over 2 to the 5th power would be 32
so it would give me these subnets


subnet range
0 192.168.1.0-32 0 being network address and 32 as broadcast cant use

1 192.168.1.33-65 33 being network address and 65 broadcast can use

2 192.168.1.66-98 66 being network address and 98 broadcast can use

3 192.168.1.99-131 99 being network address and 131 broadcast can use

4 192.168.1.132-164 132 network address and 164 broadcast can use

5 192.168.1.165-197 165 network address and 197 broadcast can use

6 192.168.1.198-230 198 network address and 230 broadcast can use

7 192.168.1.231-263 231 network address and i guess 255 broadcast cant use



Am I doing this right or have I made a huge mistake ?
 
Old 12-29-2007, 09:16 AM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
Sorry you are wrong on the subnetting of 192.168.1.0/224.
192.168.1.1 - 192.168.1.32
192.168.1.33 - 192.168.1.63
192.168.1.64 - 192.168.1.95
and soto
192.168.1.224 - 192.168.1.255

Brian
 
Old 12-29-2007, 11:29 AM   #3
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 48
Also, you're misunderstanding the subnet usability as far as I can see. If you have 192.168.1.0 and need it divided into 3 usable subnets, they obviously can't all be the same size. Also, it isn't subnets that are usable/unusable, all subnets can be used, it is just that the first and last host address within each subnet are not available, because one becomes the network's address, and the other the broadcast address for that subnet.

If all 3 subnets must be the same size, than you'd break the full subnet up into 4 parts, not 8 as you tried to do with the wrong math above.

The subnetmask should be 255.255.255.192 for 4 identically sized subnets -

0 192.168.1.0-63 0 being network and 63 being broadcast can't be used

1 192.168.1.64-127 64 being network and 127 being broadcast can't be used

2 192.168.1.128-191 128 being network and 191 being broadcast can't be used

3 192.168.1.192-255 192 being network and 255 being broadcast can't be used

If you want to break the subnet up into 3 and only 3 parts, then you'd make 2 of the networks 255.255.255.192 and the 3rd would be 255.255.255.128. The larger subnet needs to either be the first or last group, you can't make a 255.255.255.128 sandwiched between two 255.255.255.192 subnets. So either -

0 192.168.1.0-127 0 being network 127 being broadcast can't be used (mask 255.255.255.128)

1 192.168.1.128-191 128 being network 192 being broadcast can't be used (255.255.255.192)

2 192.168.1.192-255 192 being network 255 being broadcast can't be used (255.255.255.192)

Or flip that around

0 192.168.1.0-63 0 being network 63 being broadcast can't be used (255.255.255.192)

1 192.168.1.64-127 64 being network 127 being broadcast can't be used (255.255.255.192)

2 192.168.1.128-255 128 being network 255 being broadcast can't be used (255.255.255.128)

It gets a little confusing. Even Brian who normally gives dead on answers was off, because he began counting from 1 instead of from 0. His example should have looked like this:

192.168.1.0 - 192.168.1.31
192.168.1.32 - 192.168.1.63
192.168.1.64 - 192.168.1.95
and soto
192.168.1.224 - 192.168.1.255

Peace,
JimBass
 
Old 12-29-2007, 02:29 PM   #4
Gortex
Member
 
Registered: Nov 2005
Location: Enid Ok
Distribution: ubuntu 64 , debian , fedora core , vista ultimate 64, Winows 7 64 ultimate :p
Posts: 219

Original Poster
Rep: Reputation: 30
I figured out my error last night, silly little math error, i was incrementing by the wrong value.

and I was following the CCNA examples on how to do this strait from there curiculum wich showed borrowing 3 bits would leave me 5 left and i would take 2 the 5th power to find out how much to increment by, but what i should of done was just add up the left over bits places to get 31 instead of 32.

But the CCNA does say that the first and last subnet as well as the first and last address in every subnet will not be usable.

But thanks for the help and here is the text I was following

Code:
tep 1 – IP Address Basics.

    Explanation: IP network addresses are assigned by the Internet Network Information Center (InterNIC). If your organization has a class "A" IP network address, the first octet (8 bits) is assigned be InterNIC and your organization can use the remaining 24 bits to define up to 16,777,214 hosts on your network. This is a lot of hosts! It is not possible to put all of these hosts on one physical network without separating them with routers and subnets. A workstation may be on one network or subnet and a server may be on another network or subnet. When the workstation needs to retrieve a file from the server it will need to use its subnet mask to determine the network or subnet that the server is on. The purpose of a subnet mask is to help hosts and routers determine the network location where a destination host can be found. Refer to the following table to review IP address classes, default subnet masks and the number of networks and hosts that can be created with each class of network address.
    Cls 	1st Octet Decimal Range 	1st Octet High Order Bits 	Network / Host ID (N=Network, H=Host) 	Default Subnet Mask 	Number of Networks 	Hosts per Network (usable addresses)
    A 	1 – 126* 	0 	N.H.H.H 	255.0.0.0 	126 (27 – 2) 	16,777,214 (2 24 – 2)
    B 	128 – 191 	1 0  	N.N.H.H 	255.255.0.0 	16,382 (214 - 2) 	65,534 (2 16 – 2)
    C 	192 – 223 	1 1 0 	N.N.N.H 	255.255.255.0 	2,097,150 (221 – 2) 	254 (2 8 – 2)
    D 	224 – 239 	1 1 1 0 	Reserved for Multicasting
    E 	240 – 254  	1 1 1 1 0 	Experimental, used for research


Step 2 – The "ANDing" process.

    Explanation:  Hosts and routers use the "ANDing" process to determine if a destination host is on the same network or not. The ANDing process is done each time a host wants to send a packet to another host on an IP network. If you want to connect to a server, you may know the IP address of the server you want to connect to or you may just enter the host name (e.g. www.cisco.com) and a Domain Name Server (DNS) will convert the host name to an IP address. First the source host will compare (AND) its own IP address to its own subnet mask. The result of the ANDing is to identify the network where the source host resides. It will then compare the destination IP address to its own subnet mask. The result of the 2nd ANDing will be the network that the destination host is on. If the source network address and the destination network address are the same they can communicate directly. If the results are different then they are on different networks or subnets and will need to communicate through routers or may not be able to communicate at all.

    ANDing depends on the subnet mask. A default subnet mask for a Class C network is 255.255.255.0 or 11111111.111111111.111111111.00000000. This is compared to the source IP address bit for bit. The first bit of the IP address is compared to the first bit of the subnet mask and the second bit to the second etc. If the two bits are both ones, then the ANDing result is a ONE. If the two bits are a zero and a one or two zeros then the ANDing result is a ZERO. Basically this means that a combination of 2 ones results in a ONE, anything else is a zero. The result of the ANDing process is the network or subnet number that the source or destination address is on. 


Step 3 – Two Class C networks using the default subnet mask.

    Explanation:  This example will show how a Class C default subnet mask can be used to determine which network a host is on. A default subnet mask does not break an address into subnets. If the default subnet mask is used then the network is not being "subnetted". Host X (source) on network 200.1.1.0 has an IP address of 200.1.1.5 and wants to send a packet to host Z (destination) on network 200.1.2.0 and has an IP address of 200.1.2.8. All hosts on each network are connected to hubs or switches and then to a router. Remember that with a Class C network address ARIN (American Registry for Internet Numbers) assigns the first 3 octets (24 bits) as the network address so these are two different class C networks. This leaves one octet (8 bits) for hosts so each class C network could have up to 254 hosts (2^8 power = 256 – 2 = 254).

    The ANDing process will help the packet get from host 200.1.1.5 on network 200.1.1.0 to host 200.1.2.8 on network 200.1.2.0 using the following steps.

       1. Host X compares its own IP address to its own subnet mask using the ANDing process

        Host X IP address 200.1.1.5 	11001000.00000001.00000001.00000101
        Subnet Mask 255.255.255.0 	11111111.11111111.11111111.00000000
        ANDing Result (200.1.1.0) 	11001000.00000001.00000001.00000000

        NOTE: The result of step 3a of the ANDing process is the network address of host X which is 200.1.1.0 

       2. Next host X compares the IP address of the Host Z destination to its own subnet mask using the ANDing process.

          Host Z IP address 200.1.2.8 	11001000.00000001.00000010.00001000
          Subnet Mask 255.255.255.0 	11111111.11111111.11111111.00000000
          ANDing Result (200.1.2.0) 	11001000.00000001.00000010.00000000

        NOTE: The result of step3b ANDing process is the network address of host Z which is 200.1.2.0.

        Host X compares the ANDing results from step A and the ANDing result from step B and they are different. Host X now knows that host Z is not in its Local Area Network (LAN) and it must send the packet to its "Default Gateway" which is the IP address of the router interface of 200.1.1.1 on network 200.1.1.0. The router will then repeat the ANDing process to determine which router interface to send the packet out.

Step 4 – One Class C network using a Custom subnet mask.

    Explanation:  This example uses a single Class C network address (200.1.1.0) and will show how a class C custom subnet mask can be used to determine which subnetwork (or subnet) a host is on and to route packets from one subnetwork to another. Remember that with a class C network address ARIN assigns the first 3 octets (24 bits) as the network address. This leaves 8 bits (one octet) for hosts so each class C network could have up to 254 hosts (2^8 power = 256 – 2 = 254).

    Perhaps you want less than 254 host (workstations and servers) all on one network and you want to create 2 sub-networks and separate them with a router for security reason or to reduce traffic. This will create smaller independent broadcast domains and can improve network performance and increase security since these subnetworks will be separated by a router. Assume you will need at least 2 subnetworks and at least 50 hosts per subnetwork. Since you only have one Class C network address you have only 8 bits in the fourth octet available for a total of 254 possible hosts, you must create a Custom Subnet mask. You will use the custom subnet mask to "BORROW" bits from the host portion of the address. The following steps will help accomplish this:

       1. The first step to "subnetting" is to determine how many subnets are needed. In this case you will need 2 subnetworks. To see how many bits you should borrow from the host portion of the network address, add the bit values from right to left until the total (decimal value) is greater than the number of subnets you will need. Since we need 2 subnets, add the one bit and the two bit which equals three. This is over the number of subnets we need, so we will need to borrow at least two bits from the host address starting from the left side of the octet that contains the host address.

        Network address: 200.1.1.0 								
        4th octet Host address bits: 	1 	1 	1 	1 	1 	1 	1 	1
        Host address bit values (from right) 	128 	64 	32 	16 	8 	4 	2 	1

        (Add bits starting from the right side (the 1 and the 2) until you get more than the number of subnets needed)

       2. Once we know how many bits to borrow we take them from the left side of the first octet of the host address. Every bit we borrow from the host leaves fewer bits for the hosts. Even though we increase the number of subnets, we decrease the number of hosts per subnet. Since we need to borrow 2 bits from the left side, we must show that new value in our subnet mask. Our existing default subnet mask was 255.255.255.0 and our new "Custom" subnet mask is 255.255.255.192. The 192 comes from the value of the first two bits from the left (128 + 64 = 192). These bits now become 1s and are part of the overall subnet mask. This leaves 6 bits for host IP addresses or 2^6 = 64 hosts per subnet.

          4th Octet borrowed bits for subnet: 	1 	1 	1 	1 	1 	1 	1 	1
          Subnet bit values: (from left side) 	128 	64 	32 	16 	8 	4 	2 	1

        With this information you can build the following table. The first two bits are the Subnet binary value. The last 6 bits are the host bits. By borrowing 2 bits from the 8 bits of the host address you can create 4 subnets with 64 hosts each. The 4 networks created are the "0" net, the "64" net, the "128" net and the "192" net. The "0" net and the "192" net are considered unusable. This is because the "0" net has all zeros in the subnet portion of the address and the 192 net has all ones in the subnet portion of the address.
        Subnet No.  	Subnet bits borrowed Binary value 	Subnet bits Decimal Value 	Host bits possible binary values (range) (6 bits) 	Subnet / Host Decimal range 	Useable?
        Subnet #0 	00 	0 	000000 – 111111 	0 – 63 	NO
        Subnet #1 	01   	  	64 000000 – 111111 	64 – 127  	YES
        Subnet #2 	10    	  	128 000000 – 111111 	128 – 191 	YES
        Subnet #3 	11  	  	192 000000 – 111111  	192 – 254  	NO

        Notice that the first subnet always starts at 0 and, in this case, increases by 64 which is the number of hosts on each subnet. One way to determine the number of hosts on each subnet or the start of each subnet is to take the remaining host bits to the power of 2. Since we borrowed two of the 8 bits for subnets and have six bits left, the number of hosts per subnet is 2^6 or 64. Another way to figure the number of host per subnet or the "increment" from one subnet to the next is to subtract the subnet mask value in decimal (192 in the fourth octet) from 256 (which is maximum number of possible combinations of 8 bits) which equals 64. This means you start at 0 for the first network and add 64 for each additional subnetwork. If we take the second subnet (the 64 net) as an example the IP address of 200.1.1.64 cannot be used for a host ID because it is the "network ID" of the "64" subnet (host portion is all zeros) and the IP address of 200.1.1.127 cannot be used because it is the broadcast address for the 64 net (host portion is all ones).

Last edited by Gortex; 12-29-2007 at 02:34 PM.
 
Old 12-29-2007, 10:41 PM   #5
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 48
Yeah, there is a very sharp double-edged sword with any type of certification. A CCNA isn't a joke, but there are somethings about it that just aren't practical, like this subnetting for example. What is confusing is that you don't have to lose subnets at all. I work for an ISP, and like the example, we often break a full 255.255.255.0 subnet up into parts, and regardless of the size of those subnets, we don't lose any of them to subnetting. You can divide a 255.255.255.0 block into 255.255.255.192 blocks, and use all 4 of them, yet the CCNA says you can't. Since it is their test and their certification, it obviously is best to use their answers, but that doesn't change the fact that they seem to be wrong in this case.

In any case, best of luck to you, and once you get certified, do your best to forget all of it, and learn the way it actually "works".

That being said, I can attest that nobody in the company I work for has any cisco certification, yet we've been up and online for at least the past 10 years.

Peace,
JimBass
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
question about IP address and subnet mask 2007fld Linux - Networking 4 03-28-2007 11:00 AM
Very simple subnet question lukameen Linux - Networking 5 11-02-2005 02:40 PM
a /27 within a /24 subnet arnix Linux - Networking 1 07-16-2003 09:16 PM
NAT'd subnet routing question ealpert1 Linux - Networking 10 05-19-2003 02:07 PM
Can IP from different subnet be configured on another subnet russell Linux - Networking 1 08-23-2002 01:47 AM


All times are GMT -5. The time now is 05:24 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration