CN107645569A - A kind of method and device for generating subnet collection - Google Patents

A kind of method and device for generating subnet collection Download PDF

Info

Publication number
CN107645569A
CN107645569A CN201610585184.1A CN201610585184A CN107645569A CN 107645569 A CN107645569 A CN 107645569A CN 201610585184 A CN201610585184 A CN 201610585184A CN 107645569 A CN107645569 A CN 107645569A
Authority
CN
China
Prior art keywords
address
subnet
mask
collection
section
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610585184.1A
Other languages
Chinese (zh)
Inventor
徐永强
汪范生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SHENZHEN XINWEI TELECOMM TECHNOLOGY Co Ltd
Beijing Xinwei Telecom Technology Inc
Original Assignee
SHENZHEN XINWEI TELECOMM TECHNOLOGY Co Ltd
Beijing Xinwei Telecom Technology Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SHENZHEN XINWEI TELECOMM TECHNOLOGY Co Ltd, Beijing Xinwei Telecom Technology Inc filed Critical SHENZHEN XINWEI TELECOMM TECHNOLOGY Co Ltd
Priority to CN201610585184.1A priority Critical patent/CN107645569A/en
Publication of CN107645569A publication Critical patent/CN107645569A/en
Pending legal-status Critical Current

Links

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The invention discloses a kind of method and device for generating subnet collection.This method includes:Merge after IP address collection and IP address range collection are carried out into duplicate removal, obtain at least one mutual independent and discontinuous IP address subset;The IP address collection is the finite aggregate of at least one separate tP address composition;The IP address range collection is the finite aggregate of at least one IP address section;The difference mask of the IP address subset is obtained, using the difference mask address as address is separated, generates the upper subnet collection of the IP address subset and lower subnet collection;By the upper subnet collection of each IP address subset generation and the series connection of lower subnet collection, targeted subnet collection is generated, so as to realize by inputting some separate tP address or IP scopes, is calculated automatically from suitable subnet and mask.

Description

