- The netmask is used to sub-divide an IP address into bytes that provide routing information and bytes that provide local address information. If a destination IP address bitwise ANDed with the subnet mask does not match the local IP address bitwise ANDed with the subnet mask then the two IP addresses do not exist on the same network. In this case the packet being sent to the destination address cannot be sent directly, and must instead be sent to a router for intelligent inter-network routing.
The Gateway address is the IP address of the router – the
router being the gateway to other (remote) networks.
FreeRTOS+TCP determines whether an IP packet can be sent directly, or if it needs to be sent to a router. FreeRTOS+TCP users only need to provide a gateway address. Like the IP address, the IP address of a gateway can be configured either statically as a parameter to FreeRTOS_IPInit(), or dynamically from a DHCP server.