LinuxQuestions.org
Help answer threads with 0 replies.
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 04-02-2021, 09:23 AM   #1
morning-tea
Member
 
Registered: Oct 2020
Posts: 65

Rep: Reputation: Disabled
How to make a server on VM to be browsed on Internt


Hi all,

This is an experiment, not for production. I'm prepared installing a Linux server on VM. Now I'm searching a solution to attach the static IP of the PC to VM so that the server can be browsed on Internet.

Say for example;
Public static IP of PC - 123.456.789.012
Internal IP of VM assigned by router - 192.168.0.10

Can any folk shed me some light? Pointers would be appreciated.

Thanks in advance.

Regards
 
Old 04-02-2021, 09:46 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
This is the same as exposing a physical machine in your home network to the internet. The secret is port forwarding.

One way is turning the VM into a VPN server and programming your router to forward the VPN's port to the VM. Anybody on the internet who wants to access the VM needs a matching VPN client. This is good for security reasons.

Or perhaps you run a web server on the VM. Then, you can forward ports 80 and 443 to it, and anybody can access your VM. Which is questionable because not everybody has good intentions.

Or you forward port 22 for SSH access. In this case, disable password-based login.
 
Old 04-02-2021, 10:52 AM   #3
morning-tea
Member
 
Registered: Oct 2020
Posts: 65

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
This is the same as exposing a physical machine in your home network to the internet. The secret is port forwarding.
Thanks for your advice. Since this is an experiment I prefer to do the easy way first.

Quote:
One way is turning the VM into a VPN server and programming your router to forward the VPN's port to the VM. Anybody on the internet who wants to access the VM needs a matching VPN client. This is good for security reasons.
I don't prefer programming my router because there are some other PCs on the local network.

On Internet searching I found below 2 documents;
How to setup a Virtual Machine VPN
https://torguard.net/blog/how-to-set...l-machine-vpn/

Using A VPN Inside A Virtual Machine For Extra Anonymity
https://greycoder.com/using-a-vpn-in...a-anonyminity/

Would they be relevant? Or any other documents to be suggested by you? Do I need to register a VPN account?

Quote:
Or perhaps you run a web server on the VM. Then, you can forward ports 80 and 443 to it, and anybody can access your VM. Which is questionable because not everybody has good intentions.
It sounds to me to be an easy setup. Security is NOT very important to me because this is an experiment for learning building a web server on VM. Any document to follow? Thanks

Quote:
Or you forward port 22 for SSH access. In this case, disable password-based login.
I did it years ago for remote accessing a VM. I already forgot how to do it. Any document for me to refer to? Thanks

Regards
 
Old 04-02-2021, 06:36 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by morning-tea View Post
I don't prefer programming my router because there are some other PCs on the local network.
I should have used the term "configuring" instead of "programming". Your router is configured to refuse any connection requests to your internet address 123.456.789.012. Without configuring port forwarding on your router, no traffic can reach your home network from the internet.

With VPN, I mean setting up your own VPN server on that VM. This means that you will register with your own VPN server, not with a public one. The two links you found describe public VPN services for reaching internet sites without revealing your IP address. They don't allow reaching your VM from the internet. To do the latter, you need something like OpenVPN; there are plenty of instructions for setting up and using an OpenVPN server.

Of course, in addition to setting up OpenVPN, you still need to configure port forwarding on the router.

To make your VM reachable via SSH, ensure that it has an SSH server (most Linux distros run it by default), set up key-based authentication, and configure port forwarding on the router.

To make your VM reachable via HTTP or HTTPS, you need a web server and port forwarding on the router. Since no authentication is involved, be ready for people with bad intentions breaking into your home network.

I would have to search the internet for instructions, and am sure you can do that as well.

Last edited by berndbausch; 04-02-2021 at 06:38 PM.
 
Old 04-02-2021, 07:18 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,008

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
Just to mention something I didn't see (or didn't read enough.)

There are a few ways to use networking on a VM. Bridged may be easier but even in NAT you'd need to also be sure to know of any port restrictions on client or host.
 
Old 04-02-2021, 10:48 PM   #6
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by jefro View Post

There are a few ways to use networking on a VM. Bridged may be easier but even in NAT you'd need to also be sure to know of any port restrictions on client or host.
That's an additional complication we will tackle once the internet router question has been resolved.
 
Old 04-03-2021, 11:24 PM   #7
morning-tea
Member
 
Registered: Oct 2020
Posts: 65

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
Just to mention something I didn't see (or didn't read enough.)

There are a few ways to use networking on a VM. Bridged may be easier but even in NAT you'd need to also be sure to know of any port restrictions on client or host.
Bridge Networking solves the problem making VM to connect Internet. But how to make Internet to connect VM? Remote access is a solution which I did years ago and I'm now digging the solution from my database. Browsing VM webserver on Internet is another question because VM is behind the router. Dynamic IP is even more complicate

I'm now reading following documents found on Internet

How to configure a LAMP stack on Ubuntu 20.04.
https://www.digitalocean.com/communi...n-ubuntu-20-04

How can I set up a Dynamic DNS fetching service on Ubuntu Server?
https://askubuntu.com/questions/7304...-ubuntu-server

Ubuntu as a home server. Part 1. Dynamic DNS.
https://www.outcoldman.com/en/archiv...1-dynamic-dns/

Regards

Last edited by morning-tea; 04-03-2021 at 11:25 PM.
 
  


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] zencafe - server to client pc, all working except client pc getting internt access captain_sensible Linux - Newbie 3 06-08-2010 10:37 AM
zte fm 626 connection to the internt problem eslam Linux - Networking 0 09-11-2009 03:00 AM
web server files need protection from being browsed frieza Linux - Security 3 01-21-2009 09:29 AM
Mandriva 2005 LE - Internt problems. linux_catman Mandriva 5 09-06-2005 09:45 PM
internt connection failing on SuSe 9.0 Pro? SamJ Linux - Newbie 2 02-08-2004 05:04 PM

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

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