# Calculating IPv4 Subnets - Have i got this right?

Discussion in 'The Guru's Pub' started by (.)(.), Feb 3, 2015.

1. ### (.)(.)Banned

Messages:
9,098
0
GPU:
GTX 970
Decimal Binary
IP Address ...| 192.168.10.131 .| 11000000.1010100.00001010.10000011
Subnet Mask | 255.255.255.192 | 11111111.1111111.11111111.11000000

• IP - 11000000.1010100.00001010.10000011
• Sub-11111111.1111111.11111111.11000000
• Nw -11000000.1010100.00001010.10000000. (192.168.10.124) 7 bits for hosts?

If so, the first usable Add is 192.168.10.125 and the last is found by inverting the host portion of the address -10000001 (.125) to 11111110(254).

First - 192.168.10.125
Last - 192.168.10.254

Have I got that right?

2. ### allesclarAncient Guru

Messages:
5,433
21
GPU:
Nvidia GeForce GT 540M
No.

You cannot simply just start midway through a subnet. The address you give is a class C with a prefix notation of /26 or mask "bits".

Wild card mask = 63 as 255.255.255.255 - 255.255.255.192 = 63

Remember that the total number is 64 as we count the value "0" of hosts within a subnet.

With this 64 in total, we know for a /26 prefix there are a maximum of 4 sub nets within this range.

Therefore the address ranges start from:

192.168.10.192 - 0.0.0.64, we are applying the subnet mask here so are only interested in the 4th octet.

Which gives you 192.168.10.128 upto - 192.168.10.191 as a range.

Therefore

Usable host address - 192.168.10.129 - 192.168.10.190

It takes years to be able to do it in your head as i have done. However, there are websites out there that can do it for you.

http://www.subnet-calculator.com/

Subnet chart also here.

Hope that helps?

Last edited: Feb 3, 2015
3. ### scatman839Ancient Guru

Messages:
13,247
36
GPU:
7970m/970 Mini, KD55XD800
.192 has 64 hosts, so you would do blocks up 64

N 0
F 1
L 62
B 63

n 64
f 65
l 126
b 127

n 128
f 129
l 190
b 191

n 192
f 193
l 254
b 255

your ip is in the third block

as mentioned, you can't go between subnets, you go up until you find the first subnet block that is lower than your ip, (128 in this case) then work from there (add 64 for the next network, -1 for broadcast, -2 for last usable)

personally I avoid writing it out in binary and draw up a subnet chart (forum removing extra spacing ugh)

slash notation /25 /26 /27 /28 /29 /30 /31 /32
no of hosts 128 64 32 16 8 4 2 1
subnetmask 128 192 224 240 248 252 254 255

I realise this doesn't work as great if the subnet is for a smaller number of hosts, say, 8 or 4. In that case, get your IP, divide it by your no of hosts (that you find using the subnet mask value given), discard the remainder, then multiply that back by the no of hosts.

e.g
131/64=2.046875
2*64=128

Also, you're probably about to be taught 4-5 subtly different ways of subnetting, pick whatever you find best, I know my method doesn't work for as many people(especially the dividing and remainder stuff). It took me about a year of practise to start getting it done in my head

Your error however was converting 10000000 into decimal wrong, 128 not 124 (not sure how you got there), had you started at 128 you would have been on the right track, but I don't think this is right
never seen that before and in this case it doesn't work, 192 is 11000000

Last edited: Feb 3, 2015
4. ### (.)(.)Banned

Messages:
9,098
0
GPU:
GTX 970
So forth octet being 192, which is a /26 with 64 addresses, I could just -

192 - 64 = 128 + 63 = 191. The NA is .128 then first and last usable are .129 and 190, broadcast as the .191, with the next network starting at .192?

@scatman839
Yeah i dont know where i pulled 124 from. Im using something like you had and doing this, but got 124 in my head instead of 192.

128--64--32--16--8--4--2--1
-1----1---0---0--0--0--0--0 <-------192)

As for the inverting stuff, its in one of the exercises we were given. Theres so many ways of doing it and without warning, the workbook explaining it all changes what method of converting its using when explaining things. So first i have to work out which methods its used (thats not even apart of the god damn exercise/example) before i can understand how the workbook has come to the answer it has in its example.

Last edited: Feb 3, 2015

5. ### allesclarAncient Guru

Messages:
5,433
21
GPU:
Nvidia GeForce GT 540M
Yup.

6. ### scatman839Ancient Guru

Messages:
13,247
36
GPU:
7970m/970 Mini, KD55XD800
bingo
Our lecturer taught us one way, cisco tried to teach us another way, another lecturer apparently teaches a third way.

Basically any time I come across cisco trying to tell me how to subnet again in ccna I just ignore it and use the numbers it gives

It's up to you if you want to try learning the other method, but it might just confuse you further

7. ### (.)(.)Banned

Messages:
9,098
0
GPU:
GTX 970
Yeah thats the issue ive got atm, the lecturer method vs the internal exercises method vs Cisco method.

Im soo tired.

Thanks for that gurus. I'll keep at it.

8. ### VeteranAncient Guru

