Hi,
Since I started using Linux many years ago I have always set ufw in deny all in & allow all out. I recently changed this policy to deny all out & allowing only specific outgoing ports like 80, 443, etc which are required for daily activities like web browsing, email, etc.
Problem is I cant ping any IP. This is what happens
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
It just stays like that. No reply at all. How do I enable outgoing ping ?
The issue you have is that ufw rules apply only to udp and tcp protocols.
Ping is ICMP.
You can allow is by adding ip tables rules.
# ok icmp codes for OUTPUT
-A ufw-before-output -p icmp --icmp-type destination-unreachable -j ACCEPT
-A ufw-before-output -p icmp --icmp-type time-exceeded -j ACCEPT
-A ufw-before-output -p icmp --icmp-type parameter-problem -j ACCEPT
-A ufw-before-output -p icmp --icmp-type echo-request -j ACCEPT
to /etc/ufw/before.rules
WARNING: I am no expert on network security and this may be a terrible idea (I do not know). Please do your own research on ip table.
I just copied input part and replaced input with output.