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?
 
hemmiConnect With a Mentor Commented:
This is what I said: two default routes.
Do what I mentioned!
The
gateway ...
line adds a default route.

0
 
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
 
ewan69Author Commented:
Thanks, work.
0
All Courses

From novice to tech pro — start learning today.