apt install ufw
vim /etc/default/ufw make sure "IPV6=yes"
ufw enable ufw allow ssh ufw allow 22 ufw allow 6000:6007/tcp /* Specific Port Ranges */ ufw allow 6000:6007/udp
ufw status verbose /* display inactive or active ufw status numbered /* get a list of your firewall rules
ufw disable ufw reset
ufw allow from 203.0.113.4 /* Specific IP Addresses */ ufw allow from 203.0.113.4 to any port 22 /*allow 203.0.113.4 to connect to port 22 (SSH) */
ufw allow in on eth0 to any port 80 /*if your server has a public network interface called eth0, you could allow HTTP traffic port 80
ufw deny from 203.0.113.4 /*deny all connections from 203.0.113.4 ufw deny http
refer https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-18-04 |