LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 09-21-2008, 12:07 PM   #1
matruschka
LQ Newbie
 
Registered: Jul 2002
Posts: 22

Rep: Reputation: 15
How to forward port to listening apps inside VirtualBox?


Hi!

I'm running VirtualBox 2.0.2 on my Slackware 12.1 system and it's working just fine,BUT:

When I'm trying to access TightVNC server running on a virtual XP pro sp3 machine I just don't get it to work.

The box I'm using TightVNC viewer on (eg. is trying to connect from) is on my main LAN (ip address: 192.168.0.129) and the virtual XP machine is on VirtualBox's default subnet (ip address 10.0.2.15. The Slackware host has ip address 192.168.0.100).

This is what I've done so far:

Successfully creating a temporary network bridge with:

modprobe tun
chmod 666 /dev/net/tun
brctl addbr br0
ifconfig eth0 0.0.0.0 promisc
brctl addif br0 eth0
dhcpcd -t 30 -h slackware-host br0 &
VBoxAddIF vbox0 root br0

Yada yada yada...

Then I did

/usr/sbin/iptables -t nat -A PREROUTING -p tcp -i br0 -d 192.168.0.100 --dport 5901 -j DNAT --to 10.0.2.15:5900
/usr/sbin/iptables -A FORWARD -p tcp -i eth0 -d 10.0.2.15 --dport 5900 -j ACCEPT

And it's probably here I screw up? Using ifconfig after creating the bridge lists all interfaces except the bridge itself with their IPv6 addresses and the iptables port forwarding stunt above didn't work at all when I tried to use the one for the vbox interface.

Sharing a folder on the virtual XP machine made the Microsoft Windows Network the virtual XP machine is on to appear in "My Network Places" on the XP client with the TightVNC viewer,but the shared folder never appeared (did in "My network places" on the virtual XP machine though).
So there is something alive in there...

Any genius with some ideas? I'm all out right now.

*Edit*

I got it to work!

I created a network bridge like before,not using the iptables commands this time.
And then,in VirtualBox,I selected the virtual XP pro sp3 machine in the virtual machines list and:

Network > Settings > Adapter 1 >
In the "Attatched to"-menu,I changed from NAT to Host interface.
In the "Interface Name"-field, I typed the name of the VirtualBox interface (vbox0).

Last edited by matruschka; 09-22-2008 at 12:03 AM. Reason: Problem solved
 
Old 09-24-2008, 07:44 AM   #2
aus9
Guru
 
Registered: Oct 2003
Posts: 5,060

Rep: Reputation: Disabled
Thats very nice of you to show others how to fix.

Maybe when you get a chance, consider a wiki entry or asking mods to move this to success stories?

cheerio
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Port not listening shadetree Linux - Networking 2 08-27-2008 03:07 PM
Howto do Secured ssh from port https or port80(standard) to ssh d listening port 22 ? Xeratul Linux - General 4 11-23-2006 06:09 AM
Outside FTP Port 21 redirect to different port inside LAN??? hendrixx Linux - Security 5 06-05-2004 06:42 PM
Forward port port 80 to lan web server dulaus Linux - Networking 9 10-04-2002 03:45 AM
how do i forward a port to and inside IP parabit Linux - Networking 3 01-09-2002 10:17 AM


All times are GMT -5. The time now is 09:22 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration