Guest to Guest DB connection not working

Discussions about using Mac OS X guests (on Apple hardware) in VirtualBox.
Post Reply
eric@fulminatus.com
Posts: 11
Joined: 13. Feb 2015, 16:25

Guest to Guest DB connection not working

Post by eric@fulminatus.com »

I'm running OS X Yosemite as my host, OS X Mavericks as my 'client' guest, and Fedora 19 as my 'server' guest. I'm running an oracle database on the server and cannot connect from the client using SQL Developer. I keep getting the error Status : Failure - Test failed : IO Error : The Network Adapter could not establish the connection.

* The host firewall is currently turned off

* Both guests are running a single NAT adapter

* The server has port forwarding set up for guest and host on 1521

Code: Select all

Name: Oracle
Protocol: TCP
Host IP:
Host Port: 1521
Guest IP: 
Guest Port: 1521
* The host shows the port as being held by VirtualBox

Code: Select all

$ sudo lsof -i -P | grep -i "1521"
Password:
VirtualBo 6528           Eric   42u  IPv4 0x8db9e4c05684417f      0t0    TCP *:1521 (LISTEN)
* SQL Developer on the host can connect to the database

* The guest can ping localhost

Code: Select all

$ ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.042ms
* The host can telnet to port 1521

Code: Select all

$ telnet localhost 1521
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

* The guest cannot telnet to port 1521

Code: Select all

$ telnet localhost 1521
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Trying fe80::1...
telnet: connect to address fe80::1: Connection refused
telnet: Unable to connect to remote host
Does anybody know what I'm missing or doing wrong here? Connecting to the shared database in another state is killing my productivity. :(

Thanks,
Eric
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Guest to Guest DB connection not working

Post by mpack »

You can't do guest to guest with NAT. You can use "NAT Natwork" and practically anything else. Obviously, membership in a workgroup or domain may also be required and is a matter of guest configuration.
eric@fulminatus.com
Posts: 11
Joined: 13. Feb 2015, 16:25

Re: Guest to Guest DB connection not working

Post by eric@fulminatus.com »

mpack, thanks for the quick reply!

What are my options? Do I add a second adapter using Internal Networking to both guests? My requirements are:

* Host must be able to connect to the outside world
* Client guest must be able to connect to the outside world and the server guest
* Server guest must be visible from client guest

Hm. Based on that, it looks like Client needs two adapters, one NAT and one Internal Networking, and Server needs Internal Networking? If so, how would I build my connection string? Is it then 'localhost', or do I need to find an IP somewhere for Server?

Thanks,
Eric
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Guest to Guest DB connection not working

Post by Perryg »

Given your requirements Bridged would be the proper way to go ( one adapter )
eric@fulminatus.com
Posts: 11
Joined: 13. Feb 2015, 16:25

Re: Guest to Guest DB connection not working

Post by eric@fulminatus.com »

Great, thanks perryg. I will read up on Bridged networks.

Eric
eric@fulminatus.com
Posts: 11
Joined: 13. Feb 2015, 16:25

Re: Guest to Guest DB connection not working

Post by eric@fulminatus.com »

With both guests on a bridged network, the Oracle database won't start on the server:

Code: Select all

Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle)(PORT=1521)(IP=V4_ONLY)))
TNS-12545: Connect failed because target host or object does not exist
 TNS-12560: TNS:protocol adapter error
  TNS-00515: Connect failed because target host or object does not exist
    Linux Error: 99: Cannot assign requested address
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Guest to Guest DB connection not working

Post by Perryg »

If both guests are using Bridged and they can see the host and the Internet, the two guests will look like separate PCs on the LAN, just like real life ( on metal ).
You may need to check the configurations of the guest/s if you used static IP addresses or even look at the settings for the Oracle App as it may not be set correctly now.
eric@fulminatus.com
Posts: 11
Joined: 13. Feb 2015, 16:25

Re: Guest to Guest DB connection not working

Post by eric@fulminatus.com »

Hm. Is there a way to do it that doesn't involve me running in bridged mode, then? I don't know if I really want to be messing with the DB configuration, since (a) I don't understand it, and (b) it was handed to me in a working state.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Guest to Guest DB connection not working

Post by Perryg »

You could try a combination of NAT and host-only but the address scheme will be different and the guest would be using VBox NAT to access the Internet. You would then be forced to address those issues.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Guest to Guest DB connection not working

Post by mpack »

Is there some reason you don't want to use bridged mode? It involves a change to one VM setting (per VM). It should be quite transparent to the guest - it will find itself using a different IP, and that's all.
eric@fulminatus.com
Posts: 11
Joined: 13. Feb 2015, 16:25

Re: Guest to Guest DB connection not working

Post by eric@fulminatus.com »

perryg++
mpack++

I was able to get bridged working by adjusting /etc/hosts to contain the DHCP-assigned IP address. Now as long as I don't restart my router I'm fine. Thanks to you both!
Post Reply