Solutions's picture

Good day everyone,

This is a very useful and powerful setup that I like a lot.

 

I have been using it for a while, to make it work on VirtualBox, it needed to get the IP from DHCP server and it is necessary in this case to use host-only adapter, the machine has it's IP and is accessible from the host system which is Windows 10.

The problem is that the virtual machine cannot access the internet, I tried different scenarios like 2 adaptors, bridged and others, but none has worked to make it work locally and access the internet.

I've been working on this setup for a while, but at certain time, it should access the internet at least for updates.

 

Anyone can help in this to make it access the internet?

What do I need to change to make it work?

 

Thanks, 

 

 

Forum: 
Jeremy Davis's picture

Glad to hear that your finding TurnKey of use! :)

Usually, if you use a bridged connection, it should get an IP via your LAN. But on a laptop, that may not be ideal (perhaps you're out and about and not connected to your LAN).

So what you've done (host only) is an easy way to be able to reliably connect to your server. But as you note, you only have incoming access, not outgoing.

What you could do is add another network adaptor (vNIC) and make that one NAT. Then you can continue to use your host only connection for accessing your server, and the server can use the NATed connection to download updates, etc.

OTTOMH, it should "just work" but if it doesn't, let me know and I'll get back to you ASAP.

Solutions's picture

Thanks Jeremy for your reply.

 

I actually tried all possibilities, when choosing NAT the IP become 10.0.3.x and becomes inaccessible, then when using NAT network it changes the IP again to the range 192168.x.x but the server again is not accessible. 

I tried 1, 2 and 3 adaptors (host only, bridged, NAT, NAT network, internal network) with different choices and different adaptor types, the only one that worked fine is host only adaptor which allowed me to access the server, but the server not accessing the internet.

Any other suggestions?

 

Thanks a lot,

 

 

Jeremy Davis's picture

Ok, so I'll assume that you are starting with 1 vNIC (i.e. virtual network adaptor) configured as "host only", getting a DHCP address from VirtualBox's networking, which you can connect to via the web browser (or whatever other tools such as SSH client, etc) from your host system.

Shut your VM down and in the config for your TurnKey VM, add an additional vNIC. For this new one, select NAT networking (leave the original one as "host only"). So now your VM should have 2 vNICs - the original "host only" one, plus a new NAT one. Boot it up again. Leave the default eth0 (host only) interface as is.

If you don't change the "host only" eth0 interface, then that should continue to work exactly as it did prior to adding the additional vNIC (the IP may have changed, but most likely not). IIRC the new NATed interface should now "just work" too, but from what you've posted, it sounds that possibly it doesn't?!

Please double check the contents of /etc/network/interfaces (i.e. 'cat /etc/network/interfaces'). It's contents should look like this:

# UNCONFIGURED INTERFACES
# remove the above line if you edit this file

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

allow-hotplug eth1
iface eth1 inet dhcp

If it doesn't, please update it so it does. I'm unsure of your experience and knowledge so I don't know how much detail you need, but FYI all TurnKey appliances come pre-installed with both nano and vim-tiny CLI text editors (nano is a fairly intuitive CLI text editor somewhat similar to Windows "notepad" and vim-tiny is a minimalist vi like editor for those familiar with vi/vim). Note that for the eth1 interface line, you could switch the 'allow-hotplug' to 'auto' ('allow-hotplug' means it won't fail if it can't find a second interface; 'auto' means it will always expect a second interface to exist).

If that still doesn't help, please share the full details of your VMs network configuration within VirtualBox; plus the output of these commands:

cat /etc/network/interfaces
ifconfig
ls /sys/class/net
Solutions's picture

Something I also tried to configure NAT in console, but it never worked.

Adding the above code, you suggested:

allow-hotplug eth1
iface eth1 inet dhcp

Worked very well and I can see that it communicates with the internet without any problems.

 

Thanks a lot Jeremy for your help.

Solutions's picture

By the way, about the editor, I able to handle them, but I connect using SFTP which is much better.

 

Thanks again, 

Add new comment