It seems there’s a firewall present on the latest Developer Days Database image which I’ve just downloaded from Oracle.
I enjoy using these images because it is a complete reference install of Oracle Linux, Oracle Database and Oracle SQL Developer (among others). Besides that, it only takes 10 minutes to setup a base install from the image.
Usually I like to connect from my local SQL Developer instead of the one inside the VM.
But with this setup I could not connect when I added the NAT Port Forwarding in Virtualbox, it timed out when trying to connect. I could connect from the SQL Developer inside the VM, just not through the NAT port which was forwarded (important: see the bottom of this post to check the NAT Port Forwarding settings in Virtualbox)
It’s fairly easy to add a firewall rule which allows access to port 1521 on Oracle Linux, we can even do it with a GUI:
Select Menu “System” – “Administration” – “Firewall”
Then follow these steps:
- Click [Other Ports]
- Click [Add]
- Select [User Defined]
- Enter Port: “1521”
- Select Protocol: “TCP”
- Click [Apply]
- Click [Reload]
You’ve just added port 1521 to the iptables which makes it okay to connect to this port from another IP outside the local machine.
We can test from SQL Developer, running on the Host:
And it works! :-)
Extra: NAT Port Forwarding in Virtualbox
Just to be sure, these are the settings you’ll need to set inside the Virtualbox Manager to setup the port forwarding on port 1521 from the guest to the host:
Select the “Settings” of the Developer Day VM and then:
- Select “Network”
- Click [Port Forwarding]
Then in the Port Forwarding Rules:
- Enter a descriptive name: “DB”
- Enter the host port: “1521”
- Enter the guest port: “1521”