Is X.Y.Z.0 a valid IP address?

Are IP addresses with a 0 in the last octet valid?

10.6.43.0

In my case, I have the the following netmask

255.255.252.0

What about a 0 for the other octets?


Solution 1:

It depends on the subnet of the IP address in question. In general, the first and last addresses in a subnet are used as the network identifier and broadcast address, respectively. All other addresses in the subnet can be assigned to hosts on that subnet.

For example, IP addresses of networks with subnet masks of at least 24 bits ending in .0 or .255 can never be assigned to hosts. Such "last" addresses of a subnet are considered "broadcast" addresses and all hosts on the corresponding subnet will respond to it.

Theoretically, there could be situations where you can assign an address ending in .0: for example, if you have a subnet like 192.168.0.0/255.255.0.0, you are allowed to assign a host the address 192.168.1.0. It could create confusion though, so it's not a very common practice.

In your example

 10.6.43.0 with subnet 255.255.252.0 (22 bit subnet mask)

means subnet ID 10.6.40.0, a host address range from 10.6.40.1 to 10.6.43.254 and a broadcast address 10.6.43.255. So in theory, your example 10.6.43.0 would be allowed as a valid host address.

Solution 2:

answer to your question depends on the netmask. in general statement 'IP addresses ending in .0 or .255 is invalid' is false. take 10.0.1.0/23 - it's valid ip address.

also 10.6.43.0/255.255.252.0 aka 10.6.43.0/22 is valid.

that was the theory. most reasonable network devices [ including linux servers, windows boxes, cisco / hp / etc ] will work fine with such address, but i've seen dlink and other low-end network appliance [ routers, access points ] not accepting such addresses.

Solution 3:

I found this, which claims that it is valid, depending on your subnet mask.

http://en.wikipedia.org/wiki/IPv4#Addresses_ending_in_0_or_255