How to Fix Oracle Cloud VPS SSH Connection Timeout (Ubuntu 24.04)

Recently, I created a new Ubuntu VPS instance on Oracle Cloud Infrastructure (OCI). The instance was successfully created, and Oracle assigned a public IP address.

However, when I tried connecting to the server using PuTTY from Windows, the connection kept timing out.

I checked the SSH key, username, public IP address, and Oracle Security List. Everything appeared to be correct. But SSH was still not working.

After troubleshooting the network configuration step by step, I discovered that the problem was related to the Oracle Cloud Internet Gateway and route table configuration. In this tutorial, I'll explain the symptoms, root cause, diagnostic process, and solution.

This guide is useful if you experience:
  • Oracle Cloud VPS SSH connection timeout.
  • PuTTY unable to connect to Ubuntu VPS.
  • Oracle Cloud public IP not reachable.
  • SSH port 22 connection failure.
  • Oracle VPS running but inaccessible.
  • Internet Gateway and route table configuration problems.

1. Oracle Cloud VPS Configuration

Here is an example of the VPS configuration used in this troubleshooting scenario:

Configuration Value
Cloud ProviderOracle Cloud Infrastructure
RegionOracle Cloud region
Operating SystemUbuntu 24.04 LTS
ArchitectureARM64
Instance ShapeVM.Standard.A1.Flex
OCPU4
RAM24 GB
Public IPYOUR_PUBLIC_IP
Private IPYOUR_PRIVATE_IP
SSH Usernameubuntu
SSH Port22
Connection ToolPuTTY
Client OSWindows

The instance was showing as RUNNING in Oracle Cloud. It also had a public IP address and an SSH key pair configured during instance creation. Everything looked fine, but I could not connect.

2. Initial Problem: PuTTY Connection Timeout

When I entered the VPS public IP address in PuTTY and tried connecting, the connection timed out. My connection configuration was:

Initially, I suspected an incorrect SSH key or username. However, an incorrect SSH key normally causes an authentication error after the SSH server responds. My problem was different: the TCP connection itself was failing. Therefore, I decided to investigate the network.

3. Diagnosing the Problem from Windows

Instead of guessing, I used Windows Command Prompt and PowerShell to identify where the connection was failing.

Test 1: Ping the Public IP

I started with:

CMD
ping YOUR_PUBLIC_IP

The result was:

Text Output
Pinging YOUR_PUBLIC_IP with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)

This showed that the server was not responding to ICMP ping requests. However, ping failure alone does not prove that a server is unreachable. Cloud firewalls can block ICMP traffic. I needed to test the actual SSH port.

Test 2: Check SSH Port 22

I executed:

PowerShell
powershell -Command "Test-NetConnection YOUR_PUBLIC_IP -Port 22"

The result was:

Text Output
WARNING: TCP connect failed

ComputerName     : YOUR_PUBLIC_IP
RemotePort       : 22
TcpTestSucceeded : False
Critical Finding: The SSH port was not accepting TCP connections. This indicated a connectivity problem somewhere between my Windows computer and the VPS.

Test 3: Trace the Network Route

Next, I ran:

CMD
tracert -d YOUR_PUBLIC_IP

The output showed several responding network hops, followed by multiple timeouts. Traceroute can help identify the path packets take through the network, but intermediate routers may not respond to traceroute probes. Therefore, the result was useful for diagnosis but did not conclusively identify where packets were being dropped.

4. Checking Oracle Cloud Security Lists

I went to:

Oracle Cloud Console → Networking → Virtual Cloud Networks → YOUR_VCN → Security Lists

I checked the ingress rules. The SSH ingress rule was already configured:

Setting Value
Source CIDR0.0.0.0/0
ProtocolTCP
Destination Port22
StatelessNo

This rule allows incoming SSH connections from the internet. I also checked the instance details. The instance was running and had a public IP address. At this stage, I suspected that the issue was somewhere else in the Oracle Cloud networking configuration.

Important: If an instance has an attached Network Security Group (NSG), its rules must also permit SSH. Security List rules alone may not be sufficient.

5. Checking the Oracle Cloud Subnet

