I've got a routing issue that I can't quite figure out. My (very
simplified) setup is this:
Box A is on 192.168.0.1 and is the router, dns server, etc. for the
192.168.0.x network. It has other interfaces as well, for access
further into the network and out onto the internet. iptables are set to
allow all traffic in, out and forwarded. There is a "route -net
192.168.1.0/24 gw 192.168.0.2" in the route table.
Box B is on 192.168.0.2 with 192.168.0.1 as the default gateway. It's a
client machine on the 192.168.0.x network.
Box C is a router with two ports. One is at 192.168.0.3, the other is
192.168.1.1. iptables are set to allow all traffic in, out and
forwarded. The default route is set to 192.168.0.1 (box A).
Box D is on 192.168.1.2 with 192.168.1.1 as the default gateway. It's a
client machine on the 192.168.1.x network.
If I log into box B, and type "ping D" I get a response. The route
flow is B to A (the default gateway), then to C (due to the specific
route command), then to D. I've confirmed this path with traceroute.
If I log into box D and type "ping B", I get no response. Traceroute
shows the flow from D to C as expected, but nothing beyond that. I know
that the packet is going directly from C to B (see below for how I
know), as expected. But somehow the reply from box B is not getting
back to D.
(If I ping from box D to something outside these networks, accessed
through router A, it works fine.)
I can't see why I can ping one way, and not the other.
I can see that the paths from B to D and from D to B are asymmetrical -
when box B wants to send to D, the path goes through A and then C due to
the default route, while on the path from D to B, the route goes
directly from C to D and misses out A, since the network segments match.
But since pings work fine from B to D, this must mean that both the
outgoing and return paths are working as expected. Why then does it not
work when the orders are reversed?
If I run "route -net 192.168.1.0/24 gw 192.168.0.2" on B, then pings
work properly both ways. The routes are then symmetrical. But putting
extra routes on B does not scale well if there are many B's and many C's
in the network.
Thanks for any ideas here - this is greatly annoying me.