I was facing an issue recently and it is like this. I run a Ubuntu Linux Virtual Machine on a Windows guest. Because of my specific requirements I need to connect to a specific AP (wifi router) from a Windows machine.

Now, when I run my VM in Bridge mode I do not get any IP on the VM.

VirtualBox-Bridge


vbhadra@vbhadra-VirtualBox:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:1a:13:10
inet6 addr: fe80::a00:27ff:fe1a:1310/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8819 errors:0 dropped:0 overruns:0 frame:0
TX packets:7621 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4477485 (4.4 MB) TX bytes:3415333 (3.4 MB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:1671 errors:0 dropped:0 overruns:0 frame:0
TX packets:1671 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:157039 (157.0 KB) TX bytes:157039 (157.0 KB)

As you can see above the VM has got no IP at this point.

However, if I put the VM network in NAT mode then I get an IP which is good for all practical purposes.

VirtualBox-NAT


vbhadra@vbhadra-VirtualBox:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:1a:13:10
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe1a:1310/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8821 errors:0 dropped:0 overruns:0 frame:0
TX packets:7657 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4478330 (4.4 MB) TX bytes:3422460 (3.4 MB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:1703 errors:0 dropped:0 overruns:0 frame:0
TX packets:1703 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:159423 (159.4 KB) TX bytes:159423 (159.4 KB)

As can be seen the VM now, has got an IP 10.0.2.15. When you put your VM network adapter in NAT mode a private network is created for connecting to the host network through NAT.

This is not to suggest that if VM network adapter is in Bridge it should not get an IP from the host, as with another AP I get an IP. This seems depend on a FireWall setting or configuration on the AP your host is connected to. Somehow it doesn’t allow for the VM to have an IP when in Bridge mode.

Problem for me is if my VM is in NAT mode I do not be able to use FileZilla to transfer files between the Windows and the VM.

I am too used to using FileZilla and hence, did not try finding if there is any other options but tried resolving the problem in hand quickly.

To get over this issue you need to create a port forwarding rule on VirtualBox Network settings. This is how I got the issue resolved:

Go to the VirtualBox Box Manager (version 5.1.30) -> Netwok

VirtualBox_manager-1

Click on the Advanced button.

VirtualBox_manager-2

Click on Port Forwarding.

VirtualBox_manager-3.png

Click on the Add (+) sign on the right top corner.

Create a new rule as below:

VirtualBox_manager-4

Now, go back to your FileZilla and go to the site manager, fill in the following fields as the below example, Host: 127.0.1.1 (host loopback address), Port: 22, Protocol: SFTP, Logon Type: Normal, enter your Username and password and connect.

VirtualBox_manager-5.png

Now I can connect to my VM machine and transfer files easily as can be seen below:

VirtualBox_manager-6.png

If you have any question or query please feel free to post a comment in the below section.

 

4 Comments

Leave a Reply