On 12 Aug 00:39, Wayne Stallwood wrote:
On 09/08/10 09:18, Mark Rogers wrote:
However, with the default gateway being set to the IP of the router on the faster line (say 192.169.10.1), this means that connections through the second router (say 192.168.11.1) don't work. My PC obviously has addresses on both subnets, and out to be able to respond to a connection coming in on the 192.168.11.x address replying via a default gateway on that subnet, but as I understand it I only have one default gateway.
That could get a bit messy, if you always access ssh in from a specific address then you could just set a static entry in your office machine's routing table that uses your second gateway as the route for the address (or block of addresses) you want to access ssh from.
That has the problem that any traffic to those addresses will be routed via your 2nd line.
Another (complicated) way might be to use iproute2 on the PC in the office.
That's not complicated, and as the PC is the multihomed it's the right place to be making routing decisions, so, here's the trick:
Edit /etc/iproute2/rt_tables and add (at the bottom) a line that says:
11 second.router
Then, all you needs to do is:
ip rule add from 192.168.11.0/24 table second.router ip route add default dev eth0 via 192.168.11.1 table second.router ip route add 192.168.11.1/24 dev eth0 table second.router
Obviously, eth0 is the device that you have the 192.168.11.x address on, and 192.168.11.1 is the address of the router, file you edited is purely for asthetics (so that an ip rule list gives you easier foo to read!).
The first line says "any packet from the 192.168.11.0/24 range, throw to routing table 11 (second.router)", the second adds the default route for that router, and the third adds access to the 192.168.11.0/24 range directly on that device, without sending those packets to the router.
Of course, this would not be so nice and easy on a windows box... but if you need that, then I'd suggest putting a permanent linux box infront of the 2 routers that does the cunning routing in anyway you like and use that as the DHCP server and default gw instead.
Hope that helps,