49

I have network with a range 10.0.0.0/24. This means I have 10.0.0.0 to 10.0.0.255, however I cannot use 10.0.0.0 or 10.0.0.255, but I can use anything between that.

Why is this? The mask 255.255.255.0 implies that the last digit is the host address, so why can't I use 0 or 255?

Toby Speight
  • 5,213
John K
  • 679

6 Answers6

77

In a /24 network you can't use 0 because it is the identification of the network (devices use it to recognize the different networks they are connected to).

In a Windows PC open a Command Prompt and type netstat -r. You will get the routing table used by the PC, each network is listed using the network identification (first address).

enter image description here

The last address, 255 in the case of a /24 network, is the broadcast address. Devices connected to the network use it to send a broadcast, a message intended for all devices on the network.

In general the first address is the network identification and the last one is the broadcast, they cannot be used as regular addresses.

jcbermu
  • 17,822
10

Note that you can not use the first and last address in the range if it is used to number devices in a broadcast domain (i.e. a physical network or a vlan etc.). As the other answer indicates indeed the first and last are used as network and broadcast address respectively in that scenario. In addition in some scenarios the first address is also interpreted as broadcast.

However there are other usage scenarios where you can use the first and last address. E.g. if you are a firewall admin and you are given the 10.0.0.0-10.0.0.255 range by your network admin, then you can use all 256 addresses as NAT addresses on your firewall. I admit that I have not seen this done very often, and when it's done it may cause some confusion - as most people's first reaction is to think it is not allowed - and this confusion may well be a reason to advise against it.

If you're nitpicking then ok, strictly speaking the 10.0.0.0-10.0.0.255 in that scenario is not a /24 network, it's a range or a block of addresses but I believe that it is common practice to still refer to this as "the 10.0.0.0/24 subnet" in such a scenario.

user
  • 30,336
hertitu
  • 316
7

A reading of Internet Standard Subnetting Procedure, Toward an Internet Standard Scheme for Subnetting and specifically BROADCASTING INTERNET DATAGRAMS IN THE PRESENCE OF SUBNETS section 7 describes the rationale for the choices you present.

Your hypothesis is correct for CIDR subnets with continguous bitmasks.

It is easier to regard the broadcast address as Bcast = Host | ~Mask. This explicitly ignores the choice of bits in the subnet. Correspondingly the network address is Net = Bcast & ~Mask.

Strictly, the all zeros (.0 for CIDR/24) address can be used, but could confuse some software, while all ones (.255) is reserved as a well-known broadcast address.

Some early BSD Unix 4.2 releases before RFC 919 were shipped using the Net address as the broadcast. This caused some confusion in mixed environments until the 4.3 release.

Pekka
  • 171
  • 5
2

(For completeness...) In addition note that RFC950 discourages the use of the first and last subnets of a class c sub-netted block. This is because the class c network number xxx.xxx.xxx.0/24 is the same as the first subnet in a class c subnet of that block, such as xxx.xxx.xxx.0/27. The last subnet has the same issue regarding the broadcast address. Thus a /27 class c subnet yields 6 blocks of 30 IP addresses, not 8. Nowadays some routers can handle using the first block, Cisco for example has enabled this in its routers, although it can be disabled. The message is, tread with caution, here be dragons.

1

Network Address

The network for Local area network (LAN) or Wide area network (WAN) is provided with address based on their capacity. The terminals attached to the network use these address to communicate with each other. The system by default reserves some address for the admin communication. Usually “255” addresses are used to broadcast messages in Linux or Fedora systems. The administrator uses this address to broadcast or address all the users of the network. In case of emergency shutdown the administrator can broadcast the message to its users to save their doings. Some operating systems provide facility to assign “0” address.

Find out more about Networking Basics: Network addressing by Microsoft

Also have a look at What is Network Address Translation?

1

From RFC 943 - Assigned numbers (emphasis mine):

Special Addresses:

In certain contexts, it is useful to have fixed addresses with functional significance rather than as identifiers of specific hosts. When such usage is called for, the address zero is to be interpreted as meaning "this", as in "this network". The address of all ones are to be interpreted as meaning "all", as in "all hosts". For example, the address 128.9.255.255 could be interpreted as meaning all hosts on the network 128.9. Or, the address 0.0.0.37 could be interpreted as meaning host 37 on this network.