0

how to add rule by UFW that will allow connect to let's say SSH from ip range 10.0.0.10-10.0.0.20 ?

does UFW supports --src-range function like iptables?

1 Answers1

0

Referring to this question:

https://askubuntu.com/questions/646424/ufw-allow-range-of-ip-addresees

One way to do it is to split it into several rules (not exhaustively listing out all IP addresses though):

Considering that 10.0.0.10-20: (I only list out

  • 10 -> 0000 1010
  • 11 -> 0000 1011
  • 12 -> 0000 1100

...

  • 15 -> 0000 1111
  • 16 -> 0001 0000

...

  • 19 -> 0001 0011
  • 20 -> 0001 0100

You would need 4 rules:

ufw allow from 10.0.0.10/31
ufw allow from 10.0.0.12/30
ufw allow from 10.0.0.16/30
ufw allow from 10.0.0.20
  • this is no good becouse i need to allow 120 ip to access a mysql database..... i think I'll stick strictly to iptables; beside i was thinking that ufw is capable of this. thanks. – integratorIT Dec 10 '19 at 13:05