Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have one physical machine, on it there are 2 virtual machines. One of the VM is the application machine, another is the db machine. All are running Windows XP.

I am using Sun Virtual Box for virtualization purpose.

One thing I notice is that on both virtual machines, the IP address is exactly the same.

The problem with this is that I can't connect to the db machine, using MySQL Administrator from my application machine, because I will have to specify the IP of server host, which, in this case, is exactly the same for both db machine and application machine!

I also try to use Hamachi address ( because the Hamachi address is different for different VM), but I always get a "cannot connect" problem, even though I can, from one VM, ping the Hamachi address of another VM.

Any idea how to solve this?

Edit: Dave has a correct answer. Here is the instruction on how to configure Sun Virtual Box 2.2 bridged connection.

share|improve this question
    
I suspect a network configuration problem. How could the two VMs have the same IP address? Sounds something wrong.. –  Andrea Bertani May 21 '09 at 13:03
add comment

2 Answers

up vote 5 down vote accepted

Both your virtual machines are behind the VirtualBox NAT and are invisible to each other. You'll need to configure the virtual machines to use Bridged networking, so they can obtain an IP on your network.

share|improve this answer
    
I think Dave has the right answer here. –  Garry Harthill May 21 '09 at 13:31
    
I wish I could help more, but I don't have enough experience with VirtualBox, esp on Windows. –  Dave Cheney May 21 '09 at 14:11
add comment

Check that

  • Virtual Box allows connections between the two VMs - this seems to be the case already, as you say they can ping each other.
  • the port on the mysql-machine is open by using "telnet mysqlmachine 3306" or "nmap mysqymachine -p 3306" - this will reveal if some firewall blocks access.
  • mysql binds to the public ip address of the machine - As far as I recall it might just bind to localhost, being unavailable from the network (which is a good thing)
  • you've granted the user you're connecting as the correct permissions. This applies also to the naming of the machine you're connecting from. I've learnt that "GRANT ... ON ... TO 'username'@'localhost' ..." might fail if mysql complains with "user 'username' is not allowed to connect from '127.0.0.1'" - in a networked situation you might have similar problems. Note, it's stringcompare there, so 'localhost' does not equal '127.0.0.1'

Edit: Just after posting I've seen that you say that both IP-Addresses are the same. Therefor the root problems seems to be in Virtual Box - check the network configuration there. Each computer will try to contact itself if they both resolve their IP address to themselves.

Once you have different IP-adresses and can ping the other machine, continue with the list above. I have not worked with Hamachi, so I cannot comment on the options you have there... You might want to try the telnet or nmap options with the Hamachi address though.

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.