A kind of method and device for generating subnet collection
Technical field
The present embodiments relate to the technical field of communication, more particularly to a kind of method and device for generating subnet collection.
Background technology
Computer networking technology has been widely used for production and living every field, and the routing operations of network are computer networks One of important technological concept in network software Operation and Maintenance, and the targeted subnet in routing operations then needs to be counted according to demand Calculate.
Targeted subnet in the custom route maintenance of traditional computer, it usually needs attendant is as desired by artificial Calculate to realize.
The defects of traditional approach, is, in order to realize some destination addresses, it usually needs artificial estimation targeted subnet Address and mask, when the distribution of the destination address of demand is irregular, the address set that usual subnet is covered turns into requirement objective The superset of address, thus produce the route effect of redundancy.And if necessary to subnet corresponding to accurate calculating destination address, then need Attendant spends the time to carry out more complicated artificial calculating according to IP address agreement.
The content of the invention
The purpose of the embodiment of the present invention is to propose a kind of method and device for generating subnet collection, it is intended to which how solution is carrying Can be by address set accurate transformation subnet collection in the case of for some IP address or address realm the problem of.
To use following technical scheme up to this purpose, the embodiment of the present invention:
In a first aspect, a kind of method for generating subnet collection, methods described include:
Merge after IP address collection and IP address range collection are carried out into duplicate removal, obtain at least one independent and discontinuous mutually IP address subset;The IP address collection is the finite aggregate of at least one separate tP address composition;The IP address range collection is The finite aggregate of at least one IP address section;
The difference mask of the IP address subset is obtained, using the difference mask address as address is separated, is generated The upper subnet collection and lower subnet collection of the IP address subset;
By the upper subnet collection of each IP address subset generation and the series connection of lower subnet collection, targeted subnet collection is generated.
Preferably, the difference mask for obtaining the IP address subset, including:
First address and more limit address are obtained, the first address is left first address closed in the right IP address section opened, The more limit address is to be not included in first address in section but outside section;
The first address and the more limit address are done into xor operation;
All bits below the highest non-zero bit position of result after xor operation are arranged to 1, get counter cover Code;
The wildcard mask is negated, result of the inverted is required maximum subnet mask;
The first address is carried out and operated with the maximum subnet mask, will be anti-corresponding to the result after described and operation The position of mask highest non-zero bit position is arranged to 1, and obtained result is the difference mask address.
Preferably, the upper subnet collection of the generation IP address subset and lower subnet collection, including:
The upper subnet collection is according to leniently arriving narrow being sequentially generated from small to large, and sequential storage;
The lower subnet collection is according to leniently arriving narrow being sequentially generated from big to small, and backward stores.
Preferably, the upper subnet collection of the generation IP address subset and lower subnet collection, including:
Using the difference mask address as upper address, subnet and mask are calculated one by one downwards, calculate gained From big to small, mask is descending for subnet address;
Using the difference mask address as IP address, subnet and mask are calculated one by one upwards, calculate gained Subnet address is ascending, and mask is ascending.
Preferably, it is described using the difference mask address as upper address, calculate subnet and mask one by one downwards, From big to small, mask is descending for subnet address obtained by calculating, including:
First address and the upper address are done into xor operation, by the highest-order bit of the result after the xor operation with Under all bits be arranged to 1, obtain wildcard mask, first ground that the first address is closed in the right IP address section opened for a left side Location;
The wildcard mask is moved to right one again plus one obtains subnet size, upper address subtracts subnet size with obtaining subnet Location;
The wildcard mask is negated to obtain the mask of subnet, lower subnet, which is calculated, according to the mask concentrates address most Greatly, first maximum subnet of mask;
Second subnet can be calculated using the address of first subnet as new upper address, repetition;
Cycle calculations successively, until the section first address is identical with the upper address, then terminate cycle calculations.
Preferably, it is described using the difference mask address as IP address, calculate subnet and mask one by one upwards, Subnet address obtained by calculating is ascending, and mask is ascending, including:
First address and more limit address are done into xor operation, below the highest-order bit of the result after the xor operation All bits are arranged to 1, then move to right one, obtain wildcard mask;
The wildcard mask is negated to obtain the subnet mask of first subnet;
The wildcard mask is added to 1 value, does or operates with subnet address, the result after described or operation is new first ground Location;
Using the new first address, above-mentioned calculating is repeated, can obtain second subnet address;
Cycle calculations according to this, until the first address is identical with the more limit address, then terminate cycle calculations;
Wherein, first address that the first address is closed in the right IP address section opened for a left side, the more limit address is not First address in section but outside section.
Second aspect, a kind of device for generating subnet collection, described device include:
Duplicate removal merging module, for merging after IP address collection and IP address range collection are carried out into duplicate removal, obtain at least one Mutual independent and discontinuous IP address subset, the IP address collection are the finite aggregate of at least one separate tP address composition, The IP address range collection is the finite aggregate of at least one IP address section;
Acquisition module, for obtaining the difference mask of the IP address subset;
First generation module, for using the difference mask address as address is separated, generating IP address The upper subnet collection and lower subnet collection of collection;
Second generation module, connected for the upper subnet collection for generating each IP address subset and lower subnet collection, generate mesh Mark subnet collection.
Preferably, the acquisition module, is used for:
First address and more limit address are obtained, the first address is left first address closed in the right IP address section opened, The more limit address is to be not included in first address in section but outside section;
The first address and the more limit address are done into xor operation;
All bits below the highest non-zero bit position of result after xor operation are arranged to 1, get counter cover Code;
The wildcard mask is negated, result of the inverted is required maximum subnet mask;
The first address is carried out and operated with the maximum subnet mask, will be anti-corresponding to the result after described and operation The position of mask highest non-zero bit position is arranged to 1, and obtained result is the difference mask address.
Preferably, first generation module, is used for:
The upper subnet collection is according to leniently arriving narrow being sequentially generated from small to large, and sequential storage;
The lower subnet collection is according to leniently arriving narrow being sequentially generated from big to small, and backward stores.
Preferably, first generation module, is used for:
Using the difference mask address as upper address, subnet and mask are calculated one by one downwards, calculate gained From big to small, mask is descending for subnet address;
Using the difference mask address as IP address, subnet and mask are calculated one by one upwards, calculate gained Subnet address is ascending, and mask is ascending.
Preferably, first generation module, is used for:
First address and the upper address are done into xor operation, by the highest-order bit of the result after the xor operation with Under all bits be arranged to 1, obtain wildcard mask, first ground that the first address is closed in the right IP address section opened for a left side Location;
The wildcard mask is moved to right one again plus one obtains subnet size, upper address subtracts subnet size with obtaining subnet Location;
The wildcard mask is negated to obtain the mask of subnet, lower subnet, which is calculated, according to the mask concentrates address most Greatly, first maximum subnet of mask;
Second subnet can be calculated using the address of first subnet as new upper address, repetition;
Cycle calculations successively, until the section first address is identical with the upper address, then terminate cycle calculations.
Preferably, first generation module, is used for:
First address and more limit address are done into xor operation, below the highest-order bit of the result after the xor operation All bits are arranged to 1, then move to right one, obtain wildcard mask, and the first address is closed in the right IP address section opened for a left side First address;The more limit address is to be not included in first address in section but outside section;
The wildcard mask is negated to obtain the subnet mask of first subnet;
The wildcard mask is added to 1 value, does or operates with subnet address, the result after described or operation is new first ground Location;
Using the new first address, above-mentioned calculating is repeated, can obtain second subnet address;
Cycle calculations according to this, until the first address is identical with the more limit address, then terminate cycle calculations.
The embodiment of the present invention provides a kind of method and device for generating subnet collection, and IP address collection and IP address range collection are entered Merge after row duplicate removal, obtain at least one mutual independent and discontinuous IP address subset;The IP address collection is at least one The finite aggregate of separate tP address composition;The IP address range collection is the finite aggregate of at least one IP address section;Obtain institute The difference mask of IP address subset is stated, using the difference mask address as address is separated, generates the IP address subset Upper subnet collection and lower subnet collection;By the upper subnet collection of each IP address subset generation and the series connection of lower subnet collection, generation target Net collection, so as to realize by inputting some separate tP address or IP scopes, is calculated automatically from suitable subnet and mask.
Brief description of the drawings
Fig. 1 is a kind of schematic flow sheet of method for generating subnet collection provided in an embodiment of the present invention;
Fig. 2 is a kind of high-level schematic functional block diagram of device for generating subnet collection provided in an embodiment of the present invention.
Embodiment
The embodiment of the present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this The specific embodiment of place description is used only for explaining the embodiment of the present invention, rather than the restriction to the embodiment of the present invention.In addition also It should be noted that for the ease of describing, the part related to the embodiment of the present invention rather than entire infrastructure are illustrate only in accompanying drawing.
With reference to figure 1, Fig. 1 is that the embodiment of the present invention provides a kind of schematic flow sheet for the method for generating subnet collection.
As shown in figure 1, the method for the generation subnet collection includes:
Step 101, will IP address collection and IP address range collection carry out duplicate removal after merge, obtain it is at least one independent mutually and Discontinuous IP address subset;The IP address collection is the finite aggregate of at least one separate tP address composition;The IP address Range set is the finite aggregate of at least one IP address section;
Specifically, any one IP address section can completely be split as several separate subnets, enable these subnets This IP address section is covered, and is not occured simultaneously between subnet.
Step 102, the difference mask of the IP address subset is obtained, using the difference mask address as separatedly Location, generate the upper subnet collection of the IP address subset and lower subnet collection;
Specifically, find the subnet address of maximum mask as segmentation address, address is split as upper address using this, to Under calculate subnet and mask (lower subnet collection) one by one, calculate gained subnet address it is less and less, mask is less and less.With segmentation Address is IP address, calculates subnet and mask (upper subnet collection) one by one upwards, and it is increasing to calculate the subnet address of gained, covers Code is increasing.Merge lower subnet collection and upper subnet collection.
Preferably, the difference mask for obtaining the IP address subset, including:
First address and more limit address are obtained, the first address is left first address closed in the right IP address section opened, The more limit address is to be not included in first address in section but outside section;
The first address and the more limit address are done into xor operation;
All bits below the highest non-zero bit position of result after xor operation are arranged to 1, get counter cover Code;
The wildcard mask is negated, result of the inverted is required maximum subnet mask;
The first address is carried out and operated with the maximum subnet mask, will be anti-corresponding to the result after described and operation The position of mask highest non-zero bit position is arranged to 1, and obtained result is the difference mask address.
Preferably, the upper subnet collection of the generation IP address subset and lower subnet collection, including:
The upper subnet collection is according to leniently arriving narrow being sequentially generated from small to large, and sequential storage;
The lower subnet collection is according to leniently arriving narrow being sequentially generated from big to small, and backward stores.
Preferably, the upper subnet collection of the generation IP address subset and lower subnet collection, including:
Using the difference mask address as upper address, subnet and mask are calculated one by one downwards, calculate gained From big to small, mask is descending for subnet address;
Using the difference mask address as IP address, subnet and mask are calculated one by one upwards, calculate gained Subnet address is ascending, and mask is ascending.
Preferably, it is described using the difference mask address as upper address, calculate subnet and mask one by one downwards, From big to small, mask is descending for subnet address obtained by calculating, including:
First address and the upper address are done into xor operation, by the highest-order bit of the result after the xor operation with Under all bits be arranged to 1, obtain wildcard mask, first ground that the first address is closed in the right IP address section opened for a left side Location;
The wildcard mask is moved to right one again plus one obtains subnet size, upper address subtracts subnet size with obtaining subnet Location;
The wildcard mask is negated to obtain the mask of subnet, lower subnet, which is calculated, according to the mask concentrates address most Greatly, first maximum subnet of mask;
Second subnet can be calculated using the address of first subnet as new upper address, repetition;
Cycle calculations successively, until the section first address is identical with the upper address, then terminate cycle calculations.
Preferably, it is described using the difference mask address as IP address, calculate subnet and mask one by one upwards, Subnet address obtained by calculating is ascending, and mask is ascending, including:
First address and more limit address are done into xor operation, below the highest-order bit of the result after the xor operation All bits are arranged to 1, then move to right one, obtain wildcard mask;
The wildcard mask is negated to obtain the subnet mask of first subnet;
The wildcard mask is added to 1 value, does or operates with subnet address, the result after described or operation is new first ground Location;
Using the new first address, above-mentioned calculating is repeated, can obtain second subnet address;
Cycle calculations according to this, until the first address is identical with the more limit address, then terminate cycle calculations;
Wherein, first address that the first address is closed in the right IP address section opened for a left side, the more limit address is not First address in section but outside section.
Step 103, the upper subnet collection of each IP address subset generation and lower subnet collection are connected, generates targeted subnet collection.
Specifically, the first situation:In certain communication products core net, realized accurately using method of the present invention Automatic route maintenance function.Such as:By algorithm of the present invention, realize that route dynamic realtime is safeguarded.User is as needed Fill in some IP address or IP address section, it is not necessary to consider whether repetition and any regularity of distribution, can be immediately generated accurate road By.
Second of situation:In certain network test tool product, method of the present invention provides for test maintaining engineer The reference of assistance routing iinformation.Such as:In certain distributed pressure testing tool, multiple testing network element main frames need to be in different nets In network environment, thereby increases and it is possible to adjust automatically interconnecting relation at any time.By algorithm of the present invention, it is only necessary to which Test Engineer is according to need Configure correctly interconnection IP address group, you can safeguard correct intercommunication route automatically, and reference is provided for Test Engineer.
Available for added automatically for address pool route etc. software application scene.Such as in IP-based switching's equipment, generally Need to safeguard the route between each network equipment, and need to set subnet and mask in routing configuration.
Such as:One IP address section:192.216.100.0 192.240.30.5 is arrived
Also right open interval is closed with regard to 192.216.100.0 a to 192.240.30.6 left side
The subnet collection for meeting to require should be following subnet collection:
The first step, first find the subnet address 192.224.0.0 of maximum mask
Second step, from top to bottom, lower subnet is calculated successively and concentrates each subnet address and mask:
" subnet address/mask "
" 192.216.0.0/255.248.0.0 ",
" 192.215.128.0/255.255.128.0 ",
" 192.215.112.0/255.255.240.0 ",
"192.215.104.0/255.255.248.0"
"192.215.100.0/255.255.252.0"
3rd step, from bottom to top, subnet concentrates each subnet address and mask in calculating:
" subnet address/mask "
"192.224.0.0/255.240.0.0"
"192.240.0.0/255.255.240.0"
"192.240.16.0/255.255.248.0"
"192.240.24.0/255.255.252.0"
"192.240.28.0/255.255.254.0"
"192.240.30.0/255.255.255.252"
"192.240.30.4/255.255.255.254"
4th step, merging obtain:
" subnet address/mask "
"192.215.100.0/255.255.252.0"
"192.215.104.0/255.255.248.0"
"192.215.112.0/255.255.240.0"
"192.215.128.0/255.255.128.0"
"192.216.0.0/255.248.0.0"
"192.224.0.0/255.240.0.0"
"192.240.0.0/255.255.240.0"
"192.240.16.0/255.255.248.0"
"192.240.24.0/255.255.252.0"
"192.240.28.0/255.255.254.0"
"192.240.30.0/255.255.255.252"
"192.240.30.4/255.255.255.254"
The embodiment of the present invention provides a kind of method for generating subnet collection, and IP address collection and IP address range collection are carried out into duplicate removal After merge, obtain at least one independent mutually and discontinuous IP address subset;The IP address collection is at least one independent IP The finite aggregate of address composition;The IP address range collection is the finite aggregate of at least one IP address section;With obtaining the IP The difference mask of location subset, using the difference mask address as address is separated, generate the upper son of the IP address subset Net collection and lower subnet collection;By the upper subnet collection of each IP address subset generation and the series connection of lower subnet collection, targeted subnet collection is generated, from And realize by inputting some separate tP address or IP scopes, it is calculated automatically from suitable subnet and mask.
With reference to figure 2, Fig. 2 is a kind of high-level schematic functional block diagram of device for generating subnet collection provided in an embodiment of the present invention.
As shown in Fig. 2 the device of the generation subnet collection includes:
Duplicate removal merging module 201, for merging after IP address collection and IP address range collection are carried out into duplicate removal, obtain at least one Individual mutual independent and discontinuous IP address subset, the IP address collection is the finite aggregate of at least one separate tP address composition Close, the IP address range collection is the finite aggregate of at least one IP address section;
Acquisition module 202, for obtaining the difference mask of the IP address subset;
First generation module 203, for using the difference mask address as address is separated, generating the IP address The upper subnet collection and lower subnet collection of subset;
Second generation module 204, connected for the upper subnet collection for generating each IP address subset and lower subnet collection, generation Targeted subnet collection.
Preferably, the acquisition module 202, including:
First address and more limit address are obtained, the first address is left first address closed in the right IP address section opened, The more limit address is to be not included in first address in section but outside section;
The first address and the more limit address are done into xor operation;
All bits below the highest non-zero bit position of result after xor operation are arranged to 1, get counter cover Code;
The wildcard mask is negated, result of the inverted is required maximum subnet mask;
The first address is carried out and operated with the maximum subnet mask, will be anti-corresponding to the result after described and operation The position of mask highest non-zero bit position is arranged to 1, and obtained result is the difference mask address.
Preferably, first generation module 203, is used for:
The upper subnet collection is according to leniently arriving narrow being sequentially generated from small to large, and sequential storage;
The lower subnet collection is according to leniently arriving narrow being sequentially generated from big to small, and backward stores.
Preferably, first generation module 203, is used for:
Using the difference mask address as upper address, subnet and mask are calculated one by one downwards, calculate gained From big to small, mask is descending for subnet address;
Using the difference mask address as IP address, subnet and mask are calculated one by one upwards, calculate gained Subnet address is ascending, and mask is ascending.
Preferably, first generation module 203, is used for:
First address and the upper address are done into xor operation, by the highest-order bit of the result after the xor operation with Under all bits be arranged to 1, obtain wildcard mask, first ground that the first address is closed in the right IP address section opened for a left side Location;
The wildcard mask is moved to right one again plus one obtains subnet size, upper address subtracts subnet size with obtaining subnet Location;
The wildcard mask is negated to obtain the mask of subnet, lower subnet, which is calculated, according to the mask concentrates address most Greatly, first maximum subnet of mask;
Second subnet can be calculated using the address of first subnet as new upper address, repetition;
Cycle calculations successively, until the section first address is identical with the upper address, then terminate cycle calculations.
Preferably, first generation module 203, is used for:
First address and more limit address are done into xor operation, below the highest-order bit of the result after the xor operation All bits are arranged to 1, then move to right one, obtain wildcard mask, and the first address is closed in the right IP address section opened for a left side First address;The more limit address is to be not included in first address in section but outside section;
The wildcard mask is negated to obtain the subnet mask of first subnet;
The wildcard mask is added to 1 value, does or operates with subnet address, the result after described or operation is new first ground Location;
Using the new first address, above-mentioned calculating is repeated, can obtain second subnet address;
Cycle calculations according to this, until the first address is identical with the more limit address, then terminate cycle calculations.
The embodiment of the present invention provides a kind of device for generating subnet collection, and IP address collection and IP address range collection are carried out into duplicate removal After merge, obtain at least one independent mutually and discontinuous IP address subset;The IP address collection is at least one independent IP The finite aggregate of address composition;The IP address range collection is the finite aggregate of at least one IP address section;With obtaining the IP The difference mask of location subset, using the difference mask address as address is separated, generate the upper son of the IP address subset Net collection and lower subnet collection;By the upper subnet collection of each IP address subset generation and the series connection of lower subnet collection, targeted subnet collection is generated, from And realize by inputting some separate tP address or IP scopes, it is calculated automatically from suitable subnet and mask.
The technical principle of the embodiment of the present invention is described above in association with specific embodiment.These descriptions are intended merely to explain this The principle of inventive embodiments, and the limitation to protection domain of the embodiment of the present invention can not be construed in any way.Based on herein Explanation, those skilled in the art, which would not require any inventive effort, can associate the other specific of the embodiment of the present invention Embodiment, these modes are fallen within the protection domain of the embodiment of the present invention.