Messages:
12,090
7
GPU:
2xTitan XM@1590Mhz-CH20
I convert the host portion of the ip address to binary.
Depending on how many bits I need to borrow gives me my subnet mask.
So 3 bits will be 224 subnet mask host portion.
You probably already know this...the subnet mask denotes which part of the ip address belongs to the network and which part of the ip address belongs to the host in laymans terms.

I then covert 224 to binary and then the host portion of the ip address to binary as I said above.

I then use anding with these 2 host portions which will then give me network address. Which I understood as an area code for a row of houses like a zip code or post code.

Depending on how many bits that you borrowed to give you a subnet mask of 224 ie: 3 bits, well you just count these 3 bits from left to right of the andings network address host, any bits after the 3 have been counted from left to right become turned on. Ie:

They become 1's and not 0's therefore you convert these back to decimal and there is your broadcast address. Subnetting is all about practice practice practice. You then use vlsm (variable length subnet mask) and take exactly what you need so you don't waste any bits. This is important later on as many routing protocols will only use vlsm. Working in industry ive yet to actually subnet as most companies we deal with just buy enough ip addresses so 1 ip address does not need to be subnetted. Its been years since ive subnetted and tbh I'm surprised I still remember it as I hardly use I ever.

Of course like others have said there are different ways of doing it. The best way is to draw out your chart as someone said earlier. Once in industry you can just use an ip calculator anyhow if you need too.

Cisco exams need to be done out your head or on the chalk/felt board.

Also packet tracer is ok but with real cisco hardware you have many more commands that packet tracer dors not have.

If your serious about it I would purchase some labs and forget packet tracer in the longterm.

If you think ipv4 is tough which it is for everyone at first. Wait until you try ipv6, that will truely blow your brain.

There is alot to cisco but there are 3 very important fundamentals that you need to master to become a pretty decent network engineer. You need to be very good at subnetting, acl's (access control lists) and vlans. Become good at these and your 75% of the way there but without becoming good at these you may as well forget it.

Last edited: Feb 3, 2015
9. ### (.)(.)Banned

Messages:
9,098
0
GPU:
GTX 970
Thanks Veteran.
Almost word for word what our lecturer said to us today!

Those packet tracers are a bit odd at times. It'll ask you to do something, like assign ip addresses to switch 1 for the first part, but then you go to click on it and it says its locked. Then further down in part 3 it'll say something like "Since Switch 1 is pre configured, just assign the remaining ips manually...". Eh, why didnt you say so at the top, i thought i was doing something wrong:bang:. Oh well.

This command come in handy at times i reckon:
Router#show cdp neighbors detail

10. ### allesclarAncient Guru

Messages:
5,433
21
GPU:
Nvidia GeForce GT 540M
Not just those, you also, for the Cisco exams, need to be **** hot on the commands that are used within the command prompts on Cisco equipment.

11. ### PNeVAncient Guru

Messages:
2,071
0
GPU:
MSI GTX 1070 Armor OC
I remember using Packet Tracer for an assignment at University for a project that involved the setting up and subnetting of an Office Network and it had various requirements such as this Network can access this server, but this Network can't etc.

Long story short, it randomly crashed on me and lost a good chunk of work. No warnings, no errors, nothing. Just closed.

12. ### scatman839Ancient Guru

Messages:
13,247
36
GPU:
7970m/970 Mini, KD55XD800
Had that once while doing a practise skills assessment, never happened before so I didn't even think it possible.

No real autosave in the program, but I was working off scenarios I had already made with 3 stages set up.

13. ### VeteranAncient Guru

Messages:
12,090
7
GPU:
2xTitan XM@1590Mhz-CH20
Someone keeps deleting my posts for some reason.
Anyhow CDP Neighbours i actually turn off on real hardware as it can be a slight security risk. I use it to plan out a network or troubleshoot but i always disable after. Alot of engineers disagree and leave it turned on. Its a 2 way argument both with plausible reasons why to leave enabled and why not too leave enabled.

14. ### TekkMarineMaha Guru

Messages:
1,287
0
GPU:
EVGA 980Ti GTX SC
Cyber Security & Forensics?, Network Administration?

15. ### ManYouNew Member

Messages:
1
0
GPU:
2GB
ipv4 Subnetting

6 bit for host means you have 2^6 - 2 =64 host ip address in a subnet
so your subnet range is 0-63,64-127,128-191,192-255.
every subnet first IP is network ID and last Ip is broadcast ID.

so 192.168.10.0 is subnet id of first subnet
192.168.10.63 is broadcast id of first network

Total number of host ip in one subnet 2^5-2=30
subnet range=0-31,32-63,64-95,...224-255
Its very Simple

Regards,
Christian C

16. ### DarkestAncient Guru

Messages:
10,044
2
GPU:
HD7950
Apparently checking dates and user status isn't.

This thread was posted back in 2015 by a member who has since been banned. I'm not sure why you felt the need to sign up to the forum specifically for this.

Last edited: Jun 3, 2017
17. ### scatman839Ancient Guru

Messages:
13,247
36
GPU:
7970m/970 Mini, KD55XD800
I'm amazed how little I remember of even of subnetting after 2 years of not doing anything networking.

18. ### allesclarAncient Guru

Messages:
5,433
21
GPU:
Nvidia GeForce GT 540M
haha jesus was a good few years ago i wrote that too

Messages:
6,670