37
The behavior of /24 vs /32 addresses when using iptables
(programming.dev)
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
Thank you very much! :)
Interesting why
iptablesbehaves like that though. Because, if I understand it correctly, specifying any address between 192.168.1.[0...255]/24 will result in all addresses in that range to be accepted? So, the only way to actually single out one host is to use the mask /32...?Yes, exactly. The convention is to use the lowest address in the range (e.g. 192.168.1.0/24), since you're allowing a range of addresses rather than a single one.
The reason to do this is that many firewall rules will be based on sets of addresses - you might want to allow traffic from any device in your local network without having to add individual rules for each
Tomorrow, at work, I'm gonna brag about what I have learned here today, until my colleagues' ears fall off.
Thanks again! :)