Claims (12)

  1. A kind of 1. method for generating subnet collection, it is characterised in that methods described includes:
    Merge after IP address collection and IP address range collection are carried out into duplicate removal, with obtaining at least one mutual independent and discontinuous IP Location subset;The IP address collection is the finite aggregate of at least one separate tP address composition;The IP address range collection is at least The finite aggregate of one IP address section;
    The difference mask of the IP address subset is obtained, using the difference mask address as separating address, described in generation The upper subnet collection and lower subnet collection of IP address subset;
    By the upper subnet collection of each IP address subset generation and the series connection of lower subnet collection, targeted subnet collection is generated.
  2. 2. according to the method for claim 1, it is characterised in that the difference mask for obtaining the IP address subset, bag Include:
    First address and more limit address are obtained, first address that the first address is closed in the right IP address section opened for a left side is described More limit address is to be not included in first address in section but outside section;
    The first address and the more limit address are done into xor operation;
    All bits below the highest non-zero bit position of result after xor operation are arranged to 1, get wildcard mask;
    The wildcard mask is negated, result of the inverted is required maximum subnet mask;
    The first address is carried out and operated with the maximum subnet mask, by wildcard mask corresponding to the result after described and operation The position of highest non-zero bit position is arranged to 1, and obtained result is the difference mask address.
  3. 3. according to the method for claim 1, it is characterised in that the upper subnet collection of the generation IP address subset is with Subnet collection, including:
    The upper subnet collection is according to leniently arriving narrow being sequentially generated from small to large, and sequential storage;
    The lower subnet collection is according to leniently arriving narrow being sequentially generated from big to small, and backward stores.
  4. 4. according to the method for claim 1, it is characterised in that the upper subnet collection of the generation IP address subset is with Subnet collection, including:
    Using the difference mask address as upper address, subnet and mask are calculated one by one downwards, calculate the subnet of gained From big to small, mask is descending for address;
    Using the difference mask address as IP address, subnet and mask are calculated one by one upwards, calculate the subnet of gained Address is ascending, and mask is ascending.
  5. 5. according to the method for claim 4, it is characterised in that it is described using the difference mask address as the upper limit Location, calculating subnet and mask one by one downwards, calculate the subnet address of gained from big to small, mask is descending, including:
    First address and the upper address are done into xor operation, below the highest-order bit of the result after the xor operation All bits are arranged to 1, obtain wildcard mask, first address that the first address is closed in the right IP address section opened for a left side;
    The wildcard mask is moved to right one again plus one obtains subnet size, upper address subtracts subnet size and obtains subnet address;
    The wildcard mask is negated to obtain the mask of subnet, lower subnet concentration address maximum is calculated according to the mask, covered First maximum subnet of code;
    Second subnet can be calculated using the address of first subnet as new upper address, repetition;
    Cycle calculations successively, until the section first address is identical with the upper address, then terminate cycle calculations.
  6. 6. according to the method for claim 4, it is characterised in that it is described using the difference mask address as starting point Location, calculate subnet and mask one by one upwards, calculate that the subnet address of gained is ascending, and mask is ascending, including:
    First address and more limit address are done into xor operation, will be all below the highest-order bit of the result after the xor operation Bit is arranged to 1, then moves to right one, obtains wildcard mask;
    The wildcard mask is negated to obtain the subnet mask of first subnet;
    The wildcard mask is added to 1 value, does or operates with subnet address, the result after described or operation is new first address;
    Using the new first address, above-mentioned calculating is repeated, can obtain second subnet address;
    Cycle calculations according to this, until the first address is identical with the more limit address, then terminate cycle calculations;
    Wherein, first address that the first address is closed in the right IP address section opened for a left side, the more limit address be not comprising First address in section but outside section.
  7. 7. a kind of device for generating subnet collection, it is characterised in that described device includes:
    Duplicate removal merging module, for merging after IP address collection and IP address range collection are carried out into duplicate removal, obtain at least one mutual Independent and discontinuous IP address subset, the IP address collection is the finite aggregate of at least one separate tP address composition, described IP address range collection is the finite aggregate of at least one IP address section;
    Acquisition module, for obtaining the difference mask of the IP address subset;
    First generation module, for using the difference mask address as address is separated, generating the IP address subset Upper subnet collection and lower subnet collection;
    Second generation module, connected for the upper subnet collection for generating each IP address subset and lower subnet collection, generation target Net collection.
  8. 8. device according to claim 7, it is characterised in that the acquisition module, be used for:
    First address and more limit address are obtained, first address that the first address is closed in the right IP address section opened for a left side is described More limit address is to be not included in first address in section but outside section;
    The first address and the more limit address are done into xor operation;
    All bits below the highest non-zero bit position of result after xor operation are arranged to 1, get wildcard mask;
    The wildcard mask is negated, result of the inverted is required maximum subnet mask;
    The first address is carried out and operated with the maximum subnet mask, by wildcard mask corresponding to the result after described and operation The position of highest non-zero bit position is arranged to 1, and obtained result is the difference mask address.
  9. 9. device according to claim 7, it is characterised in that first generation module, be used for:
    The upper subnet collection is according to leniently arriving narrow being sequentially generated from small to large, and sequential storage;
    The lower subnet collection is according to leniently arriving narrow being sequentially generated from big to small, and backward stores.
  10. 10. device according to claim 7, it is characterised in that first generation module, be used for:
    Using the difference mask address as upper address, subnet and mask are calculated one by one downwards, calculate the subnet of gained From big to small, mask is descending for address;
    Using the difference mask address as IP address, subnet and mask are calculated one by one upwards, calculate the subnet of gained Address is ascending, and mask is ascending.
  11. 11. device according to claim 10, it is characterised in that first generation module, be used for:
    First address and the upper address are done into xor operation, below the highest-order bit of the result after the xor operation All bits are arranged to 1, obtain wildcard mask, first address that the first address is closed in the right IP address section opened for a left side;
    The wildcard mask is moved to right one again plus one obtains subnet size, upper address subtracts subnet size and obtains subnet address;
    The wildcard mask is negated to obtain the mask of subnet, lower subnet concentration address maximum is calculated according to the mask, covered First maximum subnet of code;
    Second subnet can be calculated using the address of first subnet as new upper address, repetition;
    Cycle calculations successively, until the section first address is identical with the upper address, then terminate cycle calculations.
  12. 12. device according to claim 10, it is characterised in that first generation module, be used for:
    First address and more limit address are done into xor operation, will be all below the highest-order bit of the result after the xor operation Bit is arranged to 1, then moves to right one, obtains wildcard mask, and the first address is first in the left IP address section closed the right side and opened Individual address;The more limit address is to be not included in first address in section but outside section;
    The wildcard mask is negated to obtain the subnet mask of first subnet;
    The wildcard mask is added to 1 value, does or operates with subnet address, the result after described or operation is new first address;
    Using the new first address, above-mentioned calculating is repeated, can obtain second subnet address;
    Cycle calculations according to this, until the first address is identical with the more limit address, then terminate cycle calculations.
