On a VPS, the network is normally configured for you when the server is installed, and you shouldn’t need to change it. But there are good reasons to touch it: adding an extra IP address (multi-IP plans), changing DNS servers, or fixing a configuration after moving settings. A mistake here can cut off RDP, so work carefully.

Before you change anything

  • Write down the current configuration (IP, prefix length, gateway, DNS):
Get-NetIPConfiguration
Get-NetIPAddress -AddressFamily IPv4 | Select-Object InterfaceAlias, IPAddress, PrefixLength, PrefixOrigin
Get-NetRoute -DestinationPrefix 0.0.0.0/0
Get-DnsClientServerAddress -AddressFamily IPv4
  • Get the correct values for your VPS from the client area (IP addresses, netmask, gateway).
  • Use the VNC console from your VPS control panel for network changes, so you still have access if the network drops. See VPS VNC console.

Set a static IP with PowerShell

$if = "Ethernet"                                # from Get-NetAdapter
Set-NetIPInterface -InterfaceAlias $if -Dhcp Disabled
New-NetIPAddress -InterfaceAlias $if -IPAddress 203.0.113.10 -PrefixLength 24 -DefaultGateway 203.0.113.1
Set-DnsClientServerAddress -InterfaceAlias $if -ServerAddresses 1.1.1.1, 9.9.9.9

If an address already exists, remove the old one first (Remove-NetIPAddress), or you’ll get an “already exists” error. Use the prefix length matching your netmask (/24 = 255.255.255.0).

Add a second IP address

For multi-IP plans, add extra addresses to the same adapter:

New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 203.0.113.11 -PrefixLength 24 -SkipAsSource $true

-SkipAsSource $true keeps the primary IP as the source for outgoing connections, which keeps outbound traffic predictable. Then bind services to specific IPs (IIS bindings, game server configs). VPS.DO offers multi-IP VPS plans in the USA and Hong Kong. See multi-IP VPS and VPS IP addresses.

Change DNS servers only

Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 1.1.1.1, 8.8.8.8
Clear-DnsClientCache
Resolve-DnsName example.com

Reset to automatic (DHCP-provided) DNS:

Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ResetServerAddresses

The GUI way

Control Panel → Network and Sharing Center → Change adapter settings → right-click the adapter → Properties → Internet Protocol Version 4 (TCP/IPv4) → Properties. Enter the IP address, subnet mask, default gateway and DNS servers. Advanced lets you add extra IP addresses. (Or run ncpa.cpl.)

Verify

Get-NetIPConfiguration
Test-NetConnection 1.1.1.1
Test-NetConnection example.com -Port 443

Then test RDP from your computer, before closing the VNC console.

If you lost connectivity

From the VNC console:

Get-NetIPConfiguration                 # what's set now?
Remove-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress <wrong-ip> -Confirm:$false
Remove-NetRoute -InterfaceAlias "Ethernet" -DestinationPrefix 0.0.0.0/0 -Confirm:$false
# then re-add the correct address and gateway (above)

If the original configuration used DHCP, simply re-enable it: Set-NetIPInterface -InterfaceAlias "Ethernet" -Dhcp Enabled, then ipconfig /renew.

Common mistakes

  • Wrong prefix length: entering /32 or /16 instead of the netmask your provider uses breaks routing. Copy the values from the client area exactly.
  • Two default gateways: adding a gateway on a second adapter or address creates conflicting routes. One default gateway per server is normal.
  • Changing it over RDP without a fallback: the session freezes the moment the address changes. Always have the VNC console open.
  • Forgetting DNS: the server works by IP but can’t resolve names, so Windows Update, activation and downloads fail. Check with Resolve-DnsName.
  • Using the extra IP for outbound traffic by accident: without -SkipAsSource, Windows may pick it as the source address, which matters for allowlists and email reputation.

Quick reference

Task Cmdlet
Show config Get-NetIPConfiguration
Static IP + gateway New-NetIPAddress -IPAddress … -PrefixLength 24 -DefaultGateway …
Extra IP New-NetIPAddress … -SkipAsSource $true
DNS servers Set-DnsClientServerAddress -ServerAddresses …
Back to DHCP Set-NetIPInterface -Dhcp Enabled

Related: Windows Server DNS and static IP with netplan on Ubuntu.

  • Windows Server
  • Networking
  • PowerShell