0

I want to create two IP addresses, 192.168.1.0/30 and 192.168.1.5.

Adding the first IP for the router port returns this error "Bad mask /30 for address 192.168.1.7":

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#in
Router(config)#interface fa 0/0
Router(config-if)#ip add
Router(config-if)#ip address 192.168.1.7 255.255.255.252
Bad mask /30 for address 192.168.1.7
Router(config-if)#
Greg Askew
  • 39,132

2 Answers2

7

With 192.168.1.7 255.255.255.252, the addresses range from 192.168.1.4 - 192.168.1.7.

192.168.1.4 is the network address. 192.168.1.7 is the broadcast address.

You cannot apply either of those 2 addresses as an interface address.

With that range & mask, your only usable IP addresses are 192.168.1.5 & 192.168.1.6.

For 192.168.1.0/30, the address range is 192.168.1.0 - 192.168.1.3.

192.168.1.0 is the network address. 192.168.1.3 is the broadcast address.

The only usable IP addresses are 192.168.1.1 & 192.168.1.2.

Bob Goddard
  • 241
  • 1
  • 3
  • 7
3

/30 uses the lower two bits as the host part. As with all IPv4 subnets, the all-zero ..00 address and the all-one ..11 (subnet directed broadcast) address aren't usable for hosts.

192.168.1.7 means 00000111 in the last octet, so that's the directed broadcast address for the 192.168.1.4/30 subnet. Usable for hosts are only 192.168.1.5 and 192.168.1.6.

192.168.1.0/30 is an adjacent subnet with the usable addresses 192.168.1.1 and 192.168.1.2.

For point-to-point links you should prefer /31 subnets where both addresses are usable for hosts and there's no (useless) broadcast and no 50% address waste.

Zac67
  • 13,684