Next, I navigated to:

Networking → Virtual Cloud Networks → YOUR_VCN → Subnets → YOUR_SUBNET

The subnet details showed:

Setting Value
VCNYOUR_VCN
SubnetYOUR_SUBNET
CIDR BlockYOUR_SUBNET_CIDR
Subnet AccessPublic Subnet
Route TableDefault Route Table

The subnet was configured as a public subnet. This was important because a public subnet needs a valid internet route and an Internet Gateway. Having a public IP address does not automatically guarantee internet connectivity. The route table must also be configured correctly.

6. The Actual Problem: Internet Gateway and Route Table Configuration

This was where I discovered the issue. I navigated to:

Networking → Virtual Cloud Networks → YOUR_VCN → Internet Gateways

I found my Internet Gateway. The details showed:

Setting Value
NameYOUR_GATEWAY
StateAvailable
Associated Route TableDefault Route Table

The Internet Gateway was already associated with the default route table. I then opened:

Networking → Virtual Cloud Networks → YOUR_VCN → Route Tables → Default Route Table

The route table had no route rules. I attempted to add the following rule:

Field Value
Target TypeInternet Gateway
Destination CIDR0.0.0.0/0
TargetYOUR_GATEWAY

However, Oracle returned this API error:

API Error Response
Rules in the route table must use private IP as a target.
Or the route table can be empty (no rules).

This was the most important clue. I initially thought the Internet Gateway was broken, but it was available. The problem was that I was trying to use a route table associated with the Internet Gateway itself. That table was not suitable for adding the normal default route to the Internet Gateway.

Oracle also did not provide an option to remove the association completely. The available action was to associate a different route table. The solution was to create a separate route table for the public subnet.

7. The Solution: Create a Separate Public Route Table

Instead of deleting the existing Internet Gateway, I created a new route table.

Step 1: Open the VCN

Navigate to Oracle Cloud Console → Networking → Virtual Cloud Networks → YOUR_VCN.

Step 2: Open Route Tables

Find the Route Tables section and click Create Route Table. Enter:

FieldValue
Namepublic-route-table
CompartmentYOUR_COMPARTMENT
VCNYOUR_VCN

Leave other settings at their defaults and click Create.

Step 3: Add the Internet Gateway Route

Open the newly created route table and click Add Route Rules. Configure:

FieldValue
Target TypeInternet Gateway
Destination CIDR Block0.0.0.0/0
Target Internet GatewayYOUR_GATEWAY

Save the route rule. The new route table is separate from the one associated with the Internet Gateway, allowing it to be used for the normal subnet internet route.

Step 4: Associate the New Route Table with the Public Subnet

Navigate to Networking → Virtual Cloud Networks → YOUR_VCN → Subnets → YOUR_SUBNET, click Edit, find the Route Table field, change it from Default Route Table to public-route-table, and save changes.

The subnet now uses the new route table. The Internet Gateway remains associated with its original route table.

Step 5: Verify the Route Table

The new public route table should contain:

Destination CIDRTarget TypeTarget
0.0.0.0/0Internet GatewayYOUR_GATEWAY

This is the standard default route needed for internet connectivity through an Internet Gateway.

8. Testing the SSH Connection Again

After completing the route table configuration, I went back to my Windows computer, opened Command Prompt, and executed:

PowerShell
powershell -Command "Test-NetConnection YOUR_PUBLIC_IP -Port 22"

This time, the result was:

Text Output
ComputerName     : YOUR_PUBLIC_IP
RemotePort       : 22
TcpTestSucceeded : True
Success! The TCP connection to port 22 was now working. This confirmed that SSH network connectivity had been restored. The problem was not PuTTY, Windows, or the SSH key. It was the Oracle Cloud network routing configuration.

9. Connect to Ubuntu Using PuTTY

After confirming that TCP port 22 was reachable, I could proceed with SSH authentication:

  1. Open PuTTY.
  2. Configure Host Name (YOUR_PUBLIC_IP), Port (22), and Connection Type (SSH).
  3. Expand Connection → SSH → Auth → Credentials.
  4. Select your private .ppk file.
  5. Return to Session and click Open.

