3

I know what the magic number of a network is. I know how to compute it - 2 ^ ((32 - n) % 8). I know what it's used for and how to use it.

I don't how how to define it formally. In a recent interview I was left speechless after being asked to deliver a one line definition of the magic number of a network, which made me feel rather stupid.

Aadit M Shah
  • 95
  • 2
  • 8

3 Answers3

5

No need to feel stupid, it is the sort of term that only comes from a text book and not the real world. Everything is derivable from just the IP and subnet mask, you can quite happily be an expert in subnetting without even having heard of it.

It is basically the number not covered by the mask, ie. the number of IP addresses in each subnet. (although remember from that you then lose the network and broadcast addresses)

If you don't want to simply AND the IP with the mask, then you can work out the start of the subnet by writing down multiples of this number. Personaly I find that a long way round.

JamesRyan
  • 8,138
  • 2
  • 24
  • 36
  • The magic number is the number of IP addresses in each subnet if and only if the number of bits for the network id is greater than 24 right? – Aadit M Shah Mar 09 '13 at 01:49
  • For larger networks you simply apply the same technique to the 'interesting' (ie. not 0 or 255) octet. So if it was the 3rd octet then it would be the number of IP addresses divided by 256. – JamesRyan Mar 10 '13 at 01:27
1

For a one sentence answer, I would say: "The magic number is a number used to help determine the network and broadcast addresses for a network, when given just an IP and netmask."

BriGuy
  • 221
  • 3
  • 7
1

The magic number is the number of IP addresses in each subnet.

David Schwartz
  • 31,215
  • 2
  • 53
  • 82