Allow only TCP traffic from 192.168.0.4 to any address on this host, on port 22

ufw

  • Uncomplicated Firewall.
    Frontend for iptables aiming to make configuration of a firewall easier.
    More information: <https://wiki.ubuntu.com/UncomplicatedFirewall>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

ufw allow proto {{tcp}} from {{192.168.0.4}} to {{any}} port {{22}}

click the source code to copy install ufw on any operating system with command-not-found.com