Oracle virtual machines, at least those running on Ubuntu, come with a restrictive firewall which doesn’t allow any incoming TCP traffic. Check before and after state using:
sudo iptables -L
Flush these rules:
sudo iptables --flush
And, to make this stick on instance reboots, copy-paste the output of
iptables -L into the /etc/iptables/rules.v4 file.