Ubuntu on VirtualBox - getting internet access via mobile phone wifi hotspot?

3

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 :

enter image description here

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.

Advice ?

glaucon

Posted 2013-07-09T09:36:54.853

Reputation: 263

I suppose you restart your Ubuntu networking or whole machine to try to get it working? – mirkobrankovic – 2013-07-09T09:51:48.127

Yes I have but thanks for the suggestion – glaucon – 2013-07-11T12:11:36.350

Answers

0

I am the OP and I got it working and this is how.

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 ...

enter image description here

... 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 ...

enter image description here

... 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.

So now it works ! I'm sure there other ways but this is one way.

glaucon

Posted 2013-07-09T09:36:54.853

Reputation: 263