I need ports open at home for syncthing, but want incoming connections blocked when on any other network. How do I do this with Ubuntu?
Without this feature I quite often end up turning off the laptop at home with the firewall off, then turning the laptop on at say work and having it connect automatically to a network where I wanted the firewall on, leaving a window of extra vulnerability while I get the firewall turned back on. Not ideal!
Prompted by: https://askubuntu.com/a/688912/79266
I'm currently using gufw. See also https://help.ubuntu.com/community/Gufw
P.S. Windows can do this.
sudo ufw allow from 15.15.15.0/24 to any port 873
or$ sudo ufw allow from 192.168.1.215 proto udp to any port 88
specifying a protocol – George Udosen May 10 '17 at 20:42