Networking Sample 1
1) We list out the network adapters available on the server Find the interface to set by
executing Get-NetIPInterface:
2) Configure the identified interface with IPv4 address and DNS targets for the specified
interface.
Set the IP information using New-NetIPAddress:
New-NetIPAddress -AddressFamily IPv4 -IPAddress 10.10.10.10
-PrefixLength 24 -InterfaceAlias Ethernet
Set DNS Servers using Set-DnsClientServerAddress:
Set-DnsClientServerAddress -InterfaceAlias Ethernet
-ServerAddresses "10.10.10.10","10.10.10.11"
3) Identify this route as the default route, or default gateway.
Set the default route using New-NetRoute:
New-NetRoute -DestinationPrefix "0.0.0.0/0" -NextHop "10.10.10.1"
-InterfaceAlias Ethernet
4) For making the changes in relation to IPv6, the following are examples of configuring IPv6
on the same host:
New-NetIPAddress -AddressFamily IPv6 -IPAddress 2001:db8:1::10 `
-PrefixLength 64 -InterfaceAlias Ethernet
New-NetRoute -DestinationPrefix ::/0 -NextHop 2001:db8:1::1 `
-InterfaceAlias Ethernet
Set-DnsClientServerAddress -InterfaceAlias Ethernet `
-ServerAddresses "2001:db8:1::10","2001:db8:1::11"
For Additional IP addresses: By using the New-NetIPAddress function, an interface
can be configured with multiple IP addresses simultaneously.
New-NetIPAddress -AddressFamily IPv4 -IPAddress 10.10.10.250
-PrefixLength 24 -InterfaceAlias Ethernet
Using get-route will show all the routes that are defined on a system.