Skip to main content

Question on subnetting

More
18 years 9 months ago #13227 by Kicker
Hello, I'm just learning subnetting and understand it to an extent but I'm having trouble with the "/#" thing.

I'll give you an example of a problem I have:

An ethernet segment has an IP address of 172.16.121.1 /20. How many hosts are possible?


I know that to determine hosts you simply use 2^x, where "x" is the number of host bits right?

I also know that this address would fall under the Class B subnet mask...using Classful addressing.

Can someone help me break down this problem please?
More
18 years 9 months ago #13231 by Dead-Neur0ns
Total Bits = 32 IPv4.

Total Octets =4 Bits Per Octet = 8

/20 represents 20 Bits for the Network Portion. 8 each in First, Second Octet and 4 in the Third Octet.

Total Bits remaining for Hosts = 12

Total Number of Hosts = 2 ^ 12 [Theoritically]. But if all Bits are set to 0 it gives you the Network ID and If all the Bits are set to 1 it becomes a Broadcast.

So you would subtract decimal 2 from 2^ 12 to get the number of Hosts.

<= IИse©u®ity Is A ®esult Of T®ying To Be Se©u®e =>
More
18 years 9 months ago #13232 by havohej
Replied by havohej on topic Re: Question on subnetting
Hi.

the address belongs to the subnet 172.16.112.0 /20
/20 = 255.255.240.0

how??
first write the host address with the /20, /20 = 20 bits for the subnet portion.

so the first and second octets have 16 bits (8 bits each octet)
but we need 20, so we must use only the first 4 bits of the third octet.
as a resulta 16 bits from the first and second octet, plus 4 bits from the second octet we have totally 20 bits.

the next step is to conver the third octet in binary:



128 64 32 16 8 4 2 1
128 192 224 240 248 252 254 255

if you look at the 4 first octets are in blue color, you notice that the mask portion also in blue color ends in a 240.

so we get the result of the mask in the third octet:

255.255.240.0

now that we have the mask, we must know the subnet address to whic the host 172.16.121.1 bolngs to.

In the next step we again write the third octet where we were working bu we must convert the third decimal number (121) into binary.

128 64 32 16 8 4 2 1
128 192 224 240 248 252 254 255
0 1 1 1 1 0 0 1

where the binary 0 1 1 1 1 0 0 1 is the decimal 121

now, if we look only at the first four bits of the binary we look that 0 1 1 1 = 112 decimal

this is how the subnet bits work together with the ip address to determine the subnet address.


so it is the value of the third and how we get the subnet value 172.16.112.0

now for the hosts you can use within this subnet we can work again with binary values:

128 64 32 16 8 4 2 1
128 192 224 240 248 252 254 255
0 1 1 1 0 0 0 0

at this point if we put all zeros in the host portion of the third and fourth octet we we the subnet address 172.16.112.0

for each host you must increment by one sequentially starting from the the last bit of the fourth octet, for exapmle:

third octet:

0 1 1 1 0 0 0 0


fourth octet:

0 0 0 0 0 0 0 0

so for the first host:

third octet:

0 1 1 1 0 0 0 0


fourth octet:

0 0 0 0 0 0 0 1

in decimal = 172.16.112.1

the seconf host:


third octet:

0 1 1 1 0 0 0 0


fourth octet:

0 0 0 0 0 0 1 0

in decimal = 172.16.112.2

for the last host:

third octet:

0 1 1 1 1 1 1 1


fourth octet:

1 1 1 1 1 1 1 0

in decimal = 172.16.127.254


so the complete range of usable host address for the entire subnet address are:
172.16.112.0 /20 network
172.16.112.1 - 172.16.127.254 /20 range of usable hosts
172.16.127.255 /20 broadcast for the subnet.

in the example it looks easy, try to practice a lot.
More
18 years 9 months ago #13238 by Kicker
Replied by Kicker on topic Re: Question on subnetting
Thank you both you really helped clear some things up...

Now i have another question :roll:


*If i'm given an IP address of 192.168.242.50 for network 1

*and an address of 192.168.242.60 for network 2

*both networks use the same subnet mask
(I assume is default class C mask of 255.255.255.0)

*unable to change IP addresses given

would the network ID's and broadcast addresses be the same for both?
More
18 years 9 months ago #13246 by Dead-Neur0ns

Thank you both you really helped clear some things up...

Now i have another question :roll:


*If i'm given an IP address of 192.168.242.50 for network 1

*and an address of 192.168.242.60 for network 2

*both networks use the same subnet mask
(I assume is default class C mask of 255.255.255.0)



If the subnet mask is the same as mentioned, [/24] you basically only have one network and not network 1 and network 2.

If you do a *Logical ANDing* between IP 192.168.242.50 and 255.255.255.0 and

*Logical ANDing* between IP 192.168.242.60 and 255.255.255.0, you would basically get the same Network ID of 192.168.242.0. So the hosts with the IP's would be on the Same Network.




would the network ID's and broadcast addresses be the same for both


Yes. Network ID is 192.168.242.0
Broadcast is 192.168.242.255

<= IИse©u®ity Is A ®esult Of T®ying To Be Se©u®e =>
More
18 years 9 months ago #13248 by Kicker
Replied by Kicker on topic Re: Question on subnetting
well...what if there was a router involved connecting Network 1 and 2...with the same stipulations as my prior post.

*port A (192.168.242.50) and port B (address unknown) on network side 1 and port C (address unkonwn) on network side 2 over the router along with D (address unkown), E (address unkown) and F (192.168.242.60)

*The router interfaces (B & C) should use the highest available host address on the network to which they are connected

*The router interfaces (D & E) should use the lowest available host address on the network to which they are connected
Time to create page: 0.155 seconds