I am developing a code to validate that an IP and Subnet IP combination is a valid one. Say the IP address is and its subnet mask is - so what are the validations we can make to check that IP and Subnet combinations is valid.

I am assuming that the we can only check that IP address should not be and - is it correct or is there any other validation we can make?

  • Huh? Valid in what sense?
    – joeqwerty
    Jul 7 '18 at 3:12
  • Please let me know what checks can we make from a given IP and subnet / subnet masks?
    – Programmer
    Jul 7 '18 at 3:14
  • 1
    Your question is too broad and doesn't really get any kind of point across. Any ip address can work with any subnet mask depending on the subnetting scheme that's being used. It all depends on the schema of your network. If you need help with this then there is software that you can use to plan and manage the subnetting that you are using. Jul 7 '18 at 3:53
  • 1
    Actually it makes sense. Subnet must be binary 1's followed by 0's, all other numbers are bad. IP Address with only 0 or 1 within a subnet is illegal. That is it.
    – TomTom
    Jul 7 '18 at 4:07
  • 1
    No. is completely fine as it's 0000000100000001 i.e. having both 0 and 1. Jul 7 '18 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.