iptables and /32 vs /24

648 views
Skip to first unread message

Steve Wolf

unread,
Jan 11, 2013, 11:32:24 AM1/11/13
to linuxus...@googlegroups.com
I have taken a course on IP numbers etc. but I dont recall. (ok it was years ago) what /32 means.
If i issue the command
 
/sbin/iptables -A INPUT -s 69.212.12.76/32 -j DROP
Vs
/sbin/iptables -A INPUT -s 69.212.12.76/24 -j DROP
Or even
/sbin/iptables -A INPUT -s 69.212.12.76 -j DROP
I think /32 based on an ip calculator is only that IP?
Right ??
 
/24 of course means from 10.1.0.1 to 10.1.0.254
 
And of course no ending just means that specific ip.
 
Can anyone confirm if Im right or if Im off base. I also asume that any of these syntaxes are acceptable depending on what you want.
 
Thanks.

 

Bryan Smith

unread,
Jan 11, 2013, 1:55:20 PM1/11/13
to linuxus...@googlegroups.com
Hey,

The /24 is incorrect, the last number must be a 0 like 69.212.12.0/24 for a 256 ip block starting from 69.212.12.0 to 69.212.12.255

I'd do this way:

/sbin/iptables -A INPUT -s 69.212.12.0/24 -j DROP
/sbin/iptables -A INPUT -s 69.212.12.76 -j DROP

The /32 is indeed only for that ip so it's really pointless to add the /32 on there. Fix the /24 and then you're ready to roll. 

Bryan

 

--
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to linuxus...@googlegroups.com
To unsubscribe, send email to linuxusersgro...@googlegroups.com
For more options, visit our group at http://groups.google.com/group/linuxusersgroup
References can be found at: http://goo.gl/anqri
Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules or http://cdn.fsdev.net/List-Rules.pdf)



--
A healthy diet  includes Linux, Linux, and more Linux.

Steve Wolf

unread,
Jan 14, 2013, 9:45:10 AM1/14/13
to linuxus...@googlegroups.com
Great thanks. Thats helpfull.
Regards
Reply all
Reply to author
Forward
0 new messages