I followed the example in the user guide for forwarding 2222 on the host to 22 on a guest, and I can now ssh to the guest just fine. I'm not able to get other ports forwarding properly, though:
new-host-2:centos dan$ VBoxManage getextradata centos enumerate | grep guesthttp
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/Protocol, Value: TCP
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestPort, Value: 80
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/HostPort, Value: 8080
I have apache running in the guest on 80, and it's definitely running/listening - I can telnet to 80 from inside the guest, and I can verify that it's listening via netstat, lsof, etc. I've restarted the VM (i.e., all VirtualBox apps on the host) a couple of times, but that doesn't appear to change anything.
Oddly, the VirtualBox apps do appear to be listening on 8080 on the host:
new-host-2:centos dan$ lsof -P | grep Virtual | grep LISTEN | grep 8080
VirtualBo 73773 dan 39u IPv4 0x8a9a66c 0t0 TCP *:8080 (LISTEN)
But when I connect to them and try to push some data across, I get nothing back. tcpdump shows the data being consumed by the VirtualBox process, but nothing makes it through to the guest.
I've tried this with other ports and simple netcats on the guest/host, but I get the same results that I get with the apache setup described above.
The host is running VirtualBox 3.0.12, Mac OS X 10.5.8, and the guest is CentOS 5.4.
Any ideas what I'm doing wrong?
TIA,
Dan
port forwarding partial success
-
Sasquatch
- Volunteer
- Posts: 17798
- Joined: 17. Mar 2008, 13:41
- Primary OS: Debian other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows XP, Windows 7, Linux
- Location: /dev/random
Re: port forwarding partial success
You connect to localhost from the Host, right? Just open http://localhost:8080 in your browser, should open the Guest.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
-
MarkCranness
- Volunteer
- Posts: 875
- Joined: 10. Oct 2009, 06:27
- Primary OS: MS Windows 7
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows Server 2008 R2; Ubuntu 11.04; Windows 2000 Server; Windows XP
Re: port forwarding partial success
Does your guest have IP 10.0.2.15, or some other static IP assigned? (Your SSH experience says it must be the default 10.0.2.15). Is Apache in the guest listening on 10.0.2.15:80, or *:80, or some other IP?
If the answer is 'some other IP', then either change that IP to * or 10.0.2.15, or also use this (undocumented) port forward setting:
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestIP, Value: some.other.i.p
If the answer is 'some other IP', then either change that IP to * or 10.0.2.15, or also use this (undocumented) port forward setting:
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestIP, Value: some.other.i.p
-
djk121
- Posts: 2
- Joined: 25. Nov 2009, 04:25
- Primary OS: Mac OS X other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: CentOS
Re: port forwarding partial success
Sadly, I'm just an idiot. The default server install of CentOS 5.4 (and probably earlier versions) has iptables configured to drop most everything. Once I turned iptables off, everything worked fine.MarkCranness wrote:Does your guest have IP 10.0.2.15, or some other static IP assigned? (Your SSH experience says it must be the default 10.0.2.15). Is Apache in the guest listening on 10.0.2.15:80, or *:80, or some other IP?
If the answer is 'some other IP', then either change that IP to * or 10.0.2.15, or also use this (undocumented) port forward setting:
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestIP, Value: some.other.i.p
Sorry for the noise, and thanks for the help.
Dan