subnet-seller
所属分类:数学计算
开发工具:PowerShell
文件大小:0KB
下载次数:0
上传日期:2023-11-10 09:14:07
上 传 者:
sh-1993
说明: 递归子网(重)卖方算法在PowerShell中的实现
(implementation of recursive subnet (re-)seller algorithm in PowerShell)
文件列表:
.vscode/ (0, 2023-11-10)
.vscode/settings.json (51, 2023-11-10)
LICENSE (1071, 2023-11-10)
MAINTAINERS.md (158, 2023-11-10)
install.ps1 (928, 2023-11-10)
plantuml/ (0, 2023-11-10)
plantuml/output/ (0, 2023-11-10)
plantuml/output/#0 init 192.168.0.0 from 29 to 32.png (304316, 2023-11-10)
plantuml/output/#0 init 192.168.0.0 from 29 to 32.svg (181136, 2023-11-10)
plantuml/output/#1 sold 192.168.0.0_30.png (313631, 2023-11-10)
plantuml/output/#1 sold 192.168.0.0_30.svg (182072, 2023-11-10)
plantuml/output/#2 sold 192.168.0.8_31.png (320914, 2023-11-10)
plantuml/output/#2 sold 192.168.0.8_31.svg (183136, 2023-11-10)
plantuml/output/#3 repurchased 192.168.0.8_31.png (323102, 2023-11-10)
plantuml/output/#3 repurchased 192.168.0.8_31.svg (182497, 2023-11-10)
plantuml/plantuml.jar (9424596, 2023-11-10)
psmod_subnet_seller/ (0, 2023-11-10)
psmod_subnet_seller/psmod_subnet_seller.psd1 (4269, 2023-11-10)
psmod_subnet_seller/psmod_subnet_seller.psm1 (17365, 2023-11-10)
renovate.json (27, 2023-11-10)
test.ps1 (2408, 2023-11-10)
uninstall.ps1 (728, 2023-11-10)
# subnet-seller
Algorithm coded for .NET or PowerShell applications/scripts to manage a network subnet (sell/restore/resell subnets) from a supernet.
## Installation
```powershell
git clone https://github.com/sarumaj/subnet-seller
cd subnet-seller
Invoke-Command -FilePath .\install.ps1
```
## Usage
```powershell
$mySub = New-Subnet '192.168.0.0' 16 6 26
Write-Host ($mySub | Out-String)
>>
>>
>>
>> RecursionLevel : 0
>> IPAddress : 192.168.0.0
>> MaskBits : 16
>> NetworkAddress : 192.168.0.0
>> BroadcastAddress : 192.168.255.255
>> SubnetMask : 255.255.0.0
>> Range : 192.168.0.0 ~ 192.168.255.255
>> Available : True
>> HostAddresses : 65534
>> MaskOffset : 6
>> MaskLimit : 26
>>
>>
>>
Write-Host ($mySub.list() | Out-String)
>>
>>
>>
>> Network : 192.168.0.0/16
>> Available : True
>> Range : 192.168.0.0 ~ 192.168.255.255
>> HostAddresses : 65534
>> Subnets : {@{Network=192.168.0.0/23; Available=True; Range=192.168.0.0 ~ 192.168.1.255; HostAddresses=510; Subnets=System.Object[]}, @{Network=192.168.2.0/23;
>> Available=True; Range=192.168.2.0 ~ 192.168.3.255; HostAddresses=510; Subnets=System.Object[]}...}
>>
>>
>>
$mySub.sell('192.168.2.128', 25, "sold-out on $(Get-Date)")
$mySub.sell('192.168.3.0', 25, "sold-out on $(Get-Date)")
$mySub.sell('192.168.3.128', 26, "sold-out on $(Get-Date)")
$mySub.repurchase('192.168.2.128', 25, "repurchased on $(Get-Date)")
$mySub.repurchase('192.168.3.128', 26, "repurchased on $(Get-Date)")
$mySub.print()
>>
>>
>>
>> 192.168.0.0/16(Available:False)
>> --------------192.168.0.0/23(Available:True)
>> ----------------192.168.0.0/24(Available:True)
>> ------------------192.168.0.0/25(Available:True)
>> --------------------192.168.0.0/26(Available:True)
>> --------------------192.168.0.64/26(Available:True)
>> ------------------192.168.0.128/25(Available:True)
>> --------------------192.168.0.128/26(Available:True)
>> --------------------192.168.0.192/26(Available:True)
>> ----------------192.168.1.0/24(Available:True)
>> ------------------192.168.1.0/25(Available:True)
>> --------------------192.168.1.0/26(Available:True)
>> --------------------192.168.1.64/26(Available:True)
>> ------------------192.168.1.128/25(Available:True)
>> --------------------192.168.1.128/26(Available:True)
>> --------------------192.168.1.192/26(Available:True)
>> --------------192.168.2.0/23(Available:False)
>> ----------------192.168.2.0/24(Available:True)
>> ------------------192.168.2.0/25(Available:True)
>> --------------------192.168.2.0/26(Available:True)
>> --------------------192.168.2.64/26(Available:True)
>> ------------------192.168.2.128/25(Available:True,Comment:repurchased on 04/25/2022 10:14:45)
>> --------------------192.168.2.128/26(Available:True)
>> --------------------192.168.2.192/26(Available:True)
>> ----------------192.168.3.0/24(Available:False)
>> ------------------192.168.3.0/25(Available:False,Comment:sold-out on 04/25/2022 10:14:45)
>> ------------------192.168.3.128/25(Available:True)
>> --------------------192.168.3.128/26(Available:True,Comment:repurchased on 04/25/2022 10:14:45)
>> --------------------192.168.3.192/26(Available:True)
>> ...
```
## Snapshots
### #1 192.168.0.0/27 split down from /29 to /32
![test](https://github.com/sarumaj/subnet-seller/blob/master/plantuml/output/%230%20init%20192.168.0.0%20from%2029%20to%2032.png)
### #2 Sold 192.168.0.0/30
![test](https://github.com/sarumaj/subnet-seller/blob/master/plantuml/output/%231%20sold%20192.168.0.0_30.png)
### #3 Sold 192.168.0.8/31
![test](https://github.com/sarumaj/subnet-seller/blob/master/plantuml/output/%232%20sold%20192.168.0.8_31.png)
### #4 Repurchased 192.168.0.8/31
![test](https://github.com/sarumaj/subnet-seller/blob/master/plantuml/output/%233%20repurchased%20192.168.0.8_31.png)
近期下载者:
相关文件:
收藏者: