LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-27-2017, 07:11 AM   #1
Douro
LQ Newbie
 
Registered: Oct 2017
Posts: 7

Rep: Reputation: Disabled
1 VPS with 2 IP addresses. How to make them independent?


I have this in /etc/network/interfaces:
Code:
auto ens3
iface ens3 inet static

        address 46.xx.xxx.1x7
        netmask 255.255.252.0
        broadcast 46.38.xxx.255
        gateway 46.xx.xxx.1

auto ens3:0
iface ens3:0 inet static

    address 188.xx.xx.xx5
    netmask 255.255.255.255
I want the interfaces of my VPS to be independent. Without the traffic of ens3:0 interface pass by ens3 interface.
It's possible?
 
Old 10-27-2017, 07:35 AM   #2
mabo1
Member
 
Registered: Jul 2015
Location: Nanjing, China
Distribution: Debian
Posts: 62

Rep: Reputation: Disabled
I setup a VPS recently with 2 IP addresses and the second address would not work untill I shutdown the VPS and started it again. A reboot did not work, need to shutdown and restart, give it a try...

That may sound strange but the recommendation came from my VPS service provider and it worked.
 
Old 10-27-2017, 07:43 AM   #3
Douro
LQ Newbie
 
Registered: Oct 2017
Posts: 7

Original Poster
Rep: Reputation: Disabled
The IP's are working, both have access to the internet.
But the traffic done by the interface ens3:0 passes through the interface ens3, and that's what I did not want.
I wanted two independent interfaces.
 
Old 10-27-2017, 07:52 AM   #4
mabo1
Member
 
Registered: Jul 2015
Location: Nanjing, China
Distribution: Debian
Posts: 62

Rep: Reputation: Disabled
Well your interfaces file looks about the same as mine, except that I have a debian system and interface names are different.

I recall from my research at that time it was important to ensure only one gateway which you have. It's late here but tomorrow I can check what I have in my interfaces file.
 
1 members found this post helpful.
Old 10-27-2017, 08:17 AM   #5
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Contact your VPS provider. It's most likely that your VPS is provisioned with only a single virtual NIC and that this is your VPS providers prefered way of providing multiple IP addresses.
 
Old 10-27-2017, 09:42 AM   #6
Douro
LQ Newbie
 
Registered: Oct 2017
Posts: 7

Original Poster
Rep: Reputation: Disabled
VPS already has two IPv4 assigned.
But with the current configuration the traffic off the interface ens3:0 passes through interface ens3.
 
Old 10-27-2017, 09:55 AM   #7
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by Douro View Post
VPS already has two IPv4 assigned.
Yes, you said.
Quote:
Originally Posted by Douro View Post
But with the current configuration the traffic off the interface ens3:0 passes through interface ens3.
Yes, you said that too.

Just because you've two IPV4 addresses assigned doesn't mean your VPS has two virtual NICS assigned. From the information you've provided, where both IPs are being presented through the one virtual NIC, this appears to be the case.

Last edited by TenTenths; 10-27-2017 at 09:58 AM.
 
Old 10-27-2017, 10:06 AM   #8
Douro
LQ Newbie
 
Registered: Oct 2017
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Just because you've two IPV4 addresses assigned doesn't mean your VPS has two virtual NICS assigned. From the information you've provided, where both IPs are being presented through the one virtual NIC, this appears to be the case.
... and how can I put those IP's in separate NICs?
Do I have to configure my "/etc /network/interfaces" file differently?
 
Old 10-27-2017, 10:12 AM   #9
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by Douro View Post
... and how can I put those IP's in separate NICs?
Do I have to configure my "/etc /network/interfaces" file differently?
Nobody here can tell you because you've not told us any useful information about the VPS.

Is this one you've set up yourself on your own host?

Is this one that you're paying for from a hosting provider?

If it's on your own host then on the host you'll need to assign another NIC to the virtual instance.

If it's from a hosting provider then you'll need to ask them to assign another NIC to it, and good luck with that as they'll most likely not be interested in providing you with a custom environment.
 
Old 10-27-2017, 10:23 AM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
What you have configured is called IP aliasing. It allows the same network interface to have more then one IP address. As stated you need two network interfaces and we need the answers to the above questions.

https://en.wikipedia.org/wiki/IP_aliasing

Last edited by michaelk; 10-27-2017 at 10:25 AM.
 
Old 10-27-2017, 10:44 AM   #11
Douro
LQ Newbie
 
Registered: Oct 2017
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
If it's from a hosting provider then you'll need to ask them to assign another NIC to it, and good luck with that as they'll most likely not be interested in providing you with a custom environment.
I have sent a request for clarification to my hosting provider.
 
Old 10-29-2017, 10:23 AM   #12
Douro
LQ Newbie
 
Registered: Oct 2017
Posts: 7

Original Poster
Rep: Reputation: Disabled
They want 35€ per month for another NIC!!
 
Old 10-29-2017, 10:24 AM   #13
Douro
LQ Newbie
 
Registered: Oct 2017
Posts: 7

Original Poster
Rep: Reputation: Disabled
I verify that all data leaves the VPS normally by one of two IP's. As for the input, the data to reach the interface ens3:0 passes through the interface ens3.
 
  


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
[SOLVED] How to make C++ projects computer independent. Detailed instructions needed. derekpock Programming 26 06-14-2013 02:10 PM
how i can make script bash or perl to create vps ? a_1 Linux - Server 5 11-15-2012 07:34 AM
How to associate IP addresses with my hosted VPS. rblampain Linux - Networking 10 08-13-2011 02:14 AM
QT: how to make a member in a clicked event independent. bastl Programming 0 03-03-2009 04:01 PM
Where can I download UML VPS or Xen VPS to make a virtual private server? abefroman Linux - Software 3 12-09-2005 10:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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