LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 03:44 PM   #1
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

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, 04:36 PM   #2
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,817

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
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, 09:09 AM   #3
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

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, 03:46 PM   #4
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,817

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
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, 11:31 AM   #5
martin smith
Member
 
Registered: Feb 2020
Posts: 34

Rep: Reputation: 3
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, 08:03 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
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, 08:26 PM   #7
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,817

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
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, 08:59 PM   #8
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,732

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

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
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, 05:23 PM   #10
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
If it were port 80 then depending on distro some routing like iptables.
 
Old 11-05-2020, 07:33 PM   #11
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
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, 10:52 AM   #12
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

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

Rep: Reputation: 3
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



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 04: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 05:33 AM
Force specific refresh for specific resolution miner49er Linux - General 2 03-20-2009 02:36 AM
Tip: Loading specific gtk theme for a specific application Su-Shee Linux - Desktop 0 05-22-2008 12:59 PM
Force a USB device to use a specific /dev/ttyUSBX garnser Linux - Software 4 02-10-2006 06:28 AM

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

All times are GMT -5. The time now is 04:59 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