User Tools

Site Tools


os:windows:netsh

netsh

Rename Interface

netsh interface set interface name="Local Area Connection" newname="LAN"
Example
PS C:\> netsh interface ipv4 show subinterface "Local Area Connection"

       MTU  MediaSenseState      Bytes In     Bytes Out  Interface
----------  ---------------  ------------  ------------  -------------
4294967295                1             0          9008  Loopback Pseudo-Interface 1
      1500                1    6497186526    3705920924  Local Area Connection

PS C:\> netsh interface set interface name="Local Area Connection" newname="LAN"
OK

PS C:\> netsh interface ipv4 show subinterface "Local Area Connection"

       MTU  MediaSenseState      Bytes In     Bytes Out  Interface
----------  ---------------  ------------  ------------  -------------
4294967295                1             0          9008  Loopback Pseudo-Interface 1
      1500                1    6497186527    3705920925  LAN

Configure Interface Address

Static

netsh interface ip set address name="LAN" static 192.0.2.150 255.255.255.0 192.0.2.1 1
netsh interface ip set dns name="LAN" static 192.0.2.1

DHCP

netsh interface ip set address "LAN" dhcp

Show Interface Configuration

Show the configuration of the interface named 'LAN'.

netsh interface ip show config "LAN"
Example
PS C:\> netsh interface ip show config "LAN"

Configuration for interface "LAN"
    DHCP enabled:                         Yes
    IP Address:                           192.0.2.150
    Subnet Prefix:                        192.0.2.0/24 (mask 255.255.255.0)
    Default Gateway:                      192.0.2.1
    Gateway Metric:                       0
    InterfaceMetric:                      25
    Statically Configured DNS Servers:    192.0.2.1
    Register with which suffix:           Primary only
    WINS servers configured through DHCP: None

MTU Configuration

Show Current MTU Configuration

netsh interface ipv4 show subinterface
Example
PS C:\> netsh interface ipv4 show subinterface

       MTU  MediaSenseState      Bytes In     Bytes Out  Interface
----------  ---------------  ------------  ------------  -------------
4294967295                1             0          9008  Loopback Pseudo-Interface 1
      1500                1    6497186526    3705920924  LAN

Set MTU on Interface

Set the MTU oft the interface named “LAN” to 1420.

netsh interface ipv4 set interface "LAN" mtu=1420
Example
PS C:\> netsh interface ipv4 set interface "LAN" mtu=1420
Ok.

Check the configuration.

Example
PS C:\> netsh interface ipv4 show subinterface "LAN"

       MTU  MediaSenseState      Bytes In     Bytes Out  Interface
----------  ---------------  ------------  ------------  -------------
      1420                1    6497505732    3706327577  LAN
os/windows/netsh.txt · Last modified: 2024-05-29 22:16 by Manuel Frei