Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 260235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:19:52+00:00 2026-05-11T22:19:52+00:00

An IP Subnet is defined with two parts, a network and a prefix-length or

  • 0

An IP Subnet is defined with two parts, a network and a prefix-length or mask.
For example 192.168.0.0/16 (or, 192.168.0.0/255.255.0.0).

An IP address like 192.168.1.1 is said to match this subnet because,

(192.168.1.1 & 255.255.0.0) == 192.168.0.0

I am interested in what might be called the inverse of a subnet
which is described like this,

For a given SubnetA (say, NetworkA / MaskA),
The inverse of SubnetA is the list of k subnets, such that,

If an IP address A, matches SubnetA,
A will not match any of these k subnets, and
Every IP address B that does not match SubnetA,
will match exactly 1 of these k subnets.

Code is not necessary, I am interested in a correct and optimal method.


I have the optimized answer noted for reference below so it does not distract people trying this as a problem. Have retained acceptance of Rafał’s answer since he also got it right first.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:19:52+00:00Added an answer on May 11, 2026 at 10:19 pm

    One subnet for every unmasked bit b in A, matching all the previous bits in A, differing on b, masking all the following bits. This way each address i not in A will match only one of the above networks, namely the one responsible for the first bit of i that does not match A.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a GlassFish-3.1.2 server running in my subnet (192.168.1.3:3700). I already deployed
I would like to calculate two different lines of best fit for 2 parts
I have a project in C# where there are two namespaces defined in seperate
I've a SDO_GEOMETRY column containing quite large multi polygons , defined like this: INSERT
I have a Review Model like the one defined below (I removed a bunch
I want to set the IP address, subnet and gateway using netsh. I have
I've got a properties file with two distinct key-value pair patters like the following;
I have an array of objects of variable length n. Defined by the number
I have 'records' (basically CSV strings) of two names and and one address. I
I'd like to define a trait with some properties which have a well defined

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.