Is subtracting 2 from subnet ID necessary? - networking

The address of a class B host is to be split into subnets with a 6-bit subnet number. What is the maximum number of subnets and the maximum number of hosts in each subnet?
62 subnets and 262142 hosts.
64 subnets and 262142 hosts
62 subnets and 1022 hosts.
64 subnets and 1022 hosts.
My attempt :
In class B network ID is 16 bits. Given 6 bits for subnet ID, so remaining bits for host ID is = 32- (16+6) = 10 bits.
Maximum number of hosts in each subnet = 2^(number of bits for hosts) - 2(all 0's and all 1's not allowed in hosts IDs, because first is subnet ID while last is broadcast ID) = 2^10 - 2 = 1022.
I've read somewhere :
Subtracting 2 from host IDs is necessary while subtracting 2 from
subnet IDs is not necessary.
So, maximum number of subnet IDs is = 2^(number of bits for subnet ID) - 2(not compulsory) = 2^6 = 64 is maximum.
Can you explain please, Is subtracting 2 from subnet ID necessary?

Many years ago, you had to subtract 2 from the number of subnets, and older network documentation and training still states this. This was clarified in an RFC to not be the case. With the IPv4 address shortage, you need to be able to use every subnet available.
FYI, there is one exception to the rule about not using the subnet and broadcast addresses for hosts: you can use a /31 subnet for point-to-point links. The RFC which clarifies this is 15 years old, but many people still use /30 thinking it is the smallest subnet available. Using /31 will double the number of point-to-point links which you can have.

Related

How to check if a given IP # is a subnet # address?

Is there a way to check if a given IP address is a subnet IP address ?
For example :
16.100.134.0 /19
this IP address is a subnet ip address (I saw it in the solution ) but I still don't know how they figure it out.
The /19 at the end tells you that this is a subnet address.
A complete IPV4 address is 4 lots of 8 bits or octets (each shown as a decimal in the range 0 -255) so 32 bits long. /19 tells you that this is the address of a subnet where the first 19 bits are reserved for the network and subnet address and the remaining 13 are for hosts within the subnet. A subnet means that part of the host space has been used to divide up the network into smaller networks. In this case the network address may be 16.100.0.0 /16 and the subnet uses the first 3 significant bits of the host space to split it into up to 8 subnets.
So that 13 bits means up to 2¹³-1 different IP addresses available - the last octet can take values between 0 and 255, and the second last between 134 + 0 and 134 + 31
It's maybe easier to see that in binary. The address you have there is 00010000.01100100.10000110.00000000 and valid IP addresses should be in the range 00010000.01100100.10000000.00000000 and 00010000.01100100.10011111.11111111 which makes me think you have the address of a host in the subnet - the subnet address would have all 0s for the 13 least significant bits, meaning the third octet would only have it's 3 most significant bits available ie it would have a value one of 0, 32, 64, 128, 96, 192 or 224

How do I determine that the subnet was going to be .11.254 and .13.254?

