LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 06-04-2015, 09:50 AM   #1
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Rep: Reputation: 51
Question How to setup virtual machine in a host that uses different ports?


Hello,

I'm using a linux machine (Fedora 19, but shouldn't matter that much) that serves pages through different ports than the default (for security and admin purposes, as I understand it). Can't change that, but see my end note below.

I have installed a Debian on a virtual machine (VirtualBox) that will suffice some needs I have that would be much harder to do in the used Fedora setup (and I can't change it easily, if at all possible).

Now I have the following problem: I have to setup this virtual environment to direct everything that comes to my machine through port 9982 (for example) to my virtual Debian port (which I can freely setup if needed, but I don't know how).

Further, if my Debian would use other ports for common sites (e.g.: PHP+SQL), I would have other port numbers to configure in this "pipe".

Note: I can't change most things in my Fedora setup, but I can make unused ports the "site ports" for my virtual machine. Id est, when I access http://localhost:9987/ in my host (or any machine that has access to it), I'll be accessing my Debian websites.

Normally I could use a virtual machine with network brige (so just a local lan would exist, in practice). But with these different details I'm not sure what's the best to do, or my options.

What do you suggest? And please detail the steps I must do.

Thank you

Last edited by dedec0; 06-04-2015 at 10:12 AM.
 
Old 06-04-2015, 10:16 AM   #2
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Just a small note: my host machine has a fixed IP and can be visible to others using its hostname. So, dynamic IPs or network setup problems should not exist.
 
Old 06-04-2015, 02:34 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,981

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
Ok, confusing.

A vm for the most part is a real computer. When one uses NAT for the client then a virtual router exists between the client and host. When one uses bridged then the host is more directly connected. All that shouldn't matter really. For example if your client is set to nat and it's ip is 10.10.10.10 and used port 801 for http then any traffic to that host would have to be sent as 10.10.10.10:801

The external router may be set to PAT (Port translation). Some can have public ip and dns for mysite.com translated to internal private ip:801 for example.
 
1 members found this post helpful.
Old 06-05-2015, 01:42 PM   #4
joec@home
Member
 
Registered: Sep 2009
Location: Galveston Tx
Posts: 291

Rep: Reputation: 70
Quote:
Originally Posted by jefro View Post
Ok, confusing.

A vm for the most part is a real computer. When one uses NAT for the client then a virtual router exists between the client and host. When one uses bridged then the host is more directly connected. All that shouldn't matter really. For example if your client is set to nat and it's ip is 10.10.10.10 and used port 801 for http then any traffic to that host would have to be sent as 10.10.10.10:801

The external router may be set to PAT (Port translation). Some can have public ip and dns for mysite.com translated to internal private ip:801 for example.
I got to agree, but on the router look at the difference between IP forwarding and Port Forwarding. With IP forwarding you are hosting one single server across the IP. With port forwarding you can forward different ports to different IP addresses. However there is one possible issue with Port Forwarding verse IP Forwarding. Streaming data hosting such as voice or video is often degraded when Port Forward is used. That all depends on the quality of router, how fast it can analyze the packets to get the port info verses the amount of traffic being passed.
 
1 members found this post helpful.
Old 06-09-2015, 11:07 AM   #5
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Thank you both for these comments. Audio and video streaming are not considered in my setup. But I'm still not sure what to do.

Is there any other detail I can give, so it is more clear?

Quickly, it is something like:

1- computers in room, local network (although each has real IP, they're behind firewall/configs we cannot change)

2- one mandatory configuration is that web (even locally) is not served through 80 or 8080, but through another known port

3- in the machine I use, I have set up a virtual Debian 8

4- now I want to make the virtual Debian accessible to the other local computers (dealing with the network setup of my machine, of course)

5- to have another port to access the Debian web, so it does conflict with my machine "normal" web serving is desired as an extra. This can be configured in my machine (the extra port traffic, for my service (lets call it a service).
 
Old 06-09-2015, 12:18 PM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Set up the VM with a NAT adapter and add a port forwarding rule in the host to push incoming connections on a port of your choosing to the VM.

If you want incoming connections to the host on port 9982 to be redirected to the VM, then add a port forwarding rule in VirtualBox to push connections on port 9982 to the VM. It doesn't get any more complicated than that.

https://forums.virtualbox.org/viewtopic.php?f=8&t=55766
http://www.howtogeek.com/122641/how-...t-as-a-server/

Last edited by suicidaleggroll; 06-09-2015 at 12:20 PM.
 
1 members found this post helpful.
Old 06-09-2015, 07:27 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,981

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
Are you saying that the web server is on local lan?
 
Old 06-10-2015, 01:42 PM   #8
joec@home
Member
 
Registered: Sep 2009
Location: Galveston Tx
Posts: 291

Rep: Reputation: 70
Just to overstate the obvious for web applications, this is why they have the vhost function of Apache. Only one web server is needed for multiple hosts.
 
  


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 to set the time of the virtual machine same as the host machine vjlxmi Linux - Newbie 6 01-20-2015 02:45 PM
Iptables: route web traffic of virtual machine through local proxy of host machine lola.hipf Linux - Networking 1 10-26-2014 07:09 PM
file sharing between a virtual machine and the host machine okok Linux - Networking 3 06-21-2013 12:42 AM
Accessing files available within a virtual machine from the host machine ed.kumar Linux - Virtualization and Cloud 5 08-03-2011 03:25 PM
How to configure the serial port of my virtual machine with host machine. akram Linux - Newbie 4 07-31-2009 10:39 PM

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

All times are GMT -5. The time now is 05:03 PM.

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