eth0 - internal network eth1 - dedicated DSL to work eth2 - preferred internet gateway
1.2.3.4 / 18 -- addresses I want to access over eth1 4.3.2.1 -- default gw on eth2
ip route add 1.2.3.4/18 via dev eth1 ip route add default gw 4.3.2.1 ip rule add from (ip of eth1) lookup Table1 ip rule add from (ip of eth2) lookup Table2 ip route add default gw (gw on eth1) table Table1 ip route add default gw 4.3.2.1 table Table2
What this accomplishes is that all traffic not destined for something on eth1's network will go over eth0. And the Table1 and Table2 mess takes care of the fact that if someone sends me traffic on an interface, I want to respond out that interface. Traffic will never naturally flow out eth1, unless it's destined for something on eth1's network. This is both a curse, and a blessing. It means fail overs have to happen by hand (via me changing the gateway by hand). I should probably look into also using metrics to alleviate that problem, but the fact I've never had to manually change the gateway because one net or the other was down, has made me lazy. :)
I was going to include a link or reference suggestion to the documentation I originally used in learning about ip, but I wasn't having much luck in finding it quickly. If I do stumble upon it, I'll post again with that information.
Hope this helps! Aaron S. Joyner
Stephen Hoffman wrote:
This is probably a simple question, but I have been unsuccessful in finding the solution.
History: One machine connected to two networks (with two network cards). Both networks get to the internet, but one is connected directly to the internet on a T1, the other is NAT'd and shared on a seperate T1, but is dreadfully slow.
I want to ensure that I always default to eth0 for internet and only use eth1 for requests on the internal network. I didn't think this would be any issue, but on occasion I notice that my request hops on the internal network for larger downloads at roughly 50K slower speeds.
I have been trying to set the metric on the interface to give preference to the faster card, but keep getting an error when I attempt to bring the card up passing the metric option. I get the following: SIOCSIFMETRIC: Operation not supported (google's no help on this one)
Am I going about this the wrong way? Is there a better way? Would it be better to set the metric in the route table? if so, how can I make it come up that way automatically?
Any help greatly appreciated!
Steve
-- TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug TriLUG Organizational FAQ : http://trilug.org/faq/ TriLUG Member Services FAQ : http://members.trilug.org/services_faq/ TriLUG PGP Keyring : http://trilug.org/~chrish/trilug.asc
