Vagrant Virtualbox Webserver, Cannot access from external network - apache

I am having an issue and I am not sure where to go, hopefully you guys can help me out here.
I have a virtual box machine that has a bridged network, therefor the device is on my LAN and there is network connectivity to the device.
I can connect to the web server using my local ip adress 192.168.2.41:25878, however when I try to connect to it with my public IP address x.x.x.x:25878 the web browser is waiting for a connection but it never seems to establish.
Here are my config files for Apache2 / Vagrant
VagrantFile - https://gist.github.com/anonymous/7cca95da3cfc22de5333
Apache2 Site - https://gist.github.com/anonymous/d60efd938d9d7d7de60e
Ports.conf - https://gist.github.com/anonymous/8b0c20a78b36cc5d03b0
The port forwarding is correctly set up on my router. What is really puzzling me, is that I am able to connect to the web server using the local IP address 192.168.2.41:25878, however I cannot access it via the public IP address. The web browser is not rejecting the connection, so I am assuming that I have a config error somewhere, specifically in apache.. The web browser shows a spinning wheel when trying to connect.
I've been trying to solve this issue for almost a week now.. I would appreciate any help that you guys may provide.

SOLVED
So I am not sure why the setup above was not working... I changed from bridged networking to NAT and setup host to guest port forwarding through Vagrant (VirtualBox) and it started working!
I also switched to Nginx instead of using Apache.

Related

Trying to connect to the pfsence web interface

I have installed and set up pfsence on virtual box and it is booting up properly and seems to be working fine. My problems are:
When I tried to ping the LAN IP from my computer's command prompt it does not receive the packets but if i ping it from inside the virtual machine using pfsence then it returns packets.
Also if I try the IP in the browser it does not take me to the pfsence interface. I used all defaults when installing the the pfsence.
Any suggestions will be welcomed
LAN IP - 192.168.20.20
pfsence version - 2.4.5
This means that you are unable to route into the VM from your computer. What is the Network Adapter for your VM attached to in your VirtualBox settings? If you configure it with a NAT you can achieve your desired configuration.
https://www.virtualbox.org/manual/ch06.html#network_nat

Accessing localhost via a VPN connection

Goal
I am trying to setup a secure connection to a PC in our network.
The goal is to be able to access a domain, api.mydomain.test, on that PC, that is served by Apache.
Setup
To securely connect to the server, I have implemented the Softether VPN Server on the PC. The VPN network must be separate from our own local network, which the PC is also on.
The idea is to add an IP whitelist in the vhost record op Apache to allow only people on the VPN subnet to connect to the domain api.mydomain.test. Next to this filter, we also added a firewall to the PC to not allow any connection on port 80 or 443.
Issue
I can connect to the VPN perfectly and receive an IP ofthe subnet 10.11.12.x.
However, I can't seem to be able to access the server on localhost or via the IP of the other network the PC is on (10.10.2.x).
To be frank, I don't even know how to do this when connected to the VPN.
What have I tried?
Use a local tap bridge instead of virtualNAT and virtual DHCP.
This was not working as expected, because then the VPN clients (my laptop) did not receive an IP.
Add routes to allow 10.11.12.x IPs to access localhost.
According to documentation of Softether, the virtual NAT does not use the routes, so this would be useless for our goal.
What I do not know, is how this is normally setup?
I have the feeling I am trying to do this the wrong way, so any ideas or different approaches would be greatly appreciated!

Localhost works, but ip gives timout

I am trying to setup a LAMP environment on my laptop with Ubuntu 18.04.
I have no experience real previous experience with this and all tutorials i find are just a step for step guide on how to setup, but none explain what you are exactly doing.
So I don't know why I am having this problem.
After installing all parts of LAMP I can access localhost, and I see the apache default page.
But if I try to go to my IPaddress, (the ipaddress I found with curl -4 icanhazip.com) the page loads for a while and then tells me this:
Firefox can’t establish a connection to the server at 213.127.26.xxx
So my question is am I using the right IPaddress and how can I make apache work from my IPaddress? Because phpmyadmin will not work on localhost.
The issue is likely that your local ports (i imagine your web server is running on port 80 or 8080) are not being forwarded through your router. Your router likely uses something called “NAT (network address translation)” to expose all of the internal IP addresses on your network through a single “public” IP address, in your case 213.x.x.x (you should never post this here unless you’re 100% positive your network is secure!). Your router needs to be configured to forward port 80 on 213.x.x.x to your machine’s “internal” ip address, likely something like “192.168.x.x” or “10.0.x.x”. A search for “port forwarding ” should help you out
Alternatively, ngrok is a nice free tool which you can use to expose your port on a public address. By running nginx http 80, it will provide you with a temporary url where you can reach your site (on a free plan, it will only provide you that url for one day, so you will need to re-run it)
First, you have to find out on which ports your server is running.
After that, you have to go into your router's settings and add port forwarding entries for these ports, to make sure that your router forwards the requests to the right device.

Wamp server only allows external connections from external ips

It has been a while since I started using wampserver online, and until now it all went fine, but I recently started having a problem: I can access the server through a local ip (192.168.1.37 | 127.0.0.1 | localhost) if connected to my router or from my router's ip (e.g. 83.85.44.55) if im NOT connected to my router.
So basicaly if I'm connected to my router and try to access the servel with my router's external ip, I get a timeout error, whereas if someone from for example India tried to connect he would be able to do so.
I'm currently using wampserver 2.5 for windows with apache 2.4.9 and have already re-installed everything.
Thanx in advance.
Elemermelada -
Port forwarding can be tricky when you are trying to access the server from multiple networks (i.e. your internal network and somewhere else on the internet). You are able to access the server with it's local IP because you are on the same subnet and there is no routing being done. When you attempt to connect to your webserver with your router's IP address, you are never making it to the webserver, regardless of the NAT/Port forwarding in place. The traffic is being dropped by your router because you are trying to access it from the inside. Unless you have a router that can be configured in a certain way, you will always need to connect to your webserver by it's local IP address when you are on it's local network.

Can't Port Forward To Ubuntu Web Server

I've set up an Ubuntu Web Server to host a game that uses port 25565.
I've set the router to port forward that port to the web server and gave the web server a static local IP. I've done this before using my own PC as the server.
When I try accessing the web server on that port using it's local IP I have no problem at all.
But, when I try accessing it from outside the network, I can't connect.
I've opened my router's list of DHCP clients and the web server is only listed there sometimes without a pattern I've been able to see.
Why I think the error is at my router:
I've installed Wireshark on the server to see if Apache was somehow blocking the web packets upon arrival. I tried opening all ports and I tried opening port 10000 which webmin uses (I'm able to connect to it locally). Neither has been successful.
Although I'm not experienced in the field, I don't think the packets get to Apache.
Please assist. Thank you!
Does your router hold the external IP address, or an internal one?
If it holds a private IP like 192.168.x.x, 10.x.x.x, or 172.16.x.x, then you would need to setup port forwarding on whatever device your router is connected to.
I've managed to fix it by changing the web interface of the port forwarding from atm1.1 to ppp1.1. It was just luck, as I understood it's web protocols but I don't know why it worked.
Thanks everyone for the help!