Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is an Ubuntu 12.04 server install. I have multiple network cards, eth0 and eth1 lets call them. eth0 is connected to the internet, and all of my traffic goes through it, until eth1 gets plugged in. Then the machine tries to send everything through eth1, which for various and sundry reasons does not go out to the Interent. The only traffic it doesn't send through eth1 is traffic on eth0's subnet. It also will not accept inbound connections on eth0 from outside of eth0's subnet. I'd like all outbound traffic to go out eth0, but I'd like incoming connections from to either card from any subnet to work.

share|improve this question
Please provide the outputs of: # netstat -rn # ip route # iptables -L -n -v – dmourati Jul 9 '12 at 0:14 – Finn Jul 9 '12 at 0:18
What's upstream from your Ubuntu box between it and the internet? You need something to do a NAT from your 10.13.37.x address. Also, what is It is registered in Ukraine. You said you have eth1 but your server lists only a tun interface, which is software only, not physical. This conflicts with what you say above about "eth1 gets plugged in." There may be something wrong with your source IP address selection. – dmourati Jul 9 '12 at 1:15

The traffic will go according to the routing table.

If you don't want Internet bound traffic egressing a particular interface then you need to ensure there is no default route that uses that interface.

If both are valid paths but one is preferred then change the preference of one of them higher or lower.

What are you using to configure your network?

share|improve this answer
Ok. What do you mean "what am i using to configure my network"? I have the default Ubuntu stuff installed for networking... – Finn Jul 8 '12 at 23:21
Ubuntu defaults are not sufficient for your use case. – Magellan Jul 8 '12 at 23:24
Ok, so what do I do? – Finn Jul 8 '12 at 23:27
You need to post your /etc/network/interfaces file in the body of the question. Someone should be able to help you then. – Magellan Jul 8 '12 at 23:44
And once that's working, I'd suggest go reading up on routing and forwarding. – Magellan Jul 8 '12 at 23:46


ip route change default via src
share|improve this answer

You configure your dhcp server to assign your server as the default route for each subnet (gateway = server's ip of the same subnet) and in your server, you assign the default route to eth0.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.