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

Thanks.

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
	address 192.168.20.130
	netmask 255.255.255.0
	gateway 192.168.20.1
up route add default 192.168.20.1 

auto eth1
iface eth1 inet static
	address 10.0.1.130
	netmask 255.255.255.0
	gateway 10.0.1.1
up route add -net 10.0.2.0 netmask 255.255.255.0 gw 10.0.1.1 dev eth1

Open in new window

ewan69Asked:
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.

Kruger_monkeyCommented:
What is the output when you run route?

Is the routing table picking up your entries?

0
hemmiCommented:
You must drop the
"gateway 10.0.1.1"
line.

And the line
"up route add default 192.168.20.1"
is unnecessary because "gateway 192.168.20.1" will do it anyway.
0
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 10.0.1.1 so i will need to keep the
"gateway 10.0.1.1" line won't I?


Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.20.0    *               255.255.255.0   U     0      0        0 eth0
10.0.1.0        *               255.255.255.0   U     0      0        0 eth1
10.0.2.0        10.0.1.1        255.255.255.0   UG    0      0        0 eth1
default         192.168.20.1    0.0.0.0         UG    100    0        0 eth0
default         10.0.1.1        0.0.0.0         UG    100    0        0 eth1

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

0

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.
0
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.