Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a VM in VirtualBox running a Ubuntu 64-bit server that I want to use as a test/local server. I have mysql installed in the VM and am managing it using MySQL Workbench installed on my host laptop (Windows 7 64-bit).

I have it setup currently where anyone who knows the root password can login to mysql as root from any machine (added an entry to the permissions table with root at location %, commented out all bind-address lines in my-cnf), but what I'd really like to have is a situation where root access is only allowed from my host machine and from the VM. I want to maintain the ability to communicate with my VM from any computer in my local network (which I have right now), and the host machine must be able to have a dynamic IP.

The VM server is currently setup to use a Bridged Adapter network (hooked to my host wifi driver) and has a dynamic IP as well, though I don't see this being a requirement as long as my VM server can still access the internet for software updates and the VM and host machine can communicate back and forth with each other (for putty access, mysql maintenance, local webpage server, etc.).

How would I go about doing this, and is it even possible? Let me know if there's any other info I should post.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

So I think I've figured out an acceptable solution (original source: Host-Only Networking with VirtualBox).

I created 2 network adapters, one which hooks up to my DHCP addressed Bridged Adapter and the other hooks up to a Host-only interface. I'm not exactly sure how routers and DHCP's assign addresses, but they all seem to be some variant of 192.168.*.* for private networks, but from what I understand the address space 10.*.*.* also are reserved for private networks.

So I set my Host Network to IPv4 address to 10.0.0.1 in VirtualBox with an IPv4 network mask of 255.255.255.0. I also turned off the DHCP server for the host network.

I next modified my etc\network\interfaces file as such:

# The primary network interface
auto eth0
iface eth0 inet dhcp
# This is an autoconfigured IPv6 interface
iface eth0 inet6 auto
# Host only connection
auto eth1
iface eth1 inet static
    address 10.0.0.2
    netmask 255.255.255.0
    network 10.0.0.0
    broadcast 10.0.0.255

Now anything I want to limit to only be modifiable from the host PC can be statically addressed as 10.0.0.1.

For example, in MySql I added all permissions for root@10.0.0.1 instead of root@%.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.