Re: Forcing a connection from a particular NIC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



rss26@njit.edu wrote:
Hi,

Given a setup where there are multiple NIC's (some of them being virtual eth1:1, etc and others being real) and if they all have the same default gw can a preference be made by a network-application such as the browser of selecting to use a one NIC over another.

The idea here is that I should be able to select the source IP which should be used by the network-application.

It is not possible to use RAW sockets here as we are dealing with net-apps and hence we dont have access to their socket calls. Also, ifdown the not needed NIC's is also not an option as all NIC's need to stay 'up' all the time.

Any info will be greatly appreciated.

thanks,
Ronak
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

It might not be the most efficient method, but iptables could handle this. You would need the CONFIG_IP_NF_NAT_LOCAL turned on in the kernel, then you use the SNAT option. I don't think you can do user matching in POSTROUTING, so you would probably have to use the MARK feature in the OUTPUT chain, then SNAT the marked packets. The netfilter module you will want to look at for user matching is called "owner", see the iptables man page for a short description. You may also want to do some port matching on your rules as well, for which you can also find info in the iptables docs.

~Bradley

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux