An entry in a routing table says that to reach anything in subnet X you can go through interface Y. It is consulted any time the system wants to send traffic to an IP.
Your NIC has an IP address and a subnet mask. So you get a free entry in the routing table based on that. i.e. if your IP is 192.168.2.1, and your subnet mask is 255.255.255.0, then if you want to reach anything else on 192.168.2.X, you can go through 192.168.2.1's interface. (These are called "directly connected" routes)
Anything with a NIC that does TCP/IP has at least a small routing table containing at least one or two entries.
If you have two NIC's that are attached to two separate networks, you'll have two entries then. Let's say you have a second NIC whose IP is 192.168.3.1 and subnet mask is 255.255.255.0. You'll get another free entry in the routing table because of that.
It is beneficial to have a default route, you can set one manually or have one assigned via DHCP.
The system, when it is trying to figure out how to send a packet, will go through all routing table entries and match the one with the highest subnet (the subnet with the most 1 bits - 255 = 8 bits).
If it can't find a match, it sends it to the IP and interface specified as the default route.
So, if we have two NICs and a default route, since the default route is usually set to subnet mask 0.0.0.0, it's the last to match. So if we send traffic to 192.168.3.2, it will go out of the NIC on that subnet due to the routing tables.
If it's not an IP that begins with 192.168.2.X or 192.168.3.X, it will try to go out on to the IP of the default route, typically an Internet-facing interface. (A default route is not technically required. If there isn't one, sending the data fails at this point.)
Routers such as yours have at least 3 NICs, the "WAN", the "LAN" ports (all those ports are typically bridged and function as one NIC), and the "WLAN" AP.
Getting into advanced and complicated things, of course you can also do things like say subnet 192.168.8.X is accessible through 192.168.20.1 (there'd better be a router on the other side that knows about it, of course) and do complex manual and completely static routing, of course. Things like RIP, OSPF, and IS-IS modify a router's routing table according to information from "higher-up" routers.
2
This might be useful to read: http://serverfault.com/questions/49765/how-does-ipv4-subnetting-work.
– Hennes – 2013-09-18T21:20:39.253