add scripts for a simple private network.

master
jowj 6 years ago
parent ea6e34379e
commit ddd0560e5d

@ -0,0 +1,36 @@
@{
AllNodes = @(
@{
NodeName = '*';
InterfaceAlias = 'Ethernet';
AddressFamily = 'IPv4';
Lability_SwitchName = "Wifi-HyperV-VSwitch";
Lability_Media = 'WIN10_x64_Enterprise_EN_Eval';
Lability_ProcessorCount = 1;
Lability_StartupMemory = 2GB;
PSDscAllowPlainTextPassword = $true;
}
@{
NodeName = 'CLIENT1';
Role = 'CLIENT';
IPAddress = '10.0.0.1/24';
}
@{
NodeName = 'CLIENT2';
Role = 'CLIENT';
IPAddress = '10.0.0.2/24';
}
);
NonNodeData = @{
Lability = @{
EnvironmentPrefix = 'SIMPLENET-';
Network = @(
@{ Name = 'CORP'; Type = 'Private'; }
)
DSCResource = @(
@{ Name = 'xComputerManagement'; RequiredVersion = '4.1.0.0'; }
@{ Name = 'xNetworking'; RequiredVersion = '5.7.0.0'; }
);
};
};
};

@ -0,0 +1,50 @@
Configuration SimpleNetworkConfig {
param ()
Import-DscResource -Module PSDesiredStateConfiguration
Import-DscResource -Module xComputerManagement -ModuleVersion 4.1.0.0
Import-DscResource -Module xNetworking -ModuleVersion 5.7.0.0
# Common configuration for all nodes
node $AllNodes.Where({$_.Role -in 'CLIENT'}).NodeName {
LocalConfigurationManager {
RebootNodeIfNeeded = $true;
AllowModuleOverwrite = $true;
ConfigurationMode = 'ApplyOnly';
}
xFirewall 'FPS-ICMP4-ERQ-In' {
Name = 'FPS-ICMP4-ERQ-In';
DisplayName = 'File and Printer Sharing (Echo Request - ICMPv4-In)';
Description = 'Echo request messages are sent as ping requests to other nodes.';
Direction = 'Inbound';
Action = 'Allow';
Enabled = 'True';
Profile = 'Any';
}
xFirewall 'FPS-ICMP6-ERQ-In' {
Name = 'FPS-ICMP6-ERQ-In';
DisplayName = 'File and Printer Sharing (Echo Request - ICMPv6-In)';
Description = 'Echo request messages are sent as ping requests to other nodes.';
Direction = 'Inbound';
Action = 'Allow';
Enabled = 'True';
Profile = 'Any';
}
xIPAddress 'PrimaryIPAddress' {
IPAddress = $node.IPAddress
InterfaceAlias = $node.InterfaceAlias
AddressFamily = $node.AddressFamily
}
xComputer 'Hostname' {
Name = $node.NodeName;
}
}
}

@ -0,0 +1,14 @@
[CmdletBinding()] Param(
[SecureString] $AdminPassword = (Read-Host -AsSecureString -Prompt "Admin password"),
[string] $ConfigurationData = (Join-Path -Path $PSScriptRoot -ChildPath ConfigurationData.SIMPLENET.psd1),
[string] $ConfigureScript = (Join-Path -Path $PSScriptRoot -ChildPath Configure.SIMPLENET.ps1),
[string] $DscConfigName = "SimpleNetworkConfig",
[switch] $IgnorePendingReboot
)
$ErrorActionPreference = "Stop"
. $ConfigureScript
& $DscConfigName -ConfigurationData $ConfigurationData -OutputPath $env:LabilityConfigurationPath -Verbose
Start-LabConfiguration -ConfigurationData $ConfigurationData -Path $env:LabilityConfigurationPath -Verbose -Password $AdminPassword -IgnorePendingReboot:$IgnorePendingReboot
Start-Lab -ConfigurationData $ConfigurationData -Verbose
Loading…
Cancel
Save