PowerShell script exchange
Post Reply
matteu
Veeam Legend
Posts: 725
Liked: 118 times
Joined: May 11, 2018 8:42 am
Contact:

Virtual Lab private network

Post by matteu » 1 person likes this post

Hello,

I try to create virtual lab but it's not working because of these lines :

Code: Select all

[string]$SourceHostname = 'MyESXHost'

[string]$ProdNetworkName1 = 'PortGroup1'
[string]$IsolatedNetworkName1 = 'vLAB-Network1'
[int]$IsolatedNetworkVLANID1 = '10'

[string]$ProdNetworkName2 = 'PortGroup2'
[string]$IsolatedNetworkName2 = 'vLAN-Network2'
[int]$IsolatedNetworkVLANID2 = '20'


$SourceServer = Get-VBRServer -Name $SourceHostname
$SourceNetworks = Get-VBRViServerNetworkInfo -Server $SourceServer
$DestinationServer = Get-VBRServer -Name $SourceHostname


$ProdNetwork1 = $SourceNetworks | Where-Object { ($_.Type -eq 'ViSimple') -AND ($_.NetworkName -eq $ProdNetworkName1) }
$ProdNetwork2 = $SourceNetworks | Where-Object { ($_.Type -eq "ViSimple") -AND ($_.NetworkName -eq $ProdNetworkName2) }


$NetworkMapping1Properties = @{
    ProductionNetwork = $ProdNetwork1 
    IsolatedNetworkName = $IsolatedNetworkName1 
    VLANID = $IsolatedNetworkVLANID1
} 

$NetworkMapping1 = New-VBRViNetworkMappingRule -Server $DestinationServer @NetworkMapping1Properties


[string]$RemapIP1 = '192.168.10.1'
[string]$MaskIP1 = '255.255.255.0'
[string]$MasqueradeIP1 = '192.168.110.0'


$VirtualLabOptions1Properties = @{
    NetworkMappingRule = $NetworkMapping1 
    IPAddress = $RemapIP1 
    SubnetMask = $ProxyApplianceNetmask 
    MasqueradeIPAddress = $MaskIP1 
    DNSServer = $ProxyApplianceDNS1 
}

$VirtualLabNetworkOptions1 = New-VBRViVirtualLabNetworkOptions @VirtualLabOptions1Properties

The error is :

New-VBRViVirtualLabNetworkOptions : Failed to create network options. The specified masquerade network address is not private IP address.
Au caractère Ligne:109 : 30
+ ... kOptions1 = New-VBRViVirtualLabNetworkOptions @VirtualLabOptions1Prop ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-VBRViVirtualLabNetworkOptions], Exception
+ FullyQualifiedErrorId : System.Exception,Veeam.Backup.PowerShell.Cmdlets.NewVBRViVirtualLabNetworkOptions


=> My masquerade IP is 192.168.110.0 I don't know why it's talking about non private IP. Then, on GUI I can force it but how can I with powershell ?
Mildur
Product Manager
Posts: 8735
Liked: 2294 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Virtual Lab private network

Post by Mildur »

Hi Matteu
New-VBRViVirtualLabNetworkOptions : Failed to create network options. The specified masquerade network address is not private IP address.
I did not get this error message when I tried to do the same configuration in the GUI as you do in your script. You should not see a error about a "private IP address".
Can you open a support case and let us know the case number? I think it is worth checking why you are getting this error message in the first place.
A private IP address should not lead to this error message.

Thanks
Fabian
Product Management Analyst @ Veeam Software
matteu
Veeam Legend
Posts: 725
Liked: 118 times
Joined: May 11, 2018 8:42 am
Contact:

Re: Virtual Lab private network

Post by matteu » 2 people like this post

Hello,

Thanks for your answer !

I find my error in the log file : C:\Users\Username\AppData\Local\Veeam\Backup\VeeamPowerShell.log

Code: Select all

[26.09.2022 12:36:44] <12> Info         [49fba7a306a346a2817a2da9f7bd4210] BoundParameters: 'NetworkMappingRule' - 'Veeam.Backup.PowerShell.Infos.VBRViVirtualLabNetworkMappingRule'
[26.09.2022 12:36:44] <12> Info         [49fba7a306a346a2817a2da9f7bd4210] BoundParameters: 'MasqueradeIPAddress' - '255.255.255.0'
[26.09.2022 12:36:44] <12> Info         [49fba7a306a346a2817a2da9f7bd4210] BoundParameters: 'SubnetMask' - '255.255.255.0'
[26.09.2022 12:36:44] <12> Info         [49fba7a306a346a2817a2da9f7bd4210] BoundParameters: 'IPAddress' - '192.168.10.1'
I made an error on my script I forget to replace some value

Code: Select all

$VirtualLabOptions1Properties = @{
    NetworkMappingRule = $NetworkMapping1 
    IPAddress = $RemapIP1 
    SubnetMask = $ProxyApplianceNetmask 
    MasqueradeIPAddress = $MaskIP1 
    DNSServer = $ProxyApplianceDNS1 
}

=> 

$VirtualLabOptions1Properties = @{
    NetworkMappingRule = $NetworkMapping1 
    IPAddress = $RemapIP1 
    SubnetMask = $MaskIP1 
    MasqueradeIPAddress = $MasqueradeIP1 
    DNSServer = $ProxyApplianceDNS1 
}
It's working now :)
Mildur
Product Manager
Posts: 8735
Liked: 2294 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Virtual Lab private network

Post by Mildur »

Thanks for the update.
I'm glad that it works now.
Product Management Analyst @ Veeam Software
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests