LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 12-25-2015, 03:08 AM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Rep: Reputation: 56
How to sort out ONE fixed IP serving several VMs


Hi all,

Host Ubuntu 14.04 desktop
VMs Ubuntu 14.04 desktop/server edition
VirtualBox

I have several websites running on VMs, each with its own domain/subdomain and internal IP address. But I have only one Fixed IP. Please advise how set up their static IP so that they can be evoked on Internet?

Does following document help?
VirtualBox: Configuring Static IPs for VMs
http://coding4streetcred.com/blog/po...ic-IPs-for-VMs

Thanks in advance

Regards
satimis
 
Old 12-25-2015, 08:24 AM   #2
linuxtech99
Member
 
Registered: Jan 2015
Posts: 35

Rep: Reputation: 4
Simple way is running HA Proxy. Here are the steps

* Install HA Proxy & setup ACLs (based on hostname), front end & backend - https://seanmcgary.com/posts/haproxy...by-domain-name
* Setup DNS of your domains to the same fixed IP
 
Old 12-25-2015, 09:03 AM   #3
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by linuxtech99 View Post
Simple way is running HA Proxy. Here are the steps
Hi,

Thanks for your advice.

Quote:
* Install HA Proxy
Do I need install HA Proxy on the host? Can I install HA Proxy on a VM? Because I expect keeping the host clean solely for running VirtualBox. If I have to install it on the host I'll get another machine for this test.

Quote:
& setup ACLs (based on hostname), front end & backend - https://seanmcgary.com/posts/haproxy...by-domain-name
* Setup DNS of your domains to the same fixed IP
I just browsed your link having a brief reading on its document. But I couldn't resolve follows;

On the server of the hosting company all domains will point at the same Fixed IP, for example;

domain1.com -> 111.222.333.444
domain2.com -> 111.222.333.444
domain3.com -> 111.222.333.444
domain4.com -> 111.222.333.444
etc.

on the router, for exmple;
VM1 internal IP -> 192.168.0.1
VM2 internal IP -> 192.168.0.2
VM3 internal IP -> 192.168.0.3
VM4 internal IP -> 192.168.0.4
etc.

How to configure HA Proxy so that when domain1 is browsed on Internet it will be directed to VM1?

Thanks in advance

Regards
satimis
 
Old 12-25-2015, 11:46 AM   #4
linuxtech99
Member
 
Registered: Jan 2015
Posts: 35

Rep: Reputation: 4
Smile

OK. On your first question - Yes, you need to install HA Proxy on the host or the servers where the fixed IP is bound.

Lets take your example,

Quote:
On the server of the hosting company all domains will point at the same Fixed IP, for example;

domain1.com -> 111.222.333.444
domain2.com -> 111.222.333.444
domain3.com -> 111.222.333.444
domain4.com -> 111.222.333.444
etc.

on the router, for exmple;
VM1 internal IP -> 192.168.0.1
VM2 internal IP -> 192.168.0.2
VM3 internal IP -> 192.168.0.3
VM4 internal IP -> 192.168.0.4
etc.

How to configure HA Proxy so that when domain1 is browsed on Internet it will be directed to VM1?

From your example, lets consider your fixed IP (where you installed HA Proxy) is 111.222.333.444, domain1 is hosted in 192.168.0.1, domain2 is hosted in 192.168.0.2 and similar for 3 & 4.


You will need to have the following config in HA Proxy config /etc/haproxy/haproxy.cfg for frontend & backend


PHP Code:
frontend HTTP-IN
        bind 
:::80
        acl domain1     hdr
(host) -i domain1.com
        use_backend domain1_backend 
if domain1
        acl domain2     hdr
(host) -i domain2.com
        use_backend domain2_backend 
if domain2
        acl domain3     hdr
(host) -i domain3.com
        use_backend domain3_backend 
if domain3
        acl domain4     hdr
(host) -i domain4.com
        use_backend domain4_backend 
if domain4
        default_backend dummy_backend


backend domain1_backend
        balance leastconn
        option httpclose
        server node1 192.168.0.1
:80 check

backend domain2_backend
        balance leastconn
        option httpclose
        server node1 192.168.0.2
:80 check

backend domain3_backend
        balance leastconn
        option httpclose
        server node1 192.168.0.3
:80 check

backend domain4_backend
        balance leastconn
        option httpclose
        server node1 192.168.0.4
:80 check

backend dummy_backend
        balance leastconn
        option httpclose 
