Well, it turns out that NAT port-forwarding was totally unecessary for what I was trying to do (although it is interesting). The answer is to use the host networking (with the loopback interface).
I don't have time to write a real blog entry, so here are my notes on it
- Install the server, including SSH and LAMP.
- Install a loopback adapter on the host
- Install a second network interface with "host" networking using VirtualBox, tied to the loopback adapter.
- Change the TCP settings for the host networking interface on the host computer to be 192.168.5.1 netmask 255.255.255.0
- On the guest machine, run
sudo nano /etc/network/interfaces - add these lines
auto eth1 iface eth1 inet static address 192.168.5.2 netmask 255.255.255.0 - restart networking
sudo /etc/init.d/networking restart - Now you should be able to access everything including SSH from the host. Just connect to 192.168.5.2, port 22.
- Now, getting MySql to work. Change the /etc/mysql/my.cnf
bind-address = 192.168.5.2
which used to be localhost - from the MySql client (you must be root!)
grant all privileges on *.* to 'root'@'192.168.5.1'; - Restart MySql: sudo /etc/init.d/mysql restart
- Now you can connect with MySql from your host using the command-line thinger or the MySql Query whatsamagig
1 comment:
For VBox 2.10, it's different. Check out the changes here
http://compileyouidontevenknowyou.blogspot.com/2008/12/virtual-box-210-virtual-host-adapter.html
Post a Comment