Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i have a small question ... i feel 2

Status
Not open for further replies.

nivasi

ISP
Jan 7, 2003
9
IN
i have a small question ... i feel like it is hard to understand ip addressing ... and i need any advise on this problem ... so would u please reply me and tell me spme tips that would help me in ip addressing and sub netting with in few few min..ok for example i need 50 hosts in my network wich subnet will support .

Regds

nivas
 
If you have a choice of networks, and are starting from scratch - it's easy.
Just choose to use the range 192.168.1.0 through 192.168.1.255
The subnet mask for this would be 255.255.255.0
The first available IP address would be 192.168.1.1 and the last would be 192.168.1.254 (1-254)
If you are setting up a DHCP server, you need to make sure that you set aside some addresses for static IP's. Things like printers and servers and an IP Office system would need to be static.
In any DCHP server you can specify the address range to give out. So, start at 192.168.1.100 through 192.168.1.199 This will give you plenty of IPs to play with both static and in the DHCP scope.
Put your router/firewall on 192.168.1.1, your IP office on 192.168.1.2, your Voicmail server on 192.168.1.3 and etc.

 
To understand IP Addressing you need to understand the role of the Subnet mask. To do this you need to be able to count in binary (or use a calc)
The subnet mask is a mask used to determine which section of the address identifies your network (subnet), and which your host. What we see is the decimal value for a 32bit binary code, sectioned into 4 octets of 8 bits each. Your mask specifies the network by the 1's and your host by the 0's. An example:

IP Address: 192.168.42.2
Subnet Mask: 255.255.255.0

Binary IP Address: 11000000.10101000.00101010.00000010
Binary Subnet Mask: 11111111.11111111.11111111.00000000
<-Network----.-Host-->

From this we can see that our subnet address is 192.168.42.0 and your host identifier is 2. Using your subnet mask, any packets destination's network address is compared to your own network address. If they are the same, the device sends an rap request for the MAC address of the destinations interface, otherwise, it is sent to your default gateway (or any corresponding route in it's routing table) which in turn will send it to the next gateway, and so on until its reached the destination host.

There are three classes of ip addresses:

ClassA = 255.0.0.0 (11111111.00000000.00000000.00000000)
ClassB = 255.255.0.0 (11111111.11111111.00000000.00000000)
ClassC = 255.255.255.0 (11111111.11111111.11111111.00000000)

The classic ClassC network allows for 254 hosts, restricted to the 8 bits allocated for hosts in the final octet. You may wonder why only 254, not 255. As with subnets, you cannot have a host address all ones or all zeros, as this is used as a broadcast address for the whole subnet, and cannot specify a particular host. Sometimes you may want to allow for more hosts, or as in your case nivasi, less hosts to accommodate more subnets. All you do is then move where the 1's meet the 0's within the subnet mask i.e.

11111111.11111111.11111111.11110000
255 . 255 . 255 . 240

This is now a submitted ClassC network. Having allocated more bits to identify subnet, you have fewer bits to specify hosts. In this particular scenario you are only aloud 13 hosts on this network. How did I get that figure? Easy take the bits in the subnet mask allocated to hosts, change them to 1's and convert to decimal. In the example above, the last four bits specify hosts, so the decimal of 1111 is 15. I then need to subtract 2 (Used for the network and broadcast addresses). This leaves me with 13 usable hosts on each subnet when using the mask 255.255.255.240

This can be worked backwards, for example, you need 50 hosts on your network. Ok add 2 to the number of host you require (for network and broadcast addresses) = 52. Take a binary value that consists of just 1's, and who's decimal equivalent is larger than 52. i.e.

1111 = 15 (two few bits)
11111 = 31 (Closer, but not there yet)
111111 = 63 (OK, that will accommodate my 52 hosts)

