LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-23-2014, 09:57 AM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Rep: Reputation: 56
How to configure VMs to be browsed on Internet


Hi all,

How to configure VMs to be browsed on Internet

One Static IP
VMs - Apache web server running WordPress, having its own domain.
OS
host Ubuntu 14.04 desktop
VMs Ubuntu/Linux Mint/Debian

Each VM is a web server with website installed which can be browsed locally.

I'm now searching for guides to make each VM to be browsed on Internet. I did it several years ago making use of Perdition and Mysql for routing.


On googling I found following document. I hesitate whether they are suitable for me to follow?

1)
Setting up a Virtualbox Virtual Machine for Web Development with Multiple Sites using mod_vhost_alias and VirtualDocumentRoot
http://otaqui.com/blog/1652/setting-...ldocumentroot/

2)
Configure several Apache servers on multiple VMs
http://www.crocoware.com/2012/12/con...-multiple-vms/


Pointer and advice would be appreciated. Thanks.

Regards
satimis
 
Old 06-24-2014, 05:40 AM   #2
p_s_shah
Member
 
Registered: Mar 2005
Location: India
Distribution: RHEL 3/4, Solaris 8/9/10, Fedora 4/8, Redhat Linux 9
Posts: 237
Blog Entries: 1

Rep: Reputation: 34
Nice Query!!!!

As per my knowledge, links you have provided should be good step to proceed.
One of the many approach:
Basic Setup
Build your Ubuntu desktop and install Virtualbox.
Assign static IP to Ubuntu desktop. For e.g. 1.2.3.4. Assign one more IP e.g. 10.1.0.5.
Install Apache on Ubuntu desktop.
Build VMs (e.g. 4) on VirtualBox, assign IP from a separate VLAN for e.g. 10.1.0.10/11/12/13. Configure bridge mode, so that your VMs can be accessed from Desktop as well other VMs.
Install Apache and host sites on your VMs. Make sure your sites are browseable from Destktop and other VMs.

Option 1
On Desktop, setup .htaccess file and mod_rewrite module. All traffic will come to Static IP:80, using .htaccess you can redirect traffic to different IPs. You may need to setup proper firewall settings.
For e.g. mydomain.com/test1 -> 10.1.0.10, mydomain.com/test2 -> 10.1.0.11

Option 2
Host your websites on different ports on different VMs. And using firewall rules/.htaccess redirect traffic.
==============================================================================

Another Approach
You do not need any separate VMs. On a single Ubuntu Destop, configure Virtual host and alias and host all your sites with different doucment root. It's preety much simple.

Please reply back in case of queries.
 
Old 06-24-2014, 07:30 AM   #3
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi,

Thanks for your advice.

Quote:
Originally Posted by p_s_shah View Post
-snip-
Basic Setup
Build your Ubuntu desktop and install Virtualbox.
Assign static IP to Ubuntu desktop. For e.g. 1.2.3.4. Assign one more IP e.g. 10.1.0.5.
Static IP is now assigned to Ubuntu desktop. The desktop is connected to Optical Fibre Broadband network with 100MB/100MB up/down

Quote:
Assign one more IP e.g. 10.1.0.5.
Please explain in more detail. Thanks

Quote:
Install Apache on Ubuntu desktop.
I don't expect installing Apache on Ubuntu desktop. I expect keeping the host clean.

Quote:
Build VMs (e.g. 4) on VirtualBox, assign IP from a separate VLAN for e.g. 10.1.0.10/11/12/13. Configure bridge mode, so that your VMs can be accessed from Desktop as well other VMs.
Install Apache and host sites on your VMs.
I'll use router to assign IP address to both host and VMs. The broadband will be connected to router.

Quote:
Make sure your sites are browseable from Destktop and other VMs.
Websites are now running on VMs. They can be browsed locally running /localhost/site_name. They can't be browsed on host because VMs are now connected to Internet via NAT. Host unable to ping the IP of VM.

Quote:
- snip -

Another Approach
You do not need any separate VMs. On a single Ubuntu Destop, configure Virtual host and alias and host all your sites with different doucment root. It's preety much simple.
Yes. That is the exact setup on Godaddy's share hosting which I'm now subscribing. It is quite simple. But I expect installing the website on VM for testing before upload the website to Godaddy's server

Furthermore:
This will be my 1st Test. The 2nd Test will be as follow;
1) The local server is not running 24/7. When it is down users will browse the websites on Godaddy's server
2) When the local server is up users will browse the websites on local server. The hosting plan which I'm now subscribing is with the function, the Premium DNS. Before subscribing Godaddy support team confirmed me in writing having this option.

Regards
satimis
 
Old 06-24-2014, 01:57 PM   #4
p_s_shah
Member
 
Registered: Mar 2005
Location: India
Distribution: RHEL 3/4, Solaris 8/9/10, Fedora 4/8, Redhat Linux 9
Posts: 237
Blog Entries: 1

