LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 10-16-2020, 04:44 PM   #1
n00b_noob
Member
 
Registered: Sep 2020
Posts: 217

Rep: Reputation: Disabled
Post How to Force an Application to Use a Specific Network Card?


Hello,
Is it possible to Force an Application to Use a Specific Network Card? For example, I have two NIC and I want my browse use eth1.

Thank you.
 
Old 10-16-2020, 05:36 PM   #2
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 4,875

Rep: Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912
You can't. However, if eth1 is connected to a router acting as an internet gateway, that interface will be used for internet connectivity. For example...

Internet-----GW Router(192.168.1.1)------(eth1, 192.168.1.5)Host(eth2, 192.168.2.5)------
 
Old 10-17-2020, 10:09 AM   #3
n00b_noob
Member
 
Registered: Sep 2020
Posts: 217

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
You can't. However, if eth1 is connected to a router acting as an internet gateway, that interface will be used for internet connectivity. For example...

Internet-----GW Router(192.168.1.1)------(eth1, 192.168.1.5)Host(eth2, 192.168.2.5)------
If both of my NICs has Internet?
 
Old 10-17-2020, 04:46 PM   #4
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 4,875

Rep: Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912
The routing table(s) will determine which gateway is used in these circumstances. Policy based routing would generally be employed. For example...

https://www.linuxmaker.com/en/linux/...-gateways.html
https://kindlund.wordpress.com/2007/...utes-in-linux/
 
Old 10-29-2020, 12:31 PM   #5
martin smith
Member
 
Registered: Feb 2020
Posts: 34

Rep: Reputation: Disabled
You have to give the full path to your program
If the path contains spaces, enclose it in quotes
You will have to launch the program via this method every time you want to bind it to that network card.
 
Old 10-29-2020, 09:03 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 20,299

Rep: Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213
Some progams have settings either in text of via config that could select.

Some programs might work in a layer 7+ router.

If we knew more about your question then maybe better answer.
 
Old 10-29-2020, 09:26 PM   #7
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 4,875

Rep: Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912
The OP mentioned using a browser. I fail to see how that can be constrained to use one particular network interface.
 
Old 10-29-2020, 09:59 PM   #8
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.8.2003
Posts: 5,266

Rep: Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948
Sorry...I have to ask. Why? What “problem” are you trying to solve?
 
Old 10-30-2020, 06:02 PM   #9
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 9,900

Rep: Reputation: 4462Reputation: 4462Reputation: 4462Reputation: 4462Reputation: 4462Reputation: 4462Reputation: 4462Reputation: 4462Reputation: 4462Reputation: 4462Reputation: 4462
Quote:
Originally Posted by n00b_noob View Post
Hello,
Is it possible to Force an Application to Use a Specific Network Card? For example, I have two NIC and I want my browse use eth1.

Thank you.
Yes, but the setup I'm going going to describe is probably not what you wanted to hear.

The computer with two NICs is a router. Its eth1 connects to its own subnet. The only computer on that subnet is a kiosk that only runs that web browser.
 
Old 10-30-2020, 06:23 PM   #10
jefro
Moderator
 
Registered: Mar 2008
Posts: 20,299

Rep: Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213Reputation: 3213
If it were port 80 then depending on distro some routing like iptables.
 
Old 11-05-2020, 08:33 PM   #11
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,183
Blog Entries: 21

Rep: Reputation: 151Reputation: 151
are your 2 NICs configured with the same IP address or different? your gateway to the internet, does each NIC use the same one or 2 different gateways?
 
Old 11-17-2020, 11:52 AM   #12
n00b_noob
Member
 
Registered: Sep 2020
Posts: 217

Original Poster
Rep: Reputation: Disabled
Each NICs has its own IP address and gateways are same.
 
Old Yesterday, 11:08 AM   #13
martin smith
Member
 
Registered: Feb 2020
Posts: 34

Rep: Reputation: Disabled
You have to give the full path to your program.
If the path contains spaces, enclose it in quotes.
You will have to launch the program via this method every time you want to bind it to that network card.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I get a specific application to grab output of a specific usb hid source? Linuxmonger Linux - Hardware 2 07-16-2019 05:48 PM
How to force specific domain or user specific emails to proces in sendmail 8.13.5 FC5 peanutsa Linux - Newbie 1 03-22-2009 06:33 AM
Force specific refresh for specific resolution miner49er Linux - General 2 03-20-2009 03:36 AM
Tip: Loading specific gtk theme for a specific application Su-Shee Linux - Desktop 0 05-22-2008 01:59 PM
Force a USB device to use a specific /dev/ttyUSBX garnser Linux - Software 4 02-10-2006 07:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 09:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration