Yes, the packets wouldn't go to the outside world. But even your simple scenario may be a little bit more complex as you think by now:socratis wrote:Networking question for you: assume that I have two VMs, or even better Computers with public IP addresses (like 198.168.4.x), but in a LAN-like environment, and let's go with the simplest case; Ethernet cable to the router. Wouldn't the fact that they're in the same masked range (255.255.255.0) mean that the packets wouldn't go through the router to the outside world, but the router (knowing the arp table) simply forward the packets to the corresponding destination?
1. If a router device has multiple Ethernet ports, in reality it consists of an integrated Ethernet switch and a router, and the router is internally connected to an invisible switch port. In consequence, the router doesn't automatically 'see' all traffic going through the internal switch (like in the case with an external switch device). However, the router has access to the ARP cache of the switch.
2. In the simplest case, the router will only see the ARP requests (Ethernet broadcast frames), but neither the local ARP replies (Ethernet unicast frames) nor the IPv4 packets. The router itself will not even answer the ARP requests, despite knowing the answer. (Unless configured for Proxy ARP, which is normally used for more complex scenarios like road warriors.)
In the NAT networking case however, the router usually has no knowledge of the IPv4 addresses of the NAT network. If an IPv4 packet reaches the router (because of it's gateway functionality), then the IPv4 destination address is searched for in the routing table, which usually contains (amongst others) the configured local networks, the blocking routes for the private IPv4 address ranges, and a default route to the Internet ...