When users hit domain1.com, HAProxy will detect that the request is for domain1.com by analyzing the HTTP request. Based on the ACL we setup, it will forward the request to 192.168.0.1 which is your VM1. The above config is very basic to get the setup working. The more study about HAProxy, you can do more

Last edited by linuxtech99; 12-25-2015 at 11:47 AM.
 
Old 12-25-2015, 01:17 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,798

Rep: Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002
Quote:
Originally Posted by satimis View Post
Hi all,
Host Ubuntu 14.04 desktop
VMs Ubuntu 14.04 desktop/server edition
VirtualBox

I have several websites running on VMs, each with its own domain/subdomain and internal IP address. But I have only one Fixed IP. Please advise how set up their static IP so that they can be evoked on Internet?
You mean 'advise' AGAIN????:
http://www.linuxquestions.org/questi...xy-4175543392/
http://www.linuxquestions.org/questi...es-4175439324/
http://www.linuxquestions.org/questi...-world-543490/
http://www.linuxquestions.org/questi...ddress-597727/

You asked this same question EIGHT YEARS AGO, and have been asking about apache for TEN. Is there some point at which you could read the documentation, or at least REFERENCE and ACKNOWLEDGE what people have 'advise' you about before???
Quote:
Does following document help?
VirtualBox: Configuring Static IPs for VMs
http://coding4streetcred.com/blog/po...ic-IPs-for-VMs
You tell us...since you read it, did you TRY IT and if so, did it WORK???? If not, tell us what actual problems you're having.
 
Old 12-25-2015, 03:30 PM   #6
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by linuxtech99 View Post
OK. On your first question - Yes, you need to install HA Proxy on the host or the servers where the fixed IP is bound.

- snip -
Hi,

Thanks for your detail advice.

Can I build an Apache running on a VM in this box solely for running HA Proxy. Fixed/Static IP will point to this VM and Port 80 will be forwarded to this VM as well? If it can't work I'll find an old PC for this test.

Thanks

Regards
satimis
 
Old 12-25-2015, 03:49 PM   #7
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by TB0ne View Post
You mean 'advise' AGAIN????:
http://www.linuxquestions.org/questi...xy-4175543392/
http://www.linuxquestions.org/questi...es-4175439324/
http://www.linuxquestions.org/questi...-world-543490/
http://www.linuxquestions.org/questi...ddress-597727/

You asked this same question EIGHT YEARS AGO, and have been asking about apache for TEN. Is there some point at which you could read the documentation, or at least REFERENCE and ACKNOWLEDGE what people have 'advise' you about before???

You tell us...since you read it, did you TRY IT and if so, did it WORK???? If not, tell us what actual problems you're having.
I failed to setup the network in the past and host the websites on Godaddy up-to-now.

For testing following feature provided by Godaddy;
"When the local servers are UP, readers will browse the websites on local servers. When the local servers are down, readers will browse the websites on Godaddy server."

I resume the idea to continue this setup.

I haven't tried that link because I'm NOT sure whether it is suitable for my use.

Regards
satimis
 
Old 12-25-2015, 08:45 PM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,798

Rep: Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002
Quote:
Originally Posted by satimis View Post
I failed to setup the network in the past and host the websites on Godaddy up-to-now.
So again, after 8 years working with Apache and asking about such things, why can't you apply any of that?
Quote:

For testing following feature provided by Godaddy;
"When the local servers are UP, readers will browse the websites on local servers. When the local servers are down, readers will browse the websites on Godaddy server."

I resume the idea to continue this setup. I haven't tried that link because I'm NOT sure whether it is suitable for my use.
So TRY IT AND FIND OUT. Again, we can help with specific problems, but you're asking people to read documentation for you, and tell you if it MIGHT fit your needs. That is YOUR task. If it does not work, post the problems you encounter, and we may be able to help. But after all these years, you should be able to do SOMETHING on your own
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dual Boot trouble with XP and dual drives - (Sort of fixed) larkl Puppy 5 11-28-2011 08:00 PM
[Tcptraceroute/Traceroute/Ping] Windows VMs & Linux VMs BiFo Linux - Networking 0 08-24-2010 02:07 PM
Is there a sort of 2nd SSH daemon server, sort of JAILKIT, in the debian repositories frenchn00b Debian 5 06-20-2010 04:03 AM
LXer: Using Xen With LVM-Based VMs Instead Of Image-Based VMs (Debian Etch) LXer Syndicated Linux News 0 01-14-2009 08:20 PM
FC2 Sound problem fixed. Sort of. sybian Fedora 4 05-23-2004 06:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

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