Problems writing interfaces file for dual ethernet

I am having  a problem getting the config to work with dual ethernet, the contents of the interfaces file is attached below, i am running ubuntu 9.10 and have removed the network manager.
I need all traffic to a 10.0.2 or 10.0.1 to go via eth1 and everything else via eth0.

With the current config the default route is via eth1, if i remove the bottom line it works how i want apart from 10.0.2.x goes via eth0


auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
up route add default 

auto eth1
iface eth1 inet static
up route add -net netmask gw dev eth1

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What is the output when you run route?

Is the routing table picking up your entries?

You must drop the

And the line
"up route add default"
is unnecessary because "gateway" will do it anyway.
ewan69Author Commented:
Thanks for your quick replies,

below is the routing table, i didn't mention that the 10.0.2.x is accessed via so i will need to keep the
"gateway" line won't I?

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface    *        U     0      0        0 eth0        *        U     0      0        0 eth1   UG    0      0        0 eth1
default         UG    100    0        0 eth0
default         UG    100    0        0 eth1

This is what I said: two default routes.
Do what I mentioned!
gateway ...
line adds a default route.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ewan69Author Commented:
Thanks, work.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.