Netmask (NM) setting

Description

(see setting description format info here)

Function:Defines the IP-address range for the local subnet
Set (S) command format:SNMnn...n, where nn...n is the netmask for the local subnet in dot-decimal notation (i.e. 255.255.255.0)
Get (G) command format:GNM
Init (I) command effect:Initialized unconditionally, through network command, serial command, or quick initialization
Post-initialization value:0.0.0.0
Change takes effect:After reboot
Overriding condition:May be automatically updated by the netmask provided by the DHCP server (in case DHCP (DH) setting is 1 (enabled))
Relevance conditions:Current Routing Mode (RM) [setting/ parameter]= 1 (server/client) or 2 (client)
First introduced:Earlier than "baseline" V3.14/V3.51
See also:Ethernet port and network communications

Details

Netmask defines the boundaries of a local subnet. When establishing an outgoing connection to the destination network host at current Destination IP-address (DI) [setting / parameter / instruction ] the DS compares this address with the Netmask and its own IP-address (IP) to determine if the destination is on the local or foreign subnet. The DS will (attempt to) connect directly to the current Destination IP-address (DI) if the destination host is found to reside on the local subnet or to the Gateway IP-address (GI) if the destination is found to reside on a foreign subnet.

Comparison is done as follows:

All four bytes of the IP-address (IP) are ANDed with four bytes of the Netmask.
All four bytes of the current Destination IP-address (DI) are ANDed with four bytes of the Netmask.
Results of previous two steps are compared: if they are equal then the destination is on the same subnet with the DS, if different- the destination is on the foreign subnet and the DS will be connecting through the gateway.

Example: s upposing, the IP-address (IP) of the DS is 192.168.100.40 (C0.A8.64.28 in HEX representation), current Destination IP-address (DI) is 192.168.100.90 (C0.A8.64.5A in HEX) and the Netmask is 255.255.255.0 (FF.FF.FF.00 in HEX). Then:

C0.A8.64.28 AND FF.FF.FF.00 will result in C0.A8.64.00
C0.A8.64.5A AND FF.FF.FF.00 will result in C0.A8.64.00
Resulting numbers are the same so the destination is on the same subnet

Here is another way of explaining how the Netmask works. When printed in binary representation, the Netmask always consists of a number of 1s on the left and the number of 0s on the right (for the example above the Netmask value is 1111111. 11111111. 11111111. 00000000). Positions with 1s (left side) represent the part in which the current Destination IP-address (DI) must match the IP-address (IP) of the DS to be considered local. Positions with 0s (right side) represent the range of IP-addresses belonging to the same subnet. If the Netmask is 255.255.255.0 then any IP-address that starts with 255.255.255 will be on the same subnet.

Netmask is irrelevant when the Current Routing Mode (RM) [setting / parameter ] is 0 (server) since in this mode outgoing connections are not allowed.

When DHCP is activated (DHCP (DH) setting is 1(enabled)) the Gateway IP-address obtained from the DHCP server is saved into this setting thus overwriting older value that might have been set before. This only happens when the DHCP server is configured to provide netmask data.