I have Ubuntu running in VirtualBox and getting Internet access, via the host OS, from my office wlan.

Sometime I take the laptop out of the office and use my mobile as a 'wireless hotspot' to get Internet access. This all works fine for the host OS but I can't get Ubuntu to 'see' the internet when I'm using the 'wireless hotspot'.

I have one nic defined in the VM and it looks like this :

I've tried adding another nic in NAT mode (which is what I think is being advised here) but that didn't help.

I think perhaps I need to do the nic in NAT mode but then make changes to the /etc/network/interfaces file but I don't know what changes necessary.

1 Answer
1

Firstly the VM had previously been setup to use a fixed IP in bridge mode so I changed /etc/network/interfaces so that it went back to the 'normal' value for eth0 ...

auto eth0
iface eth0 inet dhcp

Secondly I realised (embarrased to admit this but it's true) that when using something other than the first tab in the 'Network Devices' of Virtualbox ... like this where I'm using the third tab ...

... I had to be making changes within /etc/network/interfaces that specified to, in this case, eth2, not putting them into eth0. Might be worth saying that I was using 'Adapter 3' only because I didn't want to disturb the settings I'd previously put into 'Adapter 1' and 'Adapter 2' (although I deactivated these temporarily)

Thirdly - as you can see above I set it up to use NAT

Fourthly, and last, I went into port forwarding on the that Adapter tab ...

... and specified ports 8000 and 22 (the only two ports I needed to traffic to use getting in and out of the VM) to forward from the host to the VM - that is specifying ...

http://localhost:8080

... on the host OS would result in a server listening on the VM to port 8080 to receive the traffic.