Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Photon OS: Allow Ping (ICMP) Through IPTables Firewall

While working with VMware Photon OS, I was seeing an issue where I configured IP addresses successfully, but ping (ICMP) was not working from outside. This occurs due to ICMP (ping) traffic is blocked by default in Photon OS’s iptables firewall rules.

To resolve this and allow ping functionality, by adding a couple of iptables rules to permit ICMP echo requests and replies. 

Run these below commands, which will allow all outgoing and incoming ICMP (ping) traffic in system.

Note: Although by running just these commands ping will work but these setting will not persist or survive reboot.

# Allow all outgoing ICMP traffic (e.g., for pinging other machines, sending replies)
iptables -A OUTPUT -p icmp -j ACCEPT

# Allow all incoming ICMP traffic (e.g., to allow others to ping your server)
iptables -A INPUT -p icmp -j ACCEPT

Screenshot of configuring iptables on Photon OS 5.0 to allow ICMP traffic, showing root login and commands to set INPUT and OUTPUT rules

Below command captures the current iptables configuration and saves it in a file for later use, This restore or reuse the rules for future firewall configurations.

iptables-save > /etc/systemd/scripts/ip4save

In the last restart iptables daemon. This setting will persist and you will be able to ping even after reboot.

systemctl restart iptables

Useful Articles
Getting started Ansible AWX tower for IT automation run first playbook
Ansible for VMwary Using vmware_vm_inventory dynamic inventory plugin
Ansible selectattr The error was TemplateRuntimeError no test named 'equalto'
ansible create an array with set_fact
Ansible get information from esxi advanced settings nested dictionary with unique keynames
Install Ansible AWX Tower on Ubuntu Linux
Ansible AWX installation error Cannot have both the docker-py and docker python modules
Ansible AWX installation error docker-compose run --rm --service-ports task awx-manage migrate --no-input
docker: Got permission denied while trying to connect to the Docker daemon socket
Ansible AWX Tower create Manual SCM (Source Control Credential Type) project
Reset Ansible AWX Tower admin password
Install Ansible AWX on Microsoft Windows OS
Step by Step Install Ansible on Ubuntu OS
Install Ansible AWX Tower on Ubuntu Linux OS
Ansible AWX Tower Github inventory integration | Github inventory source

Go Back

Comment

Blog Search

Page Views

13060090

Follow me on Blogarama