Linux Nerds Arise ....
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

[Closed] Linux Nerds Arise ..... port opening content

7 Posts
6 Users
0 Reactions
65 Views
Posts: 13916
Free Member
Topic starter
 

I've got a PC running Linux Mint. I like it lots but I have one issue that I can't figure out - I want to open port 80 to allow traffic through to an app running in a VirtualBox machine but for the life of me I can't get it to work ..... and it worked fine with Windows 7 as the host running VirtualBox.

Stuff I've done so far:
Created port forwarding in VirtualBox to allow port 80 and 8080 (latter is just to test) through to the virtual machine interface
Allowed everything through iptables
Opened up port 80 in UFW (firewall)
Given it a long hard stare
Sworn at it a bit
...... nothing works so far.

nmap [PC ip addy] shows all ports other than 8080 as being closed.

But if I run python simpleserver 80 on the host PC it works fine - so it seems it will open port 80 if there's something listening on the host PC (i.e. simpleserver) but it won't if there isn't.

Anybody got any suggestions?


 
Posted : 06/07/2019 11:41 am
Posts: 0
Free Member
 

install windows.


 
Posted : 06/07/2019 11:43 am
Posts: 13916
Free Member
Topic starter
 

I'd rather not!


 
Posted : 06/07/2019 11:44 am
Posts: 4954
Free Member
 

If you do a nmap from anothe machine is the port showing as open?

How is you NIC set-up in your VM? Bridged? NAT? I always go for bridged personally.

Have you tried receiving data on port 80 to the Linux host?(without the vm running) I guess this is what you did with your python simple server?

Have you tried any wireshark logging on VM and or host?


 
Posted : 06/07/2019 12:01 pm
Posts: 0
Free Member
 

If this was a Linux forum I'd get on my high horse, rant and tell you to RTFM (or the man page) 😄

Anyway, you have an app inside the VirtualBox that listens on port 80 and trying to expose that to something on the host machine, or to outside of the host machine?

I don't know VirtualBox much, but like a lot of VMs, the network configuration often needs to be set on the VM in the right way for the VM to be seen to the outside world. There are many options to set up the network and may involve a virtual adaptor on the host to get it right (bridge or NAT). http://www.virtualbox.org/manual/ch06.html#networkingmodes

In Windows, this is all relatively easy as the VM system will set up the network adaptors for you. Not sure with Linux.

Alternatively, can the app be "containerised" and run in a Docker container? (or is there already a Docker image that has that app?). Containers are fairly easy to expose the port on. More lightweight than a full VM too.


 
Posted : 06/07/2019 12:01 pm
Posts: 4954
Free Member
 

Also what does netstat return on host?


 
Posted : 06/07/2019 12:06 pm
Posts: 77347
Free Member
 

Back up a bit.

So you've got a PC running Linux. On this is Virtualbox running, what, another Linux guest presumably? Then you've got a web server running on the guest (you have installed a web server, yes?) and you want to access this from... where? The host PC or another machine on your LAN?

What's the networking look like? Has the guest got an IP in the same range as everything else, or is it a separate private network? I've never used Virtualbox, but when I created a VM on Linux with QEMU it was the latter - it created a virtual NIC on the host of 10.0.0.1 and on the guest as 10.0.0.2.

In the Windows world, by default the firewall will allow all outbound traffic and block all inbound - browsing the web works because even though it's inbound traffic it's in response to an outbound request. I would, perhaps naively, expect Linux to work in a similar fashion. I might be tempted to disable all the Linux firewall stuff at least temporarily until you get it working, it's one less variable to worry about.

Forget ports - can you ping it?


 
Posted : 06/07/2019 12:32 pm
Posts: 12072
Full Member
 

Don't forget on Linux you need superuser rights to open ports <1024 - obviously including 80.


 
Posted : 06/07/2019 6:01 pm

6 DAYS LEFT
We are currently at 95% of our target!