Can i/how discover subnet IP format from IP range?
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can i/how discover subnet IP format from IP range?
Hello,
i have found the IP range 120.76.0.0 - 120.79.255.255 that i want to ban in iptables the way i write x.x.x.x/xx format. Please how to know what that x.x.x.x/xx should be? I have found some online tool where i enter the range and it return it, but unable, these tools like https://www.calculator.net/ip-subnet-calculator.html only have field for single IP and subnet mask.
If you do not know what a CIDR is or how to calculate one I seriously question whether you are ready to or should be dealing directly with iptables. Although it is not that difficult it is far too easy to cause serious problems for yourself. I would advise learning more about the basics of iptables (or nftables) and having some understanding and facility with binary before attempting. However, to your question. The CIDR you are looking for is 120.76.0.0/14. A look at the iptables-extensions man page would also show you you really don't need the CIDR. Using the iprange match --src-range will also work.
Hello,
i have found the IP range 120.76.0.0 - 120.79.255.255 that i want to ban in iptables the way i write x.x.x.x/xx format. Please how to know what that x.x.x.x/xx should be? I have found some online tool where i enter the range and it return it, but unable, these tools like https://www.calculator.net/ip-subnet-calculator.html only have field for single IP and subnet mask.
:-)
1) go to https://community.spiceworks.com/tools/subnet-calc/ and set Number of subnets 1
2) if one's range is the range of some provider that should be banned, then the provider's range (subnet/CIDR format) may be found like this: go to Linux terminal and do command "whois x.x.x.x|grep route" where x.x.x.x is some IP within the rage. It should show CIDR format with /subnetmask.
:-)
1) go to https://community.spiceworks.com/tools/subnet-calc/ and set Number of subnets 1
2) if one's range is the range of some provider that should be banned, then the provider's range (subnet/CIDR format) may be found like this: go to Linux terminal and do command "whois x.x.x.x|grep route" where x.x.x.x is some IP within the rage. It should show CIDR format with /subnetmask.
Right; that's what you were told in agillators first reply, and were even handed a link to the subnet calculator from Turbocapitalist.
And again: you asked about this SEVEN YEARS AGO, and were handed the commands, because you (apparently) can't put any effort into learning for yourself, or applying what you're told. Is there some point that you're going to be able to do things on your own?
:-)
1) go to https://community.spiceworks.com/tools/subnet-calc/ and set Number of subnets 1
2) if one's range is the range of some provider that should be banned, then the provider's range (subnet/CIDR format) may be found like this: go to Linux terminal and do command "whois x.x.x.x|grep route" where x.x.x.x is some IP within the rage. It should show CIDR format with /subnetmask.
Ish...ARIN and RIPE usually publish the CIDR of the containing range. Other registries are less consistent.
I downloaded two perl scripts — I don’t recall from where — cidr.pl and cidr_range.pl that will convert ranges to cidr notation and vice versa.
DDG is your friend. Try searching for either script name. Let us know if you can’t find them.
Ish...ARIN and RIPE usually publish the CIDR of the containing range. Other registries are less consistent. I downloaded two perl scripts — I don’t recall from where — cidr.pl and cidr_range.pl that will convert ranges to cidr notation and vice versa. DDG is your friend. Try searching for either script name. Let us know if you can’t find them.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.