port forwarding to a virtual machine using Virtualbox - networking

I want to forward a port to a VM. However i dont want the VM to be behind my host PC, i want it to be connected directly to the router so that packets coming on that port go directly to the VM without passing through my host PC.
In other words, i want the VM to look like any other machine on the network.
EDIT: i used bridged adapter, but i couldnt make it connect to the network.
Thank you

The VM will use the Ethernet port in all cases and the OS in it.
Typically if you have Windows and a VM with a bridged port, you will see the traffic flow when you take a capture on the Windows machine. IP won't be the one from the Windows machine but the traffic, like said, will flow through the same physical interface.
Secondly, you need to use a bridged adapter. For the details you can find help here: Bridged networking not working in Virtualbox under Windows 10

Related

How find correct Ip for connection Client/Server Qt?

I created two Qt apps: one client and one server.
I use them to send some data for handle a remote device.
If I am in localhost I haven't issues about them, but when i search to connect them by internet i don't know how to find correct Ip server to connect Socket Client.
How i can find this ip node?
Is there a class to find It?
you cannot find it automatically, if this is what you're asking about.
In real life you would deploy your server on some publicly accessible host, give it a domain name (important part as your host can change the IP address at any time) and connect the client via the DNS domain.
However if you're just playing around and you want to show to the world that your app works, specifying the IP address of the server in your client code would be perfectly fine (assuming you're running both the server and the client in the same network).
In that case, if you're running mac/linux run the command ifconfig (or just ip depending on the distribution). On Windows you can run the command ipconfig. Both windows and linux will give you a similar output resembling this:
Pay attention to the network adapters. There can potentially be many of them. You may have some emulated adapters if you have docker or VMWare, you may have the wireless adapters if you have a WiFi card, and then the ethernet adapters if your computer can connect to the the internet with an ethernet cable. Each of these adapters specifies a different IPv4 address. You want to pick the one that is connected to the same network as your client. So for instance if both your server machine and your client running machine are connected to the same wifi, you pick the address from the Wireless LAN adapter

How do I access my Ubuntu Server installed on Virtual box from anywhere in the World

I am trying to make an IOT using nodemcu and a LED. I want to access the Ubuntu Server(which is installed in the virtual box) through some other network(outside my LAN). How can I do it? I read many articles online, but I am not able to figure it out. I tried port forwarding but it did not work.
I am not sure what I am doing wrong. Is there's a problem in the port forwarding, or I am following a wrong method.
I have installed Ubuntu Server 16.04 LTS on my laptop via VirtualBox. I have installed LAMP. Also, network set to bridged adapter, plus I have dynamic IP
As I logged in, I ran ifconfig. It gave me the inet address as 192.168.16.101
Did you set the VM network interface to be NAT or Bridged?
If it is NAT, then you are essentially double NATTed which means you will need to port forward from your router to the VM host and then you will need to port forward from the host to the VM as the IP assigned will be local to the host machine.
However, the easiest is to set the VM network interface to Bridged.
This will mean the VM will be able access your network directly as it should be on the same subnet as your laptop and appear as another device, which your router will be able to port forward to.

Windows: How to redirect udp traffic to another port

I currently have a virtual machine running on Windows. The VM is running Linux and has a virtual box network between the windows machine and the linux machine. The VM is running a application that I want to be able to connect to from the outside world.
To make this possible I tried port forwarding from the windows internet interface, to the windows virtualbox interface. Finally I created another port forward from the windows virtualbox interface to the Virtual machine interface.
netsh interface portproxy add v4tov4 listenport=5000 listenaddress=10.11.65.103 connectport=7890 connectaddress=192.168.56.1
netsh interface portproxy add v4tov4 listenport=7890 listenaddress=192.168.56.1 connectport=5000 connectaddress=192.168.56.101
So if I connect to the 10.11.65.103:5000 on the Windows Machine it will be the same thing as connecting to 192.168.56.101:5000 of the VM.
[Win Internet Intf] [Win VM Intf] [VM intf]
10.11.65.103:5000<----->192.168.56.1:7890 <------> 192.168.56.101:5000
Unfortunately, this is not working for me... Can someone tell me why? Am I using port forwarding correctly?
If you use a bridged network adapter your Linux machine should pick up an IP off the host network (if you have DHCP enabled on the network, or set a static IP on the linux box). Then you should then not need the port forwarding.
If you cant use that approach and are using a NAT adapter (which it looks like you are), then you will need to enable port forwarding within VB. The details are in section 6.3 of the VB Help with this in place you should only then need the first port forward, VB will be doing the second.
Dont forget to make sure the relevant firwalls on the Windows and Linux machines are open.

Connect to VM running on the same computer without LAN

I have a windows 2003 VM running on my windows xp machine.
The machine name of the VM is itdom.domain.com
The windows xp host machine is disconnected from the LAN.
I want to be able to connect to the VM from the host and vice versa using there computer names. For example the URL http://itlab.domain:7080/domainsm must be accessible from the host computer.
Is there any configuration that I can do on any of the machine to do this.
Just because you have no physical network connection doesn't stop you setting up networking on the host and guest machines. One way of doing this is to add an IP address to the host machine's physical network port and create a bridged network on that port so that the guest can also see it.
You don't say which VM technology you are using, but in many of them you can setup an internal network between the host and guest. All you need to do then is edit each hosts file to add a hostname for the IP address of the other machine. You may also need to configure firewalls to allow access between the two.
No doubt there are also other ways to achieve this.

adding Virtual PC 2007 to host network

I am using Virtual PC 2007 with Windows xp Pro as the Guest.
Is it possible to add the Virtual PC to the network of the guest PC and to the domain of the Guest PC?
I enabled NAT shared networking but that only allows internet access on the guest..
Thanks
This shouldn't be a problem when you add the guest to host's physical adapter:
In the settings for your VM, go to Networking and instead of "Shared networking (NAT)", select the NIC that's connected to the network on your host (e.g. "Realtek RTL8116 Gigabit Ethernet", or whatever your NIC is; this is equivalent to VMWare's Bridged Mode). That way, the guest will appear as a real computer on your network, and will work like a physical box on the network.
IIRC, MS VPC bypasses the default Windows firewall on the host, so only the guest's firewall applies; for other FW products, you may need to enable something like "permit packets not destined for this host".
Just to add to the above answer-
1.
Inside the Local Area Connection
Properties- VM Network Services Driver
wasnt installed without which the NIC
option wont appear in the Virtual
machine Network Adapter Configuration.
I reinstalled the Virtual PC and that
entry Virtual Machine Network
Driver appeared.
2.
Another helpful resource-
http://blogs.msdn.com/virtual_pc_guy/archive/2007/01/15/fixing-broken-virtual-networking.aspx
Shouldn't be a problem as long as you can connect to a domain controller from the virtual computer.
If you know the IP address of a domain controller, try to ping it. Then try to ping it using the computer name, to see if name resolution is working correctly. What happens when you join a domain using Control Panel | System. Do you receive an error message?
I have not used Virtual PC, only VMWare workstation on Linux, so I do not know how the networking setup is on Virtual PC. On VMWare, you can choose between bridged and NAT networking for a virtual machine. I have been able to set up Windows guest computers as members of a windows domain using both kinds of network setup.

Resources