When we have two hosts that belong to the same Physical and Logical network, they should be able to communicate between each other, assuming there is no Firewall or other security software blocking their communication.
The ‘<b>Default Gateway</b>’ option is only required when one of the two hosts are in a different logical network, therefore all packets are sent to the Gateway device (usually a router), that routes packets between the two hosts, making their communication possible.
There are of course many variations of this scenario that raise a lot of questions, and are very helpful to ensure you clearly understand how IP communications work.
For example, assume one host has a configured IP address of <b>192.168.0.5 </b>with Subnet mask <b>255.255.255.0</b> and the other host is configured with IP address <b>192.168.0.90</b> with Subnet mask <b>255.255.255.128</b>.
Are these two hosts able to communicate without the usage of a default gateway ?
In short, the answer is ‘Yes’. Even though at a first glance we see that the subnet masks are different, the truth is that there is a common LAN IP range (192.168.0.1 – 192.168.0.126) between both hosts.
Such examples are often found in certification exams, carefully selected to ensure the user really understands how IP communications, routing and subnetting really works.
You can find plenty of these scenarios at the following URL:
Hope that helped clear things 🙂
Previous Answer from another user:
For 2 hosts on the same LAN/VLAN to communicate, they do not even need a default gateway.
The router is only used if the host needs to communicate with a different network.