Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

2 Answers 2

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.