ipaddressrange
ipaddressrange copied to clipboard
[Question] How to find usable IPs?
var range = IPAddressRange.Parse("192.168.1.100/255.255.255.0");
IPStartBox.Text = range.Begin.ToString(); // returns 192.168.1.0
IPEndBox.Text = range.End.ToString(); // 192.168.1.255
I need to return first and last usable IP, which should be 192.168.1.1 and 192.168.1.254. Is this possible?
Unfortunately, it is impossible with the IPAddressRange object only.
To determine useable addresses, it requires not only range information and also subnets information such as subnet mask.
IPAddressRange knows just a range, so IPAddressRange can not do it.
If you want to resolve this issue, here is not suitable for discussion about this issue. I recommend that you ask anybody in stackoverflow.com or elsewhere like it.