Skip to content

Ubuntu FireWall

Commands

Get Status

ufw status
ufw status numbered

Allow

ufw allow \<port-number\>

Delete

ufw delete \<rule-line-number\>

Open/Close ICMP(ping)

edit /etc/ufw/before.rules file

# ok icmp codes for INPUT
-A ufw-before-input -p icmp --icmp-type destination-unreachable -j ACCEPT/DROP
-A ufw-before-input -p icmp --icmp-type time-exceeded -j ACCEPT/DROP
-A ufw-before-input -p icmp --icmp-type parameter-problem -j ACCEPT/DROP
-A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT/DROP