I figured out the subnet mask for both subnets 1 and 2. My problem is I can't grasp how the subnet turns to 172.20.11.254 and 172.20.13.254 respectively? I assume this is VSLM, but not certain. I'm just learning this. I got 172.20.8.0 and 172.20.6.0 as my subnet and I know that is wrong now. Thanks for any help you can provide.
To determine which subnet mask will work for the 172.20.0.0 network, first look at the number of hosts required for each subnet:
Subnet1 (connected to FastEthernet0/0) has 672 hosts. To support 672 hosts, a subnet mask of /22 is required (10 host bits in the 2n-2 formula will afford 1022 host addresses in the subnet).
Subnet2 (connected to FastEthernet0/1) has 258 hosts. To support 258 hosts, a subnet mask of /23 is required (9 host bits in the 2n-2 formula will afford 510 host addresses in the subnet).
With a network address of 172.20.0.0 and the masks needed to fit the requirements, you need to configure the following IP address and subnet masks:
For the FastEthernet0/0 connection:
172.20.8.0/22 is the third possible subnet. (172.20.0.0/22 is the first possible subnet and 172.20.4.0/22 is the second possible subnet.)
172.20.11.254 is the last possible IP address in the subnet.
255.255.252.0 is the decimal version of a 22-bit mask.
For the FastEthernet0/1 connection:
172.20.12.0/23 is the next available subnet that does not overlap.
172.20.13.254 is the last possible IP address in the subnet.
255.255.254.0 is the decimal version of a 23-bit mask.
Use the following commands to configure the SFO interfaces:
SFO>enable
SFO#configure terminal
SFO(config)#interface FastEthernet0/0
SFO(config-if)#ip address 172.20.11.254 255.255.252.0
SFO(config-if)#no shutdown
SFO(config-if)#interface FastEthernet0/1
SFO(config-if)#ip address 172.20.13.254 255.255.254.0
SFO(config-if)#no shutdown
SFO(config-if)#exit
SFO(config)#exit
SFO#copy run start
I detect some desperation, so let's see if I can convey and understandable explanation. :-)
172.20.0.0 seems to be the address space destined for you to use in this exercise. That is a class B network (255.255.0.0, or /16 netmask), but since we're going to subnet it variably, you can safely forget that. For example, you could subnet all of it it in small, class C subnets (all with a mask of 255.255.255.0, or /24), and if you did you would use 172.20.0.0/24 for one network, 172.20.1.0/24 for another, 172.20.2.0/24 for another, and so on. But if you did that, each subnet would be able to hold no more than 254 hosts (that is because you leave the last octet - 8 bits - for the host portion, and you have to reserve two - the first and last - for the subnet address and the broadcast address: 2^8-2=254).
But 254 hosts is not enough for your needs, since you have requirements for 672 and 258.
If you use a smaller sized mask (meaning larger sized network -> more hosts) like a /23 (255.255.254.0) you now have 9 bits for the host portion, therefore you can acommodate 2^9-2=510 hosts, big enough for 258, but not for 672. So for the latter you will need a /22 network (255.255.252.0), which will leave 10 bits for the host portion thus allowing 2^10-2=1022.
With each bit you reduce in the netmask, you double your network size. So if a /24 goes from 172.20.0.0 to 172.20.0.255 (the single '0' class C network), a /23 goes from 172.20.0.0 to 172.20.1.255 (two class C networks, '0' and '1'). And a /22 goes from 172.20.0.0 to 172.20.3.255 (four class C networks). In each case the first address is considered the network address and is not assigned to any device, and the last one is the broadcast address, and is not assigned either.
So, back to your example, they choose to assign the 3rd /22 network (1st being from 172.20.0.0 to 172.20.3.255, 2nd being from 172.20.4.0 to 172.20.7.255, and 3rd being from 172.20.8.0 to 172.20.11.255) to that particular subnet. So 172.20.8.0/22 it is. And they choose to assign the 7th /23 subnet possible (1st is '0' and '1' class C's, 2nd is '2' and '3' class C's, and so on) to the other subnet. So 172.20.12.0/23 it is for it. Remember that they cannot overlap!
Now, as to why they chose the .254 addresses for the router interfaces, that is just a convention. Router interfaces are usually configured to use either the first usable (.1) IP address or the last usable (.254) IP address in their subnets, at least on the LAN side. Note that your subnets' broadcast addresses are 172.20.11.255 for the /22 and 172.20.13.255 for the /23. In both cases they picked for the router interfaces the address which is one below them, i.e. the last usable address. But it could have been any one in the corresponding range.
Did that help?

Subnet Masking - Is the following calculations right

