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

  • SEARCH
  • Home
  • 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

Ask A Question

Stats

  • Questions 127k
  • Answers 127k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It is because it was thought that a programming language… May 12, 2026 at 5:34 am
  • Editorial Team
    Editorial Team added an answer I use Ubuntu Linux with XMonad WM on 15.6 inch… May 12, 2026 at 5:34 am
  • Editorial Team
    Editorial Team added an answer You need to introduce your join condition before calling DefaultIfEmpty().… May 12, 2026 at 5:34 am

Related Questions

I am working on an embedded application where the device is controlled through a
I know that if an IP falls outside the Subnet Mask + Local IP
This could be considered a continuation of this earlier SO question . Ideally, I'd
I have the following two columns: SELECT b.ip_address AS IP ,b.mask AS MASK FROM

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.