Take the 2-minute tour ×
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;

Eth1: 192.168.0.1

Eth1:2 192.168.0.2

Default gateway is 192.168.0.254 via Eth1

Remote subnet is 10.0.0.0/24

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

share|improve this question

2 Answers 2

up vote 4 down vote accepted

It was as simple as ip r a 10.0.0.0/24 via 192.168.0.254 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 192.168.0.1 is routed over separate links to traffic to/from 192.168.0.2. 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

 
discard

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.