Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I am looking for some sort of routing trickery to set a specific source IP:

Local machine has two IPs;



Default gateway is via Eth1

Remote subnet is

Any traffic that is sent to 10.0.0.x host, I want to leave via Eth1:2 so that it has IP when it is received by the remote hosts, or some how force to be my source IP when talking to 10.0.0.x hosts.

share|improve this question
up vote 6 down vote accepted

It was as simple as ip r a via dev eth1:2

share|improve this answer

Both interfaces are on the same net, that doesn't make any kind of sense (unless they are connected to switch(es), and you bond them into a single interface). Why this bizarre setup? What are you trying to gain with it?

share|improve this answer
Its one physical interface, with two IP addresses. There is policy based routing further up the line, traffic to/from is routed over separate links to traffic to/from I've fixed this now anyway. – jwbensley Feb 11 '13 at 10:23
Please answer your own question (giving any other relevant data) and accept it to close the issue. – vonbrand Feb 11 '13 at 10:36

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.