0

Hello in virtualbox I installed Debian 8 and my web application which is running on port 8000. Virtualbox network I have in network settings bridged adapter and I can connect there via ssh from my computer. Virtualbox have ip address: 192.168.88.65 My computer have ip address: 192.168.88.51 It is in one site.

I would like have access to my web app from my computer on port 8000. But when I run nmap on my computer I see only this ports:

Nmap scan report for test (192.168.88.65)
Host is up (0.0023s latency).
Not shown: 998 closed ports
PORT     STATE SERVICE
111/tcp  open  rpcbind
3306/tcp open  mysql

but in virtualbox computer it is:

Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000030s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 996 closed ports
PORT     STATE SERVICE
25/tcp   open  smtp
111/tcp  open  rpcbind
3306/tcp open  mysql
8000/tcp open  http-alt

How can I see the port 8000 from my computer??

I am trying run this commands in virtualbox but it doesn't work:

root @ debian /root ### iptables -I INPUT -p tcp --dport 8000 -j ACCEPT
root @ debian /root ### iptables-save

# Generated by iptables-save v1.4.21 on Mon Mar  6 10:11:58 2017
*filter
:INPUT ACCEPT [57:123601]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [44:124193]
-A INPUT -p tcp -m tcp --dport 8000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8000 --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT
COMMIT
# Completed on Mon Mar  6 10:11:58 2017
1
  • Please provide the output of netstat -tlpn.
    – Daniel B
    Mar 24, 2017 at 20:24

1 Answer 1

0

The iptables rules you inserted are redundant because as the output of your iptables-save command shows, the INPUT policy is ACCEPT, so any connection will be allowed.

I could be wrong but my suspicion is that since you are using a bridged adaptor, it is subject to firewall rules on your host machine, and is not allowing you to reach your target port.

Unless you absolutely need a bridged adapter inside of your VM, I would recommend switching to NAT and simply using the port forwarding capability of VirtualBox.

Under Settings > Network > Adapter 1

Change the field "Attached To" to NAT.

Under "Advanced", hit the "Port Forwarding" button and add an entry:

Name: http (or any name you want)
Protocol: TCP
Host IP: (blank)
Host Port: 8888 (or any port you want)
Guest IP: (blank)
Guest Port: 8000 (match your web app port)

You can then start your VM (guest) and then from your host computer, open a browser and access your web app by going to endpoint below (appending any path you may need).

localhost:8888

For convenience, if your host machine is UNIX based, you can add a line to /etc/hosts like this:

127.0.0.1 myapp.com

Then you can use:

myapp.com:8888

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.