os:windows:netsh
Table of Contents
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
Proxy Port
Configuration
- Example
netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=80 connectaddress=example.com
List Proxy Configurations
netsh interface portproxy show all
- Example
PS C:\> netsh interface portproxy show all Listen on ipv4: Connect to ipv4: Address Port Address Port --------------- ---------- --------------- ---------- 0.0.0.0 8080 example.com 80
Remove
netsh interface portproxy delete v4tov4 listenport=8080 listenaddress=0.0.0.0
Check again.
- Example
PS C:\> netsh interface portproxy show all PS C:\>
Links
os/windows/netsh.txt · Last modified: 2024-09-10 00:09 by Manuel Frei