Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a service which I want to run over eth1.
But all my other traffic still needs to run over eth0.

Is it possible to force a command-line tool or other application to use the non default interface?

share|improve this question
1  
If you need different programs to use different routes to the same IP address, you need to use packet mangling. See multigateway routing for specific src port, Dual network connection, 2 network interfaces connected to internet. Choose the one to use according to the domain name for examples. –  Gilles Dec 22 '10 at 0:16

2 Answers 2

Just a stab in the dark, but does the service allow you to bind to specific IP addresses? If eth1 has its own IP address (i.e. not bonded with eth0) this may do what you want. Outside of that, you may be able to have it access an external IP address that's only routed over eth1.

share|improve this answer
    
Ive looked and no it doesnt have options to route it over a different interface. Im messing with hellanzb, ive looked through the documentation and the config file and i didnt see anyplace to specify the interface. –  madmaze Dec 21 '10 at 5:39
    
@madmaze - the routing wouldn't be an option in the app itself, but you'd set up a route from your machine to the server specifically over the eth1 interface. This would make all traffic to the server use eth1, which may not be what you want –  Rich Homolka Dec 21 '10 at 5:50

You can probably configure the application to bind to the ip address you have configured on eth1. If, however, your default route goes out eth0, your outbound traffic, while tagged with the IP on eth1, will likely still leave the host on eth1.

share|improve this answer
    
Binding to a particular IP address will make the application respond only to connection requests that arrive on a particular interface. But if there are multiple routes to the same IP address, this won't affect which one is taken. –  Gilles Dec 22 '10 at 0:17

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.