Convert the 1's to 0's (because hosts are specified by 0's) and working from right to left complete the mask:

11111111.11111111.11111111.11000000
^
¦
111111 = 000000 -----------------¦

So my subnet mask is: 255.255.255.192 (binary of 11000000)

So my network address of 192.168.42.0 mask of 255.255.255.192, I can have host addresses range of 192.168.42.1 - 192.168.41.62.
You can use this same method to allocate a certain number of subnets. The difference is that you do not need to convert the 1's to 0's because the mask uses 1's to specify subnets and you work from left to right.

This should have hopefully helped with your understanding of IP addressing. Good luck, There is a whole world of TCP/IP beyond this :))


 
This is an article if from a little company that just happens to focus on &quot;IP&quot; called Cisco.

This document will give you basic information you'll need to configure your router for routing IP, such as how addresses are broken down and how subnetting works. You'll learn how to assign each interface on the router an IP address with a unique subnet. And don't worry, we'll show you lots of examples to help tie everything together.

If definitions are helpful to you, here's some wirehead vocabulary to get you started.

Address -- the unique number id assigned to one host or interface in a network
Subnet -- a portion of a network sharing a particular subnet address
Subnet mask -- a 32-bit combination used to describe which portion of an address refers to the subnet and which part refers to the host
Interface -- a network connection
If you have already received your legitimate address(es) from the InterNIC (Internet Network Information Center), you are ready to begin. If you are not planning on connecting to the Internet, we strongly suggest that you use reserved addresses from RFC 1597. You can access RFCs via ftp nic.ddn.mil. Please see the introduction in any Cisco Hardware and Installation Guide for instructions on obtaining RFCs.

Understanding IP Addresses

An IP address consists of four octets (1 octet = 8 bits), or 32 bits. The value in each octet ranges from 0 to 255 decimal, or 00000000 - 11111111 binary. Here's how binary octets convert to decimal:

1 1 1 1 1 1 1 1
128 64 32 16 8 4 2 1 (128+64+32+16+8+4+2+1=255)

Now here's a sample octet conversion:

0 1 0 0 0 0 0 1
0 64 0 0 0 0 0 1 (0+64+0+0+0+0+0+1=65)

And this is a sample address representation (4 octets):

10. 1. 23. 19 (decimal)
00001010.00000001.00010111.00010011 (binary)

These octets are broken down to provide an addressing scheme that can accommodate large and small networks. There are five different classes of networks, A to E. Here, we'll only be addressing classes A to C, since classes D and E are reserved. To determine the class of an address, look at the first octet of the dotted-decimal address.

Class A: 1 - 126 (eg. 10.1.23.19)
Class B: 128-191 (eg. 172.16.19.48)
Class C: 192-223 (eg. 193.18.9.10)

In a class A address, the first octet is the network portion, so the class A example above has a major network address of 10. Octets 2, 3, and 4 (the next 24 bits) are for the network manager to divide into subnets and hosts as she sees fit. Class A addresses are used for networks that have more than 65,536 hosts (actually, up to 16,581,375 hosts!).

In a class B address, the first two octets are the network portion, so the class B example above has a major network address of 172.16. Octets 3 and 4 (16 bits) are for local subnets and hosts. Class B addresses are used for networks that have between 256 and 65,536 hosts.

In a class C address, the first three octets are the network portion. The class C example above has a major network address of 193.18.9. Octet 4 (8 bits) is for local subnets and hosts - perfect for networks with less than 256 hosts.

Understanding Subnetting

In order to use your addresses, you need to understand subnetting. Subnetting allows you to create multiple logical networks that exist within a single Class A, B, or C network. If you don't subnet, you will only be able to use one network from your Class A, B, or C network. Unless you have been assigned many major networks, you really need to subnet.

Each data link on a network must be a unique subnet, with every node on that link being a member of the same subnet. For serial interfaces (standard HDLC), you will need one subnet for the circuit, or &quot;wire&quot; (both ends of the serial connection will be in the same subnet). If you are planning on implementing Frame Relay, SMDS, X.25 etc, read the Router Products Configuration and Reference Guides for assistance in configuring.

A subnet mask is defined for each IP address. The subnet mask identifies which portion of the 4 octets is used to identify the data link, with the remaining bits identifying the node. If you want no subnetting, use these default masks (255 - strictly follow number, 0 - wildcard):

Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0

