Connection (offline) to OracleDB on CentOSVM using Vbox doesn't work

53 views Asked by At

First of all, I am no developer or network specialist, so please keep things simple. Here's my basic situation:

I have a local server (Apache on Ubuntu 20.04) with several vhosts that need to connect to a Oracle-DB that's installed on a VBox CentOS VM. I do a lot of travel, so the IP I use to connect to the internet changes almost daily, and sometimes I have no internet connection at all. A colleague set my system up to be able to connect via static IP, but unfortunately yesterday something happeneded (vBox went into guru-mode and never got out it) and I had to reinstall and set up the whole thing. But it doesn't work.

As the above mentioned colleague isn't available anymore, I need some external help. Here's what I have:

  • VBox on Ubuntu, with a host-only adapter set up to have a static IP (192.168.56.10), DHCP off and another bridged adapter
  • VM with CentOS 7 (system for the Oracle DB)

ifcofig of that VM:

  • enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.43.121 netmask 255.255.255.0 broadcast 192.168.43.255 inet6 fe80::5255:9ce9:96c4:7810 prefixlen 64 scopeid 0x20 ether 08:00:27:b2:8b:0d txqueuelen 1000 (Ethernet) RX packets 43 bytes 4140 (4.0 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 69 bytes 7329 (7.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  • enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.56.5 netmask 255.255.255.0 broadcast 192.168.56.255 inet6 fe80::6408:c9ff:7c9a:dfb0 prefixlen 64 scopeid 0x20 ether 08:00:27:52:35:de txqueuelen 1000 (Ethernet) RX packets 1 bytes 590 (590.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 38 bytes 5225 (5.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

enp0s8 is the one that connects to the host-only adapter, and it's configured to have a static IP (192.168.56.10). Yet, after restarting the VM it shows with another IP.

Regardless of this I can't connect via SQLDeveloper (on the host) other than using the IP of enp0s3, and only while I'm connected to the internet (wireless) and the provider doesn't change the IP. It wouldn't be a grate deal to change that IP everytime I start to work, but I have 4 different DBs and sometimes 3 or 4 local websites that have their own config files to connect to the DBs.

Short: I need a way to connect from my host to the Oracle DB on the VM without having to change the configuration files of my vhosts or SQLDeveloper.

I will gladly post any further information you may need, but I'm a new user and apparently not allowed to post pics/screenshots yet. Thanks.

1

There are 1 answers

0
thatjeffsmith On

Skip all this networking futzing and setup port forwards. You can tell VirtualBox to map port 1521 on your host to port 1521 on the vm, so SQL Developer can simply connect to localhost:1521/database in your connection.

enter image description here

I talk about this in more details here

Disclaimer: I'm the product manager at Oracle for SQL Developer.