I guess the same question is how does the home router know to send the packets to the ISP's router and not to another computer on the LAN?
let's say you are on 192.168.1.0, 255.255.255.0
if you have a default gateway IP address configured, any IP address that is outside the 192.168.1.0 255.255.255.0 network goes to the default gateway
the default gateway is typically a router interface IP
the router will look at the destination IP address of that packet and determines if it has any specific routes to that destination IP address, if not then it will likely have a default route to the ISP and send the packet to the ISP
the ISP router then looks at the destination IP address and determines if it has a route (default or specific) to that IP address
eventually the packet reaches its intended destination or it's determined that that IP address can't be reached
This has to do with sub netting right?
it just has to do with networks
routers create network boundaries and communicate with other routers via direct connections and routing tables to determine paths on how to get to a certain network