Let's use these two addresses for some examples: 171.68.3.3 and 171.68.2.3. If the subnet mask is 255.255.255.0, the first 24 bits are masked, so the router compares the first 3 octets of the two addresses. Since the masked bits are not the same, the router knows that these addresses belong to different subnets.

If the subnet mask is 255.255.0.0, the first 16 bits are masked, so the router compares the first 2 octets of the two addresses. Since the masked bits are the same, the router knows that these addresses belong to the same subnet.

Nodes and routers use the mask to identify the data link on which an address resides. For instance, imagine that San Francisco proper is a class B network, and think of the streets as subnets. Each street must have a unique name. How would the postal service deliver a letter or find the correct destination if there were two Lombard Streets? Each house number can be thought of as a unique identifier for that street. The house numbers themselves can be duplicated on other streets: 33 Market Street is not the same as 33 Van Ness Avenue.

San Francisco.Lombard.33
171.68. 3. 3
San Francisco.Market.33
171.68. 2. 3

Sometimes you need to perform a logical &quot;AND&quot; operation to find out what subnet your node is in. Performing an &quot;AND&quot; operation means that anytime you &quot;AND&quot; a 0 value to another 0 or a 1 value, the result is 0. Only a 1 ANDed with another 1 value will result in a 1 value. Here's how it works:

0 AND 0 IS 0
0 AND 1 IS 0
1 AND 1 IS 1

Let's compare our sample addresses (171.68.3.3 and 171.68.2.3) against the subnet mask 255.255.240.0. We need to compare the binary representation of the third octet of the mask with the binary representation of the third octets of the addresses. In order to do this, we'll perform a logical &quot;AND&quot; operation on the corresponding bits in each octet.

The masked bits are those that are &quot;turned on,&quot; or 1 in the mask. Since the masked bits in both addresses are the same, the router knows that these addresses belong to the same subnet.

Let's See Some Examples

Example 1: Class B

Let's use a class B address to illustrate how subnetting works. Let's say you were assigned the class B address 172.16 from the NIC. First determine how many subnets you need, and how many nodes per subnet you need to define. A typical (and easy to use) class B subnet mask would be 8 bits. Since the 3rd octet is the first &quot;free&quot; octet for Class B, you will start there. So, an 8 bit subnet mask would be 255.255.255.0. This means you have 254* subnets available and 254 addresses for nodes per subnet.

*Why are there only 254 subnets available instead of 256 (0-255)? You should not use subnet 0 or a subnet of all 1s. With an all 1s subnet mask, this is also your broadcast address. You can configure this, but it is neither proper nor recommended to make your subnet the same as your broadcast address. Subnet 0 is also not recommended. Cisco will allow the use of subnet 0 with the IP subnet zero command.

Example 2: Class B

Now let's take this example: you have just assigned an interface the address 172.16.10.50 with a mask of 255.255.255.0. What subnet is it in? First represent the bits in binary (for class B, you start with the 3rd octet since octets 1 and 2 are fixed).


SUBNET HOST
00001010 00110010 (address representation - 10.50)
11111111 00000000 (subnet mask representation - 255.0)
-----------------
00001010 00000000 (results of logical &quot;AND&quot; - subnet 10)

This address is in subnet 10 (172.16.10.0). Valid addresses for subnet 10 would be 172.16.10.1 through 172.16.10.254. Address 172.16.10.255 is the broadcast address for this subnet. According to the standard, any host id consisting of all 1s is reserved for broadcast.

Example 3: Class B

Let's say you have a need for more subnets than 254. (Remember this is the maximum number of subnets in a single octet.) Sticking with our class B address, let's configure an 11 bit subnet. This means we will use all 8 bits from our 3rd octet and the first three bits from the 4th octet. The subnet mask is now 255.255.255.224 (128+64+32=224). Now you need to find out what subnet the following address is in: 172.16.10.170 255.255.255.224. First, denote the address in binary representation (just octets 3 and 4 for a class B address) like this:


