On 12 Aug 12:06, Mark Rogers wrote:
On 12/08/10 11:34, Brett Parker wrote:
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
You mention that this is just for asthetics: does the 11 have any significance, or did you just pick it because of the 192.168.*11*.0 subnet (ie does it need to match that, or is it just convention or convenience)?
Basically, it just has to be a number between 1 and 252, 11 looked nice...
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
I've seen ip rules but never played with them, so I've never been sure how they persist. Do I need to add these to my ifup script, or are they a one-off? If the latter, where are they stored?
I'd be adding them when the interface is brought up (post-up), and I'd be changing the add to a delete in a pre-down script.
So, yes, they're not persistant, you'll need them in a up/down script.
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.
It would be nice to have similar options on the windows boxes, but on the other hand opening them up to the outside world isn't very secure anyway! It's only me that tends to do stuff like SSH to my desktop.
It's probably possible, but windows networking is always a little interesting.
Anyways - hope that all works!
Cheers,