Basic principle of IP networking: every device can directly communicate with all other devices in same (sub)net. To determine if communication peer is in same (sub)net, device takes peer's address, applies own netmask and compares result to result of masking own address. Operation is logical AND. Results of these operations are also known as
network address. If both network addresses are identical, then both devices are in same subnet.
BTW: net mask is set either in address-like notation or in CIDR notation as /xx where xx is number of significant bits set. The way of defining it doesn't affect the arithmetics. Before CIDR, when addresses were strictly divided to classes (A, B or C), network mask was implicitly set by address itself.
Sometimes own network address is set explicitly (and not calculated as in explanation above) and in this case some interesting communications are possible. Peer network address is still calculated.
Example:
calculated network address: logical AND between device address and net mask
own net mask:/23 or 255.255.254.0 -> 11111111.11111111.11111110.00000000
own IP address: 192.168.10.35 -> 11000000.10101000.00001010.00100011
own network address: 11000000.10101000.00001010.00000000 -> 192.168.10.0
peer1 IP address: 192.168.11.254 -> 11000000.10101000.00001011.11111110
peer1 network address: 11000000.10101000.00001010.00000000 -> 192.168.10.0
peer2 IP address: 192.168.12.254 -> 11000000.10101000.00001100.11111110
peer2 network address: 11000000.10101000.00001100.00000000 -> 192.168.12.0
So peer1 is in same subnet while peer2 is not.
Connections between peers in different subnets are only possible via gateways (a.k.a. routers). So device sends packets for peer2 to gateway. Which means that gateway and device have to be in same subnet. Another property of gateways: they are part of at least two subnets (can be as small as /31 or even /32 for point-to-point connections, technically they are still subnets).
DHCP pool: basically tells DHCP server which set of addresses should be used for address leases.
So to question of @SecCon: all addresses in DHCP pool have to fall into same subnet as gateway address (sent to clients by DHCP server as well). They should also avoid the off-limits addresses (network adress as explained above and broadcast address) - DHCP server could be smart enough to avoid them, but in ROS it seemingly doesn't. Also: all addresses in DHCP pool are in principle allocated for DHCP clients, all devices with known statically configured addresses should fall outside pool range to avoid potential address conflicts.