2

I'm having trouble understanding the concept of routing tables and what they allow you to do and how.

Specifically, I'm trying to allow devices on one subnet (192.168.1.X) to talk to devices on another subnet (192.168.160.X).

When I go into my router, I'm able to find the "Advanced Routing" menu that seems related. However, I have no idea what is supposed to be entered, or if I'm even in the right spot.

enter image description here

As a more broad question though, how do routing tables work? Although I'm trying to specifically accomplish a particular task, I'd also like to understand the broader concept of routing tables and how they work. I've read about it, but I don't quite understand how it's put into practice.

1

3 Answers 3

3
  • Destination: 192.168.160.0
  • MASK: 255.255.255.0
  • Gateway: [the IP of the local interface of a router that knows a route to 192.168.160.0/24]
  • Interface: [the interface that exits to the network that contains the gateway above]

in essence a routing table entry says: "to reach [Destination/Mask] send the packet out [interface] to IP [gateway]."

2
  • In my case, I want the entire 192.168.160.1-254 subnet accessible. So in the "destination", would I put 192.168.160.0? Or is this only to route to a single IP on the 160.X subnet?
    – user201262
    Sep 19, 2013 at 1:36
  • 1
    you generally route between networks not hosts (though a host can be a network unto itself). All networks have an "Identity address", so for the network 192.168.160.1-254 (which implies the mask 255.255.255.0), the identity address is 192.168.160.0. When you write a routing table entry, your destination parameter should be a network identity. Sep 19, 2013 at 3:20
2

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.

0

The way the Internet (IPv4/IPv6) works, packets can be routed between servers pretty arbitrarily. What routing tables do is specify how those packets should communicate.

For a home network, the setup is generally pretty simple: send all packets to the router, which will then send it out to the Internet (WAN interface), or to another system behind the router (behind the NAT, the LAN/WLAN interface).

If both of your subnets are directly connected to your router, you need to tell 1.x devices how to reach 160.x devices, and vice versa. So:

  • The router needs to know how to reach both subnets (which is what the dialog you showed is for).
  • A 1.x system will route 1.x traffic correctly, and will pass 160.x traffic to its default gateway (in this case, the router).
  • A 160.x system, upon hearing a request from a 1.x system, will pass traffic to its default gateway (hopefully the same router). If the remote system cannot reach the same router, you will need to set up routing tables for it do do so.

You must log in to answer this question.