00001010 10101010 (address representation 10.170)
11111111 11100000 (subnet mask representation 255.224 through
the first 11 bit subnet)
-----------------
00001010 10100000 (results of logical &quot;AND&quot;) 10 160


So, the address here is in subnet 172.16.10.160. The valid addresses for this subnet are 172.16.10.161 through 172.16.10.190 (.191 is the broadcast address). As soon as you hit 10.192, the bits in the subnet change and you move into subnet 10.192.

Example 4: Class B

Let's take an example where the mask is shorter than one octet. Now we want only a few subnets, but need many hosts per subnet. We'll use a 3 bit subnet mask. Now we have: 172.16.65.170 255.255.224.0 (the mask is now the first 3 bits of the 3rd octet). What subnet is this address in?


01000001 10101010 (address representation 65.170)
11100000 00000000 (subnet mask representation 224.0)
-----------------
01000000 00000000 (results of logical &quot;AND&quot; - subnet 64)64

So the subnet here is 172.16.64.0. The range of addresses that would fall into subnet 64 would be 172.16.64.1 - 172.16.95.254 with 172.16.95.255 as the broadcast address. The next subnet would be 172.16.96.0. Class A and class C map out exactly as class B. The only differences are at which octet subnetting starts and how many octets you can use for subnetting.

Example 5: Class C

Suppose the NIC assigned the address 192.1.10. You will need to use the 4th octet for your subnetting needs. Let's use a 4 bit subnet mask and map out the following address: 192.1.10.200 255.255.255.240

11001000 (address representation for 200)
11110000 (subnet mask representation for 240)
--------
11000000 (results of logical &quot;AND&quot; - 128+64=192)

So, address 192.1.10.200 is in subnet 192. The valid range of addresses in this subnet would be 192.1.10.192 through 192.1.10.206, with .207 as the broadcast address. The next subnet would be .208.

Keeping the same subnet mask, you can choose different addresses to be in different subnets. For instance, address 192.1.10.17 255.255.255.240 is in subnet 16 and therefore has another unique subnet address, with valid addresses in the range of 192.1.10.17 through 192.1.10.30.

Appendix

Sample Config

(routers A and B are connected via serial interface)

Router A

hostname routera
!
ip routing
!
int e 0
ip address 172.16.50.1 255.255.255.0
!(subnet 50)
int e 1 ip address 172.16.55.1 255.255.255.0
!(subnet 55)
int t 0 ip address 172.16.60.1 255.255.255.0
!(subnet 60) int s 0
ip address 172.16.65.1 255.255.255.0 (subnet 65)
!S 0 connects to router B
router rip
network 172.16.0.0

Router B

hostname routerb
!
ip routing
!
int e 0
ip address 192.1.10.200 255.255.255.240
!(subnet 192)
int e 1
ip address 192.1.10.66 255.255.255.240
!(subnet 64)
int s 0
ip address 172.16.65.2 (same subnet as router A's s 0)
!Int s 0 connects to router A
router rip
network 192.1.10.0
network 172.16.0.0

Host/Subnet Quantities Table

Class B Effective Effective
# bits Mask Subnets Hosts
------- --------------- --------- ---------
2 255.255.192.0 2 16382
3 255.255.224.0 6 8190
4 255.255.240.0 14 4094
5 255.255.248.0 30 2046
6 255.255.252.0 62 1022
7 255.255.254.0 126 510
8 255.255.255.0 254 254
9 255.255.255.128 510 126
10 255.255.255.192 1022 62
11 255.255.255.224 2046 30
12 255.255.255.240 4094 14
13 255.255.255.248 8190 6
14 255.255.255.252 16382 2

Class C Effective Effective
# bits Mask Subnets Hosts
------- --------------- --------- ---------
2 255.255.255.192 2 62
3 255.255.255.224 6 30
4 255.255.255.240 14 14
5 255.255.255.248 30 6
6 255.255.255.252 62 2

*Subnet all zeroes and all ones excluded.
*Host all zeroes and all ones excluded.
Thank you,
Frank Mirecki
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top