PacktPublishing / Linux-for-Networking-Professionals

Linux for Networking Professionals, published by Packt
MIT License
218 stars 11 forks source link

Issue on subnet calculation #2

Open nilend opened 2 years ago

nilend commented 2 years ago

I think in the IPv4 addresses and subnet masks section in chapter 02, there is a wrong calculation for number of IPs. For 0-15 in the third octet we have 16 hosts and for 0-255 we have 256. So the right calculation should be (16 256) -2 which is 4094 not (15 254) -1. The reason for -2 is, in addition to broadcast address we need to remove the subnet address too.

shubham763 commented 2 years ago

Hi @nilend

Yes, this is already noted by a previous reader, and answered Unless you are using NAT, you have to account for the network and broadcast addresses, so it’s the binary calculation minus two.

Regards, Shubham

nilend commented 2 years ago

Yes, this is already noted by a previous reader, and answered

Thanks, Where we can find such errata page? I didn't find any Q/A section

robvandenbrink commented 1 year ago

Correct, it’s generally “-2” from the binary calculation

If you are using it in a NAT situation you can use “-1”, since there’s usually no broadcast address, you can think of them as all single /32 addresses, and as far as the upstream router goes they are routed on the other side of the physical address

======== Rob VandenBrink 519-589-1881

On Jun 12, 2022, at 8:02 AM, Mostafa Fekri @.***> wrote:



I think in the IPv4 addresses and subnet masks section in chapter 02, there is a wrong calculation for number of IPs. For 0-15 in the third octet we have 16 hosts and for 0-255 we have 256. So the right calculation should be (16 256) -2 which is 4094 not (15 254) -1. The reason for -2 is, in addition to broadcast address we need to remove the subnet address too.

— Reply to this email directly, view it on GitHubhttps://github.com/PacktPublishing/Linux-for-Networking-Professionals/issues/2, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD7CAU4KTRV5MDBD4VKQ4O3VOXGV5ANCNFSM5YRUFUEQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>