A basic network configuration at Vultr consists of a single IPv4 address, configured by DHCP. If you have advanced networking requirements, Vultr supports multiple public IPs and up to five private networks. You need to manually configure these advanced scenarios. Refer to the networking configuration page in the customer portal for your exact configuration. This example demonstrates three public IPv4 addresses, two private IPv4 networks, and two public IPv6 addresses.
This tutorial applies to:
Open the server information page in the customer portal. Make a note of the IP information. This tutorial uses the values shown below.
Click the network configuration link to locate the IPv4 DNS server information. This tutorial uses DNS servers:
A secondary IPv6 address of 2001:db8:1000::200 will also be added to the public adapter.
Look up the Adapter info.
PS> Get-NetAdapter | Format-List -Property Name, ifIndex
The report displays:
Name : Ethernet
ifIndex : 1
Name : Ethernet 2
ifIndex : 2
Name : Ethernet 3
ifIndex : 3
The interface Name corresponds to the adapter name in the Network and Sharing Center. The ifIndex is also known as InterfaceIndex in PowerShell. The ifIndex for your adapters will be different. For simplicity, this tutorial uses:
Verify the current status of the public adapter.
PS > Get-NetIPAddress -InterfaceIndex 1
Verify IPAddress matches the Main IP shown on the server information page, and PrefixOrigin is "Dhcp" to confirm "InterfaceIndex 1" is the public adapter.
IPAddress : 192.0.2.101
InterfaceIndex : 1
InterfaceAlias : Ethernet
AddressFamily : IPv4
Type : Unicast
PrefixLength : 23
PrefixOrigin : Dhcp
SuffixOrigin : Dhcp
Making IP changes via RDP is not advised because the network will drop while changes are made. However, the web console does not allow copy-paste of the PowerShell commands below. For convenience, make a copy of the commands in Notepad on the server via RDP, then continue on the web console.
Turn off DHCP on the public interface.
PS> Set-NetIPInterface -InterfaceIndex 1 -Dhcp Disabled
Set the static IP address on the public interface.
PS> New-NetIPAddress –InterfaceIndex 1 –IPAddress 192.0.2.101 –PrefixLength 23 -DefaultGateway 192.0.2.1 -AddressFamily IPv4
The parameters explained:
Set a second static IP address on the public interface. A -PrefixLength of 32 sets the Netmask to 255.255.255.255.
PS> New-NetIPAddress –InterfaceIndex 1 –IPAddress 192.0.2.102 –PrefixLength 32 -AddressFamily IPv4
An example of a third static IP address on the public interface:
PS> New-NetIPAddress –InterfaceIndex 1 –IPAddress 192.0.2.103 –PrefixLength 32 -AddressFamily IPv4
The public interface receives an IPv6 address via DHCP. Turn off IPv6 randomized privacy addressing:
PS> Set-NetIPv6Protocol -RandomizeIdentifiers Disabled
PS> Set-NetIPv6Protocol -UseTemporaryAddresses Disabled
Add a second IPv6 address to the public interface.
PS> New-NetIPAddress –InterfaceIndex 1 –IPAddress 2001:db8:1000::200 –PrefixLength 64 -AddressFamily IPv6
Set the IPv4 and IPv6 DNS on the public interface. You may add multiple IPv4 and IPv6 DNS servers if desired.
PS> Set-DnsClientServerAddress -InterfaceIndex 1 -ServerAddresses ("192.0.2.200","2001:db8:1000::1")
Add an IP address to the first private network, InterfaceIndex 2. A -PrefixLength of 20 sets the Netmask to 255.255.240.0.
PS> New-NetIPAddress –InterfaceIndex 2 –IPAddress 10.1.1.100 –PrefixLength 20 -AddressFamily IPv4
Add an IP address to InterfaceIndex 3, the second private network.
PS> New-NetIPAddress –InterfaceIndex 3 –IPAddress 10.2.2.200 –PrefixLength 20 -AddressFamily IPv4
Set the MTU to 1450 bytes on both private network interfaces.
PS> Set-NetIPInterface –InterfaceIndex 2 -NlMtuBytes 1450
PS> Set-NetIPInterface –InterfaceIndex 3 -NlMtuBytes 1450
Verify the DNS servers are correct.
PS> Get-DnsClientServerAddress -InterfaceIndex 1
InterfaceAlias Interface Address ServerAddresses
Index Family
-------------- --------- ------- ---------------
Ethernet 1 IPv4 {192.0.2.200}
Ethernet 1 IPv6 {2001:db8:1000::1}
Verify the public gateway.
PS> Get-NetRoute -DestinationPrefix "0.0.0.0/0" | Format-List -Property ifIndex, DestinationPrefix, NextHop
ifIndex : 1
DestinationPrefix : 0.0.0.0/0
NextHop : 45.77.150.1
Verify the IPv4 info for all adapters.
PS> Get-NetIPAddress -InterfaceIndex 1 -AddressFamily IPv4
PS> Get-NetIPAddress -InterfaceIndex 2 -AddressFamily IPv4
PS> Get-NetIPAddress -InterfaceIndex 3 -AddressFamily IPv4
Verify the IPv6 info for the public adapter.
PS> Get-NetIPAddress -InterfaceIndex 1 -AddressFamily IPv6
Verify the MTU setting. The public interface will be 1500, the two private adapters will be 1450.
PS> Get-NetIPInterface –InterfaceIndex 1
PS> Get-NetIPInterface –InterfaceIndex 2
PS> Get-NetIPInterface –InterfaceIndex 3
Windows networking is fully configurable from the command-line. After completing these steps in PowerShell, these values will be visible in the GUI network dialogs.
You could earn up to $300 by adding new articles