Tag: oracle cloud

  • How to Open Port on Oracle Cloud Ubuntu Server

    How to Open Port on Oracle Cloud Ubuntu Server

    Oracle Cloud Ubuntu virtual machines are not compatible with UFW firewall. This is because oracle cloud needs some iptables rules to communicate with storage devices.

    To open a port in Oracle cloud Ubuntu Virtual Machine, edit file

    vi /etc/iptables/rules.v4
    

    Find the line

    -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
    

    This is the rule for opening port 22 (SSH). To open another port, duplicate this line, replace 22 with the port you need to open.

    For example, to open ports 80 and 443, add these 2 lines below.

    -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
    

    IMPORTANT: Do not remove the entry for port 22. If you remove this line, you won’t be able to SSH into the server.

    To activate the firewall rules, run the command

    sudo iptables-restore < /etc/iptables/rules.v4
    

    To see the INPUT rules, run the command

    root@oc1-serverok-in:~# iptables -L INPUT
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination         
    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
    ACCEPT     icmp --  anywhere             anywhere            
    ACCEPT     all  --  anywhere             anywhere            
    ACCEPT     udp  --  anywhere             anywhere             udp spt:ntp
    ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh
    ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:http
    ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:https
    REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited
    root@oc1-serverok-in:~# 
    

    Back to Oracle Cloud

  • Allow ICMP (ping) in Oracle Cloud

    Allow ICMP (ping) in Oracle Cloud

    Oracle cloud do not allow ICMP/ping to compute instances. To enable ping, you need to enable ICMP in the security group.

    On your compute instance details page, you will see “Virtual Cloud Network”.

    oracle cloud vpc

    Click on Virtual Cloud Network link, that will take you to page with VPC details.

    Oracle Virtual Cloud Network

    Scroll down, you will see subnet.

    Oracle Cloud Public Subnet

    Click on Public Subnet, on next page, it shows details about the subnet. Under Security Lists, you will see Default Security List for VirtualCloudNetwork. Click on it to see your firewall rules.

    oracle cloud ingress rules

    Click Add Ingress Rules button to add new rule. By default port 22 (SSH) allowed from everyone. ICMP was blocked for everyone (rule 2 and 3).

    To allow ICMP, you can add a new Rule for ICMP.

    Oracle Cloud Add Ingress Rule

    On Add Ingress Rules page, select

    SOURCE TYPE = CIDR
    SOURCE CIDR = 0.0.0.0/0
    IP PROTOCOL = ICMP

    Click Add Ingress Rules button. Now you should be able to ping to any compute instances on this VPC. It is safe to remove 2 of the existing ICMP rules or edit them instead of adding new rule.

    See Oracle Cloud