I have some practice with networks, but not much theory. I saw in this question that netmask is not stored in the TCP/IP packet.
However, from my experience if I:
- connect machine A to port 1 of router. Connect machine B to port 2 of router;
- configure machine A IP to X.X.X.1/30 (If I'm thinking correctly, that subnet has IPs X.X.X.0-3 in it, 0 being the gateway and 3 being the broadcast);
- configure machine B IP to x.x.x.2/24;
- from machine A, ping machine B.
The machines won't be able to communicate. If however I put both netmasks on /30 they will be able to communicate.
My question is: does the packet from A arrives at B or is it filtered in the router? If it's filtered in the router (router knows netmasks), how does the router know about A's and B's netmasks?
If it arrives on B (router doesn't know about netmasks), this means that I can have multiple identical IP's and different subnets in the same router (for example, X.X.X.2/30 and X.X.X.2/24) but then this would mean that the router delivers the packet to both identical IP's and the machines themselves decide what to filter, which... feels wrong (at least it's a super usage of resources).
What am I understanding wrong?