I'm a new bee of VB, and have searched the forum but too many results coming back that makes me can not identify my questions.
I have meet some problems when I use 2 network cards for the GUEST OS, and use NAT and set port forwarding for special services.
My first question is: How can I identify 2nd network card from blow line,
Devices/pcnet/0/LUN#0/Config - pcnet/1/LUN#0 or pcnet/0/LUN#1 ?
What about 3rd and 4th network card?
2nd question is: How can I add 1 more protocol for specific service?
for example, I have indicate TCP to MySQL on 3306 port, now I want to add UDP to this port also, how can I do it?
Any advise will be greate appreciate.
Configuring NAT port forwarding
-
TerryE
- Volunteer
- Posts: 3572
- Joined: 28. May 2008, 08:40
- Primary OS: Ubuntu other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
- Contact:
Re: The questions of the Virtual Box
Hi orro and welcome to our forum. You might want to take this opportunity to browse the Forum Posting Guide. This contains some useful tips on how to search for VBox knowledge and how to frame Qs. (BTW, you will see that I've change you title to reflect your Q.)
The trick here is to look at the Devices enumeration listed in the VBox.log (focus on the VM in the VBox GUI and hit ^L to browse this). Each different device driver type has a name. In this case pcnet for PC Network. You can have multiple devices, and each has a config. The config tells you what the specific type is, etc. Some device drivers (such as IDE) can have multiple LUNs. Now the point is that the different NICs can be different virtual devices, so they must be Devices/pcnet/0 up to Devices/pcnet/3 for network cards 1 to 4.orro wrote:Devices/pcnet/0/LUN#0/Config - pcnet/1/LUN#0 or pcnet/0/LUN#1 ?
Easy, just add another block of 3 setextradata commands to specify the map are just use the following batch scriptorro wrote:How can I add 1 more protocol for specific service?
for example, I have indicate TCP to MySQL on 3306 port, now I want to add UDP to this port also, how can I do it?
Code: Select all
@echo off
rem
rem SetVMportMap.cmd
rem
rem P1 = VM name or UUID
rem P2 = Device Number
rem P3 = Service Name. This is arbitrary but should be unique for each triplet
rem P4 = Protocol
rem P5 = guest port
rem P6 = host port
rem
rem EXAMPLE
rem
rem call SetVMportMap.cmd myVM 0 mysqlUDP UDP 3306 3306
rem
set SVM=VBoxManage setextradata %1
%SVM% VBoxInternal/Devices/pcnet/%2/LUN#0/Config/%3/Protocol %4
%SVM% VBoxInternal/Devices/pcnet/%2/LUN#0/Config/%3/GuestPort %5
%SVM% VBoxInternal/Devices/pcnet/%2/LUN#0/Config/%3/HostPort %6
:endRead the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
Google your Q site:VirtualBox.org or search for the answer before posting.
that does not work on multiple guests
As stated above, you can configure multiple settings for different types of port forwarding. e.g. guestssh and guesthttp. But notice that those settings are usually only possible for one guest OS at the same time, unless you use host interface.
That's because a guest OS under NAT must have its IP address 10.0.2.15, the default IP address, in order to let port forwarding work correctly. If a guest OS has any other IP address, say 10.0.2.19, then port forwarding does not work at all. Therefore you cannot enable multiple port forwarding for multiple guests at the same time, since only one guest is able to have the IP address 10.0.2.15.
I don't know why VirtualBox doesn't support such a functionality. It looks somehow weird, though it's true as I have tried so far.
That's because a guest OS under NAT must have its IP address 10.0.2.15, the default IP address, in order to let port forwarding work correctly. If a guest OS has any other IP address, say 10.0.2.19, then port forwarding does not work at all. Therefore you cannot enable multiple port forwarding for multiple guests at the same time, since only one guest is able to have the IP address 10.0.2.15.
I don't know why VirtualBox doesn't support such a functionality. It looks somehow weird, though it's true as I have tried so far.
-
TerryE
- Volunteer
- Posts: 3572
- Joined: 28. May 2008, 08:40
- Primary OS: Ubuntu other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
- Contact:
Your wrong. I've used multiple VMs at the same time port fowarding the same service. You just need different port numbers. E.g. I had 3 VMs with ports 2221, 2222, 2223 forwarding to their respective port 22 for SSH control.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
Google your Q site:VirtualBox.org or search for the answer before posting.