This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I have data which has a column for the IP address and one for the Netmask. So, for example, 192.168.2.25 and 255.255.255.0.
I need to calculate the CIDR format of that (in this case it would be 192.168.2.0/32).
I have been presented a list of "isolated subnets" in CIDR format, so I need to create a new column with the CIDR format value and from there I can do comparisons against the isolated subnet list to see if the client is in one of those subnets.
Obviously the netmask is not always going to be 255.255.255.0. We own multiple class A networks, so as you can guess there is a lot of data and a lot of partial subnet (anywhere from 6 clients to 254x254 clients per subnet).
:-) I'm very stoked that you were able to take the beginning piece and take it across the finish line. Nicely done!
As you say, this is very useful as a gallery tool - well worth posting. The other person who may be interested in this one is @JoeM - Joe puts together the weekly challenges every week, and this really is an interesting challenge because it forces you to engage with binary manipulation functions.
Added another section that can go from CIDR format netmask to long form.
Question for all: As part of a "does this IP address go in this subnet", there's a section where I have to take the base IP and the netmask, both in digital form, and BinaryAND them together. Currently, the BinaryAND really only works on 1 and 0, not entire 32 character long binary strings (or even 8 character, for that matter).
Can anyone think of an easy way to cycle through each character (in both values) and do a BinaryAND on each, and then join, so the final output is a new 32 character binary?