netsh is not a tool which I would use on a daily basis, and I tripped on setting default gateway while on a project of video streaming. Hereunder is problem/solution statement.
Problem description:
Windows would not accept the command for setting ip address and would present the cli help for netsh context.
##### CAPTURE #####
C:\>netsh interface ip set address name="Local Area Connection" source=static addr=10.0.0.210 mask=255.255.255.0 gateway=10.0.0.1
The syntax supplied for this command is not valid. Check help for the correct syntax.
Usage: set address [name=]
[[source=]dhcp |
[source=] static [addr=]IP address [mask=]IP subnet mask]
[[gateway=]|none [gwmetric=]integer]
Parameters:
Tag Value
name - The name of the interface.
source - One of the following values:
dhcp: Sets DHCP as the source for configuring IP
addresses for the specific interface.
static: Sets the source for configuring IP addresses
to local static configuration.
gateway - One of the following values:
: A specific default gateway for the
static IP address you are setting.
none: No default gateways are set.
gwmetric - The metric for the default gateway. This field should
not be set if gateway is set to 'none'.
The following options are used only if source is 'static':
addr - An IP address for the specified interface.
mask - The subnet mask for the specified IP address.
Remarks: Used to change the IP address configuration mode from either DHCP to
static mode or static mode to DHCP. Adds IP addresses on an
interface with static IP address or adds default gateways.
Examples:
set address name="Local Area Connection" source=dhcp
set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1
C:\>
##########
Solution :
You can't add gateway without a metric.
netsh interface ip set address name="Local Area Connection" source=static addr=10.0.0.210 mask=255.255.255.0 gateway=10.0.0.1 gwmetric=10
Hence, adding gwmetric with value resolved the issue.