[SOLVED] I have 4 nics, how do I choose which one browses the internet?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have 4 nics, how do I choose which one browses the internet?
So I have a little test linux vps setup with ubuntu. I want to find out how to browse the internet (ports 80 and 443) and specify which network interface is used.
Ideally, I'd be able to run a bash command to change which interface is used. So the default is eth0. I want to use eth1 though and not interact at all with eth0. Later on though, I'll want to run eth0 and not interact with eth1.
Other than ifconfig up and ifconfig down, how can I do this?
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Are all eth0-eth3 configured on the same subnet and connected to the default gateway? Or do you just want to set an IP for one of those so that it can reach the router?
The thing is that I ssh into the vps, so I'd like to be able to do this without getting disconnected by an ip change. All are connected to the default gateway.
I'd like to something like: Run a script for eth0.sh. Then all web browsers go out as eth0's ip address. Then I could run eth1.sh and all web browsers go out as eth1's ip address
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
The default gateway must be something on the same subnet as the network interface. So configure the network interface correctly, then set the default gw to something on the same subnet.
And study the route command. If you want to make a setup like this (why do you want that anyway?) you might want to understand what the idea behind routes is.
Ok, I am very lost. I can't find my route -n results anywhere on the internet. Here is my /etc/network/interfaces file. Maybe that will help. IP addresses have been changed though.
# Auto generated lo interface
auto lo
iface lo inet loopback
# Auto generated venet0 interface
auto venet0
iface venet0 inet manual
up ifconfig venet0 up
up ifconfig venet0 127.0.0.2
up route add default dev venet0
down route del default dev venet0
down ifconfig venet0 down
iface venet0 inet6 manual
up route -A inet6 add default dev venet0
down route -A inet6 del default dev venet0
auto venet0:0
iface venet0:0 inet static
address 10.10.13.12
netmask 255.255.255.255
auto venet0:1
iface venet0:1 inet static
address 10.10.13.136
netmask 255.255.255.255
auto venet0:2
iface venet0:2 inet static
address 10.10.13.15
netmask 255.255.255.255
auto venet0:3
iface venet0:3 inet static
address 10.10.13.13
netmask 255.255.255.255
auto venet0:4
iface venet0:4 inet static
address 10.10.13.14
netmask 255.255.255.255
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.