The default SSH username for this Ubuntu OCI image is ubuntu. Enter it when prompted.

Terminal Output
Welcome to Ubuntu 24.04 LTS

ubuntu@instance:~$

Remember that making port 22 reachable does not automatically guarantee successful SSH authentication. The correct private key must match the public key installed on the server.

10. How to Enable HTTP Port 80

Port 80 is used for HTTP web traffic. A newly created Ubuntu instance does not necessarily have a web server running.

After connecting through SSH, install Nginx:

Bash
sudo apt update
sudo apt install nginx -y

Start and enable the service:

Bash
sudo systemctl enable --now nginx
sudo systemctl status nginx

Now allow HTTP traffic in the Oracle Security List or attached NSG by adding this ingress rule:

SettingValue
Source CIDR0.0.0.0/0
ProtocolTCP
Destination Port80

If Ubuntu's UFW firewall is enabled, also run:

Bash
sudo ufw allow 80/tcp

Now open http://YOUR_PUBLIC_IP in your browser to see the default Nginx welcome page.

11. Useful Troubleshooting Commands

From Windows

PowerShell & CMD
# Check SSH connectivity
Test-NetConnection YOUR_PUBLIC_IP -Port 22

# Check HTTP connectivity
Test-NetConnection YOUR_PUBLIC_IP -Port 80

# Check network route
tracert -d YOUR_PUBLIC_IP

From Ubuntu

Bash
# Check SSH service status
sudo systemctl status ssh

# Check whether SSH is listening on port 22
sudo ss -lntp | grep ':22'

# Check firewall status
sudo ufw status verbose

# Check Nginx status
sudo systemctl status nginx

# Check all listening ports
sudo ss -tulpn

# Check private IP address
ip addr

12. Common Oracle Cloud VPS SSH Problems

Missing Internet Gateway

A public subnet needs an Internet Gateway to communicate with the public internet.

Missing Default Route

The subnet route table must contain 0.0.0.0/0 → Internet Gateway.

Incorrect Security List

Ensure TCP port 22 is explicitly allowed in ingress rules.

Missing NSG Rules

If your VNIC has an attached Network Security Group, check its rules too.

Firewall Blocking SSH

Check Ubuntu UFW status (`sudo ufw status`) to make sure SSH isn't blocked.

Incorrect SSH Key

If TCP connects but auth fails, verify your private .ppk matches the server key.

13. Final Network Architecture

The intended network configuration looks like this:

                  INTERNET
                      |
                      |
                PUBLIC IP
                      |
                      |
             INTERNET GATEWAY
                      |
                      |
           PUBLIC SUBNET ROUTE TABLE
                      |
                0.0.0.0/0
                      |
                      |
                 UBUNTU VPS
                      |
                      |
                   SSH : 22
                  HTTP : 80

The important distinction is that the Internet Gateway's own associated route table and the subnet's public route table serve different purposes. The subnet route table must provide the default route to the Internet Gateway.

14. Final Checklist

Before launching a new Oracle Cloud Ubuntu VPS, check these settings:

Conclusion

My Oracle Cloud VPS was running and had a public IP address, but SSH connections were timing out. Initially, I suspected PuTTY, SSH keys, and the Security List. However, the actual issue was related to the route table associated with the Internet Gateway.

The solution was to create a separate route table for the public subnet, add the default route pointing to the Internet Gateway, and associate the new route table with the subnet. After making this change, the Windows PowerShell command returned TcpTestSucceeded : True, confirming that SSH network connectivity had been restored.

My Biggest Takeaway: When an Oracle Cloud VPS is running but SSH connections time out, don't immediately recreate the instance or change your SSH keys. Check the VCN, Internet Gateway, route tables, Security Lists, and NSGs first.

Official Oracle Documentation

Oracle Cloud Oracle VPS Ubuntu 24.04 SSH Timeout PuTTY OCI Networking Internet Gateway Route Table Linux Troubleshooting

Struggling with Cloud Infrastructure or OCI?

Get expert assistance with VPS configuration, network routing, security hardening, and deployment.

Get Free Architecture Audit & Inquire Now