Use specific interface for outbound connections (Ubuntu 9.04)

I have 2 ethernet user interfaces in my computer system, which is running Ubuntu 9.04. Both user interfaces sporting activity fixed IPs, yet make use of different portals. My /etc/network/interfaces documents looks something similar to this:

auto eth0 eth1
iface eth0 inet static

iface eth1 inet static

I intend to have all website traffic mosting likely to the internet - at - huge go through eth0, yet it appears to intend to experience eth1. Exists a manner in which I can funnel my basic outgoing website traffic via eth0 rather and also just make use of eth1 for website traffic to its subnet?

The solution needs to be relentless ; that is to claim, it needs to endure reboot without a superuser requiring to run a command after reactivate.

EDIT : as asked for, below is the result of my route -n command:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface   U     0      0        0 eth0   U     0      0        0 eth1     U     1000   0        0 eth1         UG    100    0        0 eth1         UG    100    0        0 eth0
2022-06-07 15:17:26
Source Share
Answers: 4

Look at your existing routing table by keying in course. Your equipment will certainly make use of the first default gw it sees in the routing table. This will certainly be represented by default or 0.0.0 .0 as the location. If you just desire eth1 to be made use of for the neighborhood /24 network, remove the portal command. This need to make eth1 is default gw your only default one.

2022-06-07 15:50:01

Modifing the routing table with course as recommended will certainly repair this momentarily, yet it will certainly change to it is existing state on the next boot.

It would certainly be feasible to set course regulations in/ etc/rc. neighborhood or some sort of various other init manuscript, yet in this instance the most basic alternative is simply to remove the portal from eth1 in the user interfaces documents.

By getting rid of that portal that system will certainly still instantly make use of eth1 as the course 192.168.2/24, yet will certainly course all various other website traffic via eth0.

2022-06-07 15:49:20

You need to just have one default portal. If you remove the portal line from eth1, it'll all simply job (after networking is reactivated).

2022-06-07 15:47:49

Remove portal from eth1 in/ etc/network/interfaces and also add it as a fixed course:

route add -net netmask gw

With this, 10.0.0 .1 will certainly be your default portal and also eth1 will certainly be made use of just to connect to network

2022-06-07 15:41:38