diff --git a/CHANGELOG.md b/CHANGELOG.md index aa15094c..6aa888c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ - Fix error when setting address on adapter where NameServer Property does not exist in registry for interface - see [issue #237](https://github.com/PowerShell/xNetworking/issues/237) +- MSFT_xIPAddress: + - Improved examples to clarify how to set IP Address prefix - + see [issue #239](https://github.com/PowerShell/xNetworking/issues/239) ## 5.0.0.0 diff --git a/Modules/xNetworking/Examples/Resources/xIPAddress/1-AddingStaticIP.ps1 b/Modules/xNetworking/Examples/Resources/xIPAddress/1-AddingStaticIP.ps1 index c0ee3a84..71ddb1d9 100644 --- a/Modules/xNetworking/Examples/Resources/xIPAddress/1-AddingStaticIP.ps1 +++ b/Modules/xNetworking/Examples/Resources/xIPAddress/1-AddingStaticIP.ps1 @@ -1,6 +1,7 @@ <# .EXAMPLE Disabling DHCP and adding a static IP Address for IPv6 and IPv4 + using default prefix lengths for the matching address classes #> Configuration Example { @@ -25,7 +26,7 @@ Configuration Example # If no prefix is supplied IPv6 will default to /64. xIPAddress NewIPv6Address { - IPAddress = '2001:4898:200:7:6c71:a102:ebd8:f482/64' + IPAddress = '2001:4898:200:7:6c71:a102:ebd8:f482' InterfaceAlias = 'Ethernet' AddressFamily = 'IPV6' } diff --git a/Modules/xNetworking/Examples/Resources/xIPAddress/2-AddingMultipleStaticIP.ps1 b/Modules/xNetworking/Examples/Resources/xIPAddress/2-AddingMultipleStaticIP.ps1 index e80f636b..4680718d 100644 --- a/Modules/xNetworking/Examples/Resources/xIPAddress/2-AddingMultipleStaticIP.ps1 +++ b/Modules/xNetworking/Examples/Resources/xIPAddress/2-AddingMultipleStaticIP.ps1 @@ -1,6 +1,6 @@ <# .EXAMPLE - Disabling DHCP and adding multiple static IP Addresses for IPv6 + Disabling DHCP and adding multiple static IP Addresses for IPv4 and IPv6 #> Configuration Example { @@ -22,11 +22,18 @@ Configuration Example AddressFamily = 'IPv6' } - xIPAddress NewIPAddress + xIPAddress NewIPv6Address { IPAddress = '2001:4898:200:7:6c71:a102:ebd8:f482/64','2001:4598:210:7:6d71:a102:ebe8:f483/64' InterfaceAlias = 'Ethernet' AddressFamily = 'IPV6' } + + xIPAddress NewIPv4Address + { + IPAddress = '192.168.10.5/24','192.168.10.6/24' + InterfaceAlias = 'Ethernet' + AddressFamily = 'IPV4' + } } } diff --git a/Modules/xNetworking/Examples/Resources/xIPAddress/3-AddingStaticIPWithPrefix.ps1 b/Modules/xNetworking/Examples/Resources/xIPAddress/3-AddingStaticIPWithPrefix.ps1 new file mode 100644 index 00000000..e33e56d9 --- /dev/null +++ b/Modules/xNetworking/Examples/Resources/xIPAddress/3-AddingStaticIPWithPrefix.ps1 @@ -0,0 +1,40 @@ +<# + .EXAMPLE + Disabling DHCP and adding a static IP Address for IPv6 and IPv4 + using specified prefixes in CIDR notation. +#> +Configuration Example +{ + param + ( + [Parameter()] + [System.String[]] + $NodeName = 'localhost' + ) + + Import-DscResource -Module xNetworking + + Node $NodeName + { + xDhcpClient DisabledDhcpClient + { + State = 'Disabled' + InterfaceAlias = 'Ethernet' + AddressFamily = 'IPv6' + } + + xIPAddress NewIPv6Address + { + IPAddress = '2001:4898:200:7:6c71:a102:ebd8:f482/64' + InterfaceAlias = 'Ethernet' + AddressFamily = 'IPV6' + } + + xIPAddress NewIPv4Address + { + IPAddress = '192.168.10.5/24' + InterfaceAlias = 'Ethernet' + AddressFamily = 'IPV4' + } + } +}