23

I want to allow all LAN traffic to my Ubuntu server. I have read the documentation and see the command, but when I try to edit the command for my IP range I get an error. How can I allow all traffic starting at 192.168.15.0 - 192.168.15.255?

sudo ufw allow from 192.168.15.0/255 ERROR: Bad source address

It seems like the 15 (third octal) is causing the error. Almost like UFW does not expect a LAN to have a unique IP set.

Thank you

Christopher Altman
  • 729
  • 3
  • 11
  • 20
  • good question, but ufw is a simple interface above the iptables, you may able to do more control over packets via iptables. i prefer you to read this nice article about iptables: http://www.faqs.org/docs/iptables/ – pylover Jan 07 '13 at 23:50
  • 1
    @pylover This is not helpful for this question. UFW is useful to simplifiy iptable tasks and what he wants to do is possible with it. – Christopher Perrin Aug 05 '14 at 18:43

2 Answers2

47
sudo ufw allow from 192.168.15.0/24
Roy
  • 4,256
  • 4
  • 35
  • 50
3

you need to do sudo ufw allow from yourip/24 like this

sudo ufw allow from 192.168.1.0/24 

replace 1 with your ip router.

To allow connections for particular IP addresses ranging from 192.168.1.1 to 192.168.1.254 to port 22 (SSH), run the following command

sudo ufw allow from 192.168.1.0/24 to any port 22
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
oceancambo
  • 31
  • 2