The magic of route 3 works in part because of the Address Resolution Protocol
and in part because of the forwarding table and in part because of the
routing algorithms.
Wikipedia says:
The Address Resolution Protocol (ARP) is a communication protocol used for discovering the link layer address, such as a MAC address, associated with a given internet layer address (typically an IPv4 address).
Many operating systems perform gratuitous ARP during startup. That helps to resolve problems which would otherwise occur if, for example, a network card was recently changed (changing the IP-address-to-MAC-address mapping) and other hosts still have the old mapping in their ARP caches.
Ubuntu when starting has therefore announced its presence and interfaces
on both subnets to which it is connected, so to your entire network.
Any similar announcement done
by Windows 10 was only within its subnet, so never reached Windows 7.
Even if such an announcement was never received, Windows 7 will,
to find a match, send a broadcast packet to the network using the
ARP protocol to ask "who has 10.1.1.4".
A big hint here is that the tracert command didn't list the router
among the hops. The request for 10.1.1.4 went straight to the Ubuntu computer
even though Windows 7 does not know about 10.1.1.4.
What we see here in operation is the Windows
IP Routing Table : Route Determination Process:
For each entry in a routing table, perform a bit-wise logical AND between the destination IP address and the network mask. Compare the
result with the network ID of the entry for a match.
The list of matching routes is compiled. The route that has the longest match (the route that matched the most amount of bits with the
destination IP address) is chosen. The longest matching route is the
most specific route to the destination IP address. If multiple entries
with the longest match are found (multiple routes to the same network
ID, for example), the router uses the lowest metric to select the best
route. If multiple entries exist that are the longest match and the
lowest metric, the router is free to choose which routing table entry
to use.
The Windows 7 routing found a common prefix between
10.1.1.4 and 10.1.1.3 which was 10.1.1.
The other possibilities were the router or Ubuntu at 10.1.0.99,
but whose common prefix was only 10.1, so they weren't chosen.
We see here in operation the forwarding table that is built on top
of the routing table.
While the
routing table
compiles routes based on IP addresses, the forwarding table contains
the corresponding MAC addresses.
So the forwarding table contained an entry saying: "For 10.1.1.X,
forward packet to the MAC address of the Ubuntu computer".
Once the packet arrived at the Ubuntu computer, it knew very well
how to forward it to 10.1.1.4.
So this is how packets from Windows 7 would end up on Windows 10,
and vice versa.