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.
Here is an example of the VPS configuration used in this troubleshooting scenario:
| Configuration | Value |
|---|---|
| Cloud Provider | Oracle Cloud Infrastructure |
| Region | Oracle Cloud region |
| Operating System | Ubuntu 24.04 LTS |
| Architecture | ARM64 |
| Instance Shape | VM.Standard.A1.Flex |
| OCPU | 4 |
| RAM | 24 GB |
| Public IP | YOUR_PUBLIC_IP |
| Private IP | YOUR_PRIVATE_IP |
| SSH Username | ubuntu |
| SSH Port | 22 |
| Connection Tool | PuTTY |
| Client OS | Windows |
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.
When I entered the VPS public IP address in PuTTY and tried connecting, the connection timed out. My connection configuration was:
YOUR_PUBLIC_IPubuntu22Initially, 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.
Instead of guessing, I used Windows Command Prompt and PowerShell to identify where the connection was failing.
I started with:
ping YOUR_PUBLIC_IP
The result was:
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.
I executed:
powershell -Command "Test-NetConnection YOUR_PUBLIC_IP -Port 22"
The result was:
WARNING: TCP connect failed
ComputerName : YOUR_PUBLIC_IP
RemotePort : 22
TcpTestSucceeded : False
Next, I ran:
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.
I went to:
I checked the ingress rules. The SSH ingress rule was already configured:
| Setting | Value |
|---|---|
| Source CIDR | 0.0.0.0/0 |
| Protocol | TCP |
| Destination Port | 22 |
| Stateless | No |
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.
Next, I navigated to:
The subnet details showed:
| Setting | Value |
|---|---|
| VCN | YOUR_VCN |
| Subnet | YOUR_SUBNET |
| CIDR Block | YOUR_SUBNET_CIDR |
| Subnet Access | Public Subnet |
| Route Table | Default 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.
This was where I discovered the issue. I navigated to:
I found my Internet Gateway. The details showed:
| Setting | Value |
|---|---|
| Name | YOUR_GATEWAY |
| State | Available |
| Associated Route Table | Default Route Table |
The Internet Gateway was already associated with the default route table. I then opened:
The route table had no route rules. I attempted to add the following rule:
| Field | Value |
|---|---|
| Target Type | Internet Gateway |
| Destination CIDR | 0.0.0.0/0 |
| Target | YOUR_GATEWAY |
However, Oracle returned this API error:
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.
Instead of deleting the existing Internet Gateway, I created a new route table.
Navigate to Oracle Cloud Console → Networking → Virtual Cloud Networks → YOUR_VCN.
Find the Route Tables section and click Create Route Table. Enter:
| Field | Value |
|---|---|
| Name | public-route-table |
| Compartment | YOUR_COMPARTMENT |
| VCN | YOUR_VCN |
Leave other settings at their defaults and click Create.
Open the newly created route table and click Add Route Rules. Configure:
| Field | Value |
|---|---|
| Target Type | Internet Gateway |
| Destination CIDR Block | 0.0.0.0/0 |
| Target Internet Gateway | YOUR_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.
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.
The new public route table should contain:
| Destination CIDR | Target Type | Target |
|---|---|---|
0.0.0.0/0 | Internet Gateway | YOUR_GATEWAY |
This is the standard default route needed for internet connectivity through an Internet Gateway.
After completing the route table configuration, I went back to my Windows computer, opened Command Prompt, and executed:
powershell -Command "Test-NetConnection YOUR_PUBLIC_IP -Port 22"
This time, the result was:
ComputerName : YOUR_PUBLIC_IP
RemotePort : 22
TcpTestSucceeded : True
After confirming that TCP port 22 was reachable, I could proceed with SSH authentication:
YOUR_PUBLIC_IP), Port (22), and Connection Type (SSH)..ppk file.The default SSH username for this Ubuntu OCI image is ubuntu. Enter it when prompted.
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.
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:
sudo apt update
sudo apt install nginx -y
Start and enable the service:
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:
| Setting | Value |
|---|---|
| Source CIDR | 0.0.0.0/0 |
| Protocol | TCP |
| Destination Port | 80 |
If Ubuntu's UFW firewall is enabled, also run:
sudo ufw allow 80/tcp
Now open http://YOUR_PUBLIC_IP in your browser to see the default Nginx welcome page.
# 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
# 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
A public subnet needs an Internet Gateway to communicate with the public internet.
The subnet route table must contain 0.0.0.0/0 → Internet Gateway.
Ensure TCP port 22 is explicitly allowed in ingress rules.
If your VNIC has an attached Network Security Group, check its rules too.
Check Ubuntu UFW status (`sudo ufw status`) to make sure SSH isn't blocked.
If TCP connects but auth fails, verify your private .ppk matches the server key.
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.
Before launching a new Oracle Cloud Ubuntu VPS, check these settings:
0.0.0.0/0 → Internet Gateway.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.
Get expert assistance with VPS configuration, network routing, security hardening, and deployment.
Get Free Architecture Audit & Inquire Now