Page 1 of 1
NAT / Static IP / Port Forwarding
Posted: 21. Apr 2009, 14:13
by daimon
Hi!
I'm using Virtualbox 2.2.0 with a Debian Lenny guest on an Ubuntu 8.10 Host.
The Network is set to NAT (I cannot use Host interface due to internal networking difficulties).
I've setup Port Forwarding via the commands
Code: Select all
VBoxManage setextradata "virtual core" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/Protocol" TCP
VBoxManage setextradata "virtual core" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestPort" 80
VBoxManage setextradata "virtual core" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/HostPort" 4280
VBoxManage setextradata "virtual core" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata "virtual core" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
VBoxManage setextradata "virtual core" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 4222
This Stuff runs fine, as long as i keep the guest network card set to DHCP. As soon as i give it a static IP, Port Forwarding ceases to function.
Outgoing traffic from the guest works just fine.
Can anybody push me in the right direction to solve this problem?
Perhaps it is possible to reconfigure the VirtualBox DHCP Server to only serve a specific IP?
Thanks in advance,
Stefan
Re: NAT / Static IP / Port Forwarding
Posted: 21. Apr 2009, 14:19
by vbox4me2
I think port forwarding is based on all Guest having the same IP settings allowing to use VM names on the Host, once you change this the Host VBox Core can't connect to the Guest this way.
Re: NAT / Static IP / Port Forwarding
Posted: 21. Apr 2009, 14:49
by Sasquatch
This Stuff runs fine, as long as i keep the guest network card set to DHCP. As soon as i give it a static IP, Port Forwarding ceases to function.
Outgoing traffic from the guest works just fine.
Duh, NAT is designed to be used with DHCP. Setting a static IP other than the one supplied by the DHCP will give errors. Why do you want to change it's IP address? If your host network doesn't use the 10.x.y.z range, it won't conflict with anything. If it does, read the manual.
Re: NAT / Static IP / Port Forwarding
Posted: 21. Apr 2009, 15:57
by daimon
Duh, NAT is designed to be used with DHCP. Setting a static IP other than the one supplied by the DHCP will give errors. Why do you want to change it's IP address? If your host network doesn't use the 10.x.y.z range, it won't conflict with anything. If it does, read the manual.
NAT and DHCP, while often used together, are completely independent networking technologies (I don't know about the virtualbox implementation of NAT, though).
I am using an IP of the 10.0.2.4-254 range, and everything works fine - except for the port forwarding.
The reason I need a static IP: One of our application demands that the IP is not changing. If it does, it stops working (#%!ยง$ licensing issues...)
So If I have to use the VBox DHCP Server, I can only use it if i am able to restrict the issued leases to a single IP Adress.
Thanks
Stefan
Re: NAT / Static IP / Port Forwarding
Posted: 21. Apr 2009, 16:14
by Sasquatch
That's so great about a search function, and a manual. Even though you would request a new IP every single time, you still get the same one with NAT in VB. You confuse VB NAT with the regular NAT that your home router provides.
Re: NAT / Static IP / Port Forwarding
Posted: 21. Apr 2009, 16:14
by daimon
When I set the static IP to 10.0.2.15 (the last one i got through DHCP), port forwarding works.
Does the DHCP Server only issue this address? Then everything would be fine...
Re: NAT / Static IP / Port Forwarding
Posted: 21. Apr 2009, 16:22
by daimon
Sasquatch wrote:That's so great about a search function, and a manual. Even though you would request a new IP every single time, you still get the same one with NAT in VB. You confuse VB NAT with the regular NAT that your home router provides.
Ah great. First of all, thanks for helping me. The issue is resolved, if the DHCP server only issues the .15 address.
Second: Kindly show me the passage in the manual where this is described before patronizing me. Or in the forum. Anywhere on the net (in connection with port forwarding, of course, cause you see, that was my issue).
No hard feelings
Stefan
Re: NAT / Static IP / Port Forwarding
Posted: 29. Jun 2009, 12:57
by z0n
..for anyone still following this, the help topic is "9.12. Configuring the address of a NAT network interface". It is hidden right at the end of the manual in the "Advanced topics" section (conveniently close to the "Troubleshooting" section)
Judging by the amount of questions I've seen floating around the Net (while out hunting this same answer) regarding VB's built-in DHCP server and the IP addresses it assigns, I'd say Sasquatch can stick ModEdit: contents removed, there is no need for faul launguage..