2

I'm learning about UFW with a Raspberry Pi and I don't a couple of things when it comes to UFW rules. Can anyone help me suss a couple things out?

  1. My first question is about the destination any. If I want to let something connect to my Pi, why use any instead of a static IP address?

    Is it in case the Pi's IP address changes? For example:

    sudo ufw allow from 15.15.15.51 to any port 22
    
  2. My second question is about the following rule, which I just can't understand. When I wanted to let everything on my network access my Pi I added the rule to the Pi's UFW and it worked, but I have no idea what it means or how to read it.

    It sounds like I'm letting everything on my local network connect to my Pi, regardless of its IP address:

    sudo ufw allow in to 192.168.1.0/24
    

    How does that work?

  • In reguards to your first question, you specify any because a device can have multiple network interfaces and thus multiple IP addresses. – Daisetsu Feb 7 at 19:18
  • 1
    The second rule has somewhat strange syntax IMO. I would have written it "sudo ufw allow from 192.168.1.0/24 to any" – Daisetsu Feb 7 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.