Rep: Reputation: 34
Firstly, your "Furthermore:" we will take care once finalized with current part.

Second option that I suggested aligning to Godaddy's hosting option, you can tweak your configuration a little bit and get same result. For example, you can create four virtual host addition to main domain and configure different document root/mysql db with password protection, so only authenticated users can browse test sites.

Anyways coming to first option,
The setup I am suggesting, is your desktop will have two IPs: one static IP for accessing from internet and another one to communicate to VMs. This is for better security and complete control.

In VirtualBox setup, you will find some option of Bridge network, in which your desktop (VM guest) can ping IPs of VM hosts provided network criteria are meeting (like netmask, subnet, gateway etc.)

For VM network, you can have something like:
Network : 10.1.0.0/255.255.255.0
Default Gateway: 10.1.0.1
Guest IP: 10.1.0.1
VM IPs: 10.1.0.21/22/23/24
Do the standard network troubleshooting to make sure VMs are getting pinged from Desktop and sites are opening.

The second part about installing Apache, is because to have standard setup, where all traffic comes to static ip and port number 80. Your desktop will be connected to 10.1.0.0 network, so it will easily redirect traffic to port 80 of different VMs.

I am not sure your setup of routing traffic directly at router end, when your website names will be different. One option here is running websites on different ports like 1001/2/3/4 and redirecting traffic for those ports at router end. In this case, you do not need to install apache on Guest/Desktop.

I hope this clarifies your doubt.
 
Old 06-24-2014, 11:12 PM   #5
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi,

1)
To make my question simple. My problem is "routing".

- All domains are now pointing to the same static IP (only ONE), say 111.222.333.444
- All VMs are now assigned with an internal static IP, say e.g. 192.168.0.10. 192.168.0.11 etc.
- Name-based website are now running on VM. They can be browsed locally on their VM running /localhost/site-name.
- WAN, broadband is now connected to router.

How to make the websites browsed on Internet?

On googling I found several links with different suggestion. Which will be the reliable/appropriate steps for me to follow.


2)
Re your suggestion on posting #2 above

Quote:
Another Approach
You do not need any separate VMs. On a single Ubuntu Destop, configure Virtual host and alias and host all your sites with different doucment root. It's preety much simple.
I have another thought on it.

- install 4 name-base websites on a VM as test. They can be browsed locally (on VM browser running /localhost/site-name)
- router assign a static internal IP to the VM, say 192.168.0.10
- WAN (broadband) is connected to the router
- all ports on router are fowarded to 192.168.0.10
- all domains are pointing to the same external static IP, say 111.222.333.444

Can the websites be browsed on Internet?

If NO. How to make the websites be browsed on Internet?

Thanks

Regards
satimis
 
Old 06-25-2014, 08:17 AM   #6
kbnuts
Member
 
Registered: Apr 2014
Posts: 45

Rep: Reputation: Disabled
ok, lets go with the basics first.

Do you have a static IP from your ISP? In not, are you using dynamic DNS on the internet to pick up your changing ip?

Thats the outside part.

If it's a VM and you're forwarding the ports to the host rather than the VM directly (Personally I'd choose the VM directly and put (if possible) a static route into the router to tell it your VM subnet is located through your host) then you'll need to then set iptables on your host to forward it onto your VM. Also make sure net.ipv4.ip_forward is set to 1.

Now, if you're not masquerading then your router will STILL need to know how to get to your VM network as traffic will still come from your VM. So the only real solution without putting an additional static route in your router is to use NAT and masquerade your VM network.

Sorry if this is a bit confusing, what you've asked for requires some fiddling and theres a couple of different ways to do it.
 
Old 06-25-2014, 10:16 AM   #7
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi,

Quote:
Originally Posted by kbnuts View Post
Do you have a static IP from your ISP? ......
Static IP from ISP

Quote:
If it's a VM and you're forwarding the ports to the host rather than the VM directly (Personally I'd choose the VM directly and put (if possible) a static route into the router to tell it your VM subnet is located through your host) then you'll need to then set iptables on your host to forward it onto your VM. Also make sure net.ipv4.ip_forward is set to 1.

Now, if you're not masquerading then your router will STILL need to know how to get to your VM network as traffic will still come from your VM. So the only real solution without putting an additional static route in your router is to use NAT and masquerade your VM network.
.....
I'll configure bridge networking. I can forward ports to any VM from router

satimis
 
  


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
[Tcptraceroute/Traceroute/Ping] Windows VMs & Linux VMs BiFo Linux - Networking 0 08-24-2010 02:07 PM
web server files need protection from being browsed frieza Linux - Security 3 01-21-2009 09:29 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
squid+browsed information+per user basis sanw2k Linux - Networking 1 08-20-2003 02:17 PM
samba can be seen on the network, but not browsed. please help lewy Linux - Networking 4 10-01-2002 07:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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