Adding multiple Gateways to IPV4 Network Adapter

Kevin T 21 Reputation points
2021-06-01T10:26:08.733+00:00

I am trying to add multiple default gateways to a VM IPV4 Configuration. However the attempts ive made only seem to allow me to add 1. Ive tried the following but nothing is setting 2. The reason we use 2 DGWs is for failover to alternate DCs. Please help!

This command doesnt allow me to use a string for IPAddress
New-NetIPAddress -AddressFamily IPV4 -IPAddress <IPAddress> -DefaultGateway "DGW1","DGW2" -InterfaceAlias 8

$wmi = get-wmiobject win32_networkadapterconfiguration -filter "ipenabled = 'true'"

$wmi.SetGateways("DGW1", 1)
$wmi.SetGateways("DGW2", 2)

$wmi.SetGateways("DGW1", 1),("DGW2", 2)

Windows for business Windows Client for IT Pros Networking Network connectivity and file sharing
0 comments No comments
{count} votes

Accepted answer
  1. amomen 381 Reputation points
    2021-06-01T10:50:45.11+00:00

    Hi Kevint1985!

    Have you tried the following command from an elevated command prompt?

    route -p add 0.0.0.0 mask 0.0.0.0 192.168.44.3 if 10

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Kevin T 21 Reputation points
    2021-06-01T10:56:28.61+00:00

    Thanks that added 192.168.44.3 as an additional DGW


  2. Kevin T 21 Reputation points
    2021-06-01T12:24:48.04+00:00

    thanks for the tip. Is there a reason it reads back Ok! but when checking in the network adapter IPV4 settings it doesnt appear?. But if you do a print it shows?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.