CN201610585184.1A 2016-07-22 2016-07-22 A kind of method and device for generating subnet collection Pending CN107645569A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610585184.1A CN107645569A (en) 2016-07-22 2016-07-22 A kind of method and device for generating subnet collection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610585184.1A CN107645569A (en) 2016-07-22 2016-07-22 A kind of method and device for generating subnet collection

Publications (1)

Publication Number Publication Date
CN107645569A true CN107645569A (en) 2018-01-30

Family

ID=61109717

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610585184.1A Pending CN107645569A (en) 2016-07-22 2016-07-22 A kind of method and device for generating subnet collection

Country Status (1)

Country Link
CN (1) CN107645569A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112738285A (en) * 2019-10-28 2021-04-30 中国电信股份有限公司 MAC mapping table processing method, device, controller and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6954459B1 (en) * 2000-06-16 2005-10-11 International Business Machines Corporation Method for forwarding broadcast packets in a bridged IP network
WO2007011950A1 (en) * 2005-07-18 2007-01-25 Hewlett-Packard Development Company L.P. Bitmap network masks
CN101330530A (en) * 2008-07-02 2008-12-24 北京亿阳信通软件研究院有限公司 Method and apparatus for managing IP address segment
CN103117864A (en) * 2011-11-16 2013-05-22 阿里巴巴集团控股有限公司 Subnet combination method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6954459B1 (en) * 2000-06-16 2005-10-11 International Business Machines Corporation Method for forwarding broadcast packets in a bridged IP network
WO2007011950A1 (en) * 2005-07-18 2007-01-25 Hewlett-Packard Development Company L.P. Bitmap network masks
CN101330530A (en) * 2008-07-02 2008-12-24 北京亿阳信通软件研究院有限公司 Method and apparatus for managing IP address segment
CN103117864A (en) * 2011-11-16 2013-05-22 阿里巴巴集团控股有限公司 Subnet combination method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112738285A (en) * 2019-10-28 2021-04-30 中国电信股份有限公司 MAC mapping table processing method, device, controller and system
CN112738285B (en) * 2019-10-28 2022-11-18 中国电信股份有限公司 MAC mapping table processing method, device, controller and system

Similar Documents

Publication Publication Date Title
CN104702512B (en) The multi-level control system and computer implemented method of network management are provided for software defined network
CN106372339B (en) The multi-rate simulating method and device of power electronics electric system
CN104935604B (en) A kind of SDN firewall systems and method based on OpenFlow agreements
CN106105115A (en) The service chaining originated by service node in network environment
CN100481668C (en) Parallel computation method for large-scale electrical power system network tidal current segmentation
CN104521199A (en) Adaptive infrastructure for distributed virtual switch
CN107018031A (en) A kind of car networking fast Optimization calculated based on mist
CN107210927A (en) Abnormality detection in protocol processes
CN105656771A (en) Service path determining method, device and system
EP2775685A1 (en) Security zones in industrial control systems
CN106100876A (en) A kind of SDN middle controller dispositions method, path calculation method and system thereof
CN104574204B (en) Intelligent measuring and control device ICD models automatic identification system and method
CN107645569A (en) A kind of method and device for generating subnet collection
CN106780633B (en) A kind of method for correcting image, device and binocular vision system
CN108959671A (en) The real-time simulation modeling method of half-bridge and bridge-type modularization multi-level converter
CN106786602B (en) A kind of distribution power system load flow calculation method
CN104012042A (en) Assigning one or more network service templates to an existing network service model
JP4517166B1 (en) Method and program for reverse estimation of OD traffic volume between large zones using centroid
CN105704026B (en) A kind of differentiated services network medium to low-risk method for routing
CN106330511A (en) Network element device and method for opening data communication network
CN107483336A (en) Network equipment MAC Address volume test system and method
Abdalla et al. Application of multi-layer graphs in the design of MPLS networks
CN103841436B (en) A kind of automatic network register method of set top box
CN110365507A (en) For realizing the method and apparatus of link weight automatic assignment
CN109308449A (en) A kind of foreign body filtering video coding chip and method based on deep learning

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20180130