# specific network interface

## SewerBeing

Hello,

I have a computer with two network cards and I would like to force some applications to only use one interface and others to only use the other. Is there a way to do this?

Thank you in advance

----------

## TheAbu

Some application like samba or ssh allow you to choose which network card will be used or ignored I'm not sure every single application has the same ability.

----------

## SewerBeing

quite a few of the applications involved do not have this configuration option so I'm looking for something that is more general

----------

## vaguy02

The question would be easier to answer if more specifics were given, ie. which programs. 

I don't know of any programs that would do this, so I'm just going to spitball something here. I know I'm going to be shot down over this but I will say it anyways. You could always use two different IP's, then use iptables to block specific traffic on one ip and allow it on another ip. Forcing the program to use the network interface that will allow the traffic. idk. just a thought.

Vaguy02

----------

## Hu

Why do you need to do this?  If the NICs are on separate networks, the kernel should do the right thing automatically for clients.  Most server programs let you specify the IP on which to listen.

----------

## xtz

 *vaguy02 wrote:*   

> The question would be easier to answer if more specifics were given, ie. which programs. 
> 
> I don't know of any programs that would do this, so I'm just going to spitball something here. I know I'm going to be shot down over this but I will say it anyways. You could always use two different IP's, then use iptables to block specific traffic on one ip and allow it on another ip. Forcing the program to use the network interface that will allow the traffic. idk. just a thought.
> 
> Vaguy02

 Sounds more like a routing issue?

----------

## malern

 *SewerBeing wrote:*   

> quite a few of the applications involved do not have this configuration option so I'm looking for something that is more general

  The iptables "owner" module lets you filter based on a programs uid, gid, pid or sid. http://www.netfilter.org/documentation/HOWTO//packet-filtering-HOWTO-7.html#ss7.3

----------