Had my own self notes which has gone missing in the worst of times. Desperately trying to figure out if I have got the calculations right for subnet masking in the following questions. I have answered them all. Just wish to be sure I got it right.
It is not a help with some outstanding homework. It is for my upcoming exams. Really appreciate any help. Thanks.
Need 5 subnets for class C network. starting ip address is 192.168.0.0
subnet mask is 255.255.255.0
Questions:
1. How bits are borrowed from to make the subnet?
ANS: Borrowed from the host portion of the IP address. In this case we need 5 subnets so it
will be 2 to the power of 3 (Cos 2 to the power of 2 only gives 4 subnets - not enough).
2. How many subnets are now available?
ANS: 8 subnets are available. 2 to the power of 3 is 8.
3.What is the new subnet mask?
ANS: 255.255.255.224
4.How many host addresses available in each subnet?
ANS: 8
5.How many host addresses can be used in each subnet and why?
ANS: 7. 192.168.0.0 is reserved.
6.What is the IP address of each subnet?
192.168.0.0
192.168.0.32
192.168.0.64
192.168.0.96
192.168.0.128
192.168.0.160
192.168.0.192
192.168.0.224
This is really more suited for other StackExchange sites (like ServerFault), but I can help.
1) Correct. Although you may want to specifically mention that since 2^3 (2 to the power of 3) gives you enough subnets (8), then you borrow 3 bits from the host portion of the address. So the new subnet mask is /27 (24+3), or, as you correctly mention in Q3, 255.255.255.224.
2) Correct.
3) Correct. May also be noted as /27.
4) Wrong. Since from the last octet you borrowed 3 bits for subnetting, you only have the last 5 bits for host addresses. That gives you 2^5 = 32 host addresses in each subnet.
5) Wrong. Out of the 32 addresses available, the first from each subnet is reserved as the subnet's network address, and the last one from each subnet is reserved as the subnet's broadcast address. Therefore, you're left with 30 addresses (2^5 - 2) you can actually use in each subnet. For example, in the first of the subnets, 192.168.0.0 is the network address and 192.168.0.31 is the broadcast address. 192.168.0.1 through 192.168.0.30 are usable.
6) Correct.
Let me know if that helps!

VLSM assistance

I have a quick query about using VLSM. I need to adopt a optimized addressing scheme making use of VLSM, I have 3 networks in total connected via two different routers, router 1 has a network of 300 hosts and another network of 25 hosts. Router 1 is connected to router 2 and that has an additional 82 hosts. Would it be possible to do this scheme over two IP addresses?
Lets say my starting IP is 182.20.1.0, how would this work?
You would at least need 4 subnets (between router 1 and 2 you need a /30 subnet). You need to reserve ip addresses for each subnet starting from the subnet with the highest number of hosts.
The number of hosts determines how big your subnets will be. You can have (2^n-2) host for every subnet, having n the number of reserved bits.
So for your first subnet you'll need 9 bits, leaving you with a /23 subnet.
Start over for your next subnet with the next available ip address.

How to calculate IP ranges

Hi would someone be able to assist with the following question? The question is from a past paper in preparation for an exam.
Consider a router that interconnects three subnets: Subnet 1, Subnet 2, Subnet 3. Suppose all of the interfaces in each of these subnets are required to have the prefix 223.1.17/24. Also suppose that subnet 1 is required to support up to 125 different hosts, and subnets 2 and 3 are each required to support up to 60 different hosts.
Provide three network addresses (of the form a.b.c.d/x) that define the beginning of the IP address range for each subnet, and explain your reasoning.
I think the answer is the following, but I'm not sure.
Subnet 1: 223.1.17.1/25
Subnet 2: 223.1.17.128/26
Subnet 3: 223.1.17.193/26
Regards.
Not quite, Network addresses are always the first Addresses in a Subnet, so the answers would be:
223.1.17.0/25, beginning of IP Address Range: 223.1.17.1 (until .126)
223.1.17.128/26, beginning of IP Address Range: 223.1.17.129 (until .190)
222.1.17.192/26, beginning of IP Address Range: 223.1.17.193 (until .254)
Other than that, your CIDR-Subnet Length is correct, 1 needs at least 126 Hosts (- BC and NA), which justifies /25 -> 24 bits for Class C, 1 bit for Subnet and 7 bit(=2^7 = 128 - Broadcast - Network Address = 126) for hosts, No. 2 and 3 need at least 62 Hosts (-BC and NA) each.
You can see that by using a IP calculator. There are many on the net that also show you some more details..
My favorite (including IPv6) is at http://netools.ch

Resources