Ferramentas do usuário

Ferramentas do site


infra-estrutura:microsoft:windows_visualizando_configurando_rede_utilizando_netsh

Diferenças

Aqui você vê as diferenças entre duas revisões dessa página.

Link para esta página de comparações

Ambos lados da revisão anterior Revisão anterior
infra-estrutura:microsoft:windows_visualizando_configurando_rede_utilizando_netsh [2019/04/07 19:33]
ricardobarbosams
infra-estrutura:microsoft:windows_visualizando_configurando_rede_utilizando_netsh [2019/04/07 19:36] (atual)
ricardobarbosams
Linha 1: Linha 1:
 Show Interface configuration Show Interface configuration
 +<code bash>
 netsh interface ipv4 show config netsh interface ipv4 show config
 +</​code>​
  
 Only IP Addresses of all LAN adapters Only IP Addresses of all LAN adapters
  
 +<code bash>
 netsh interface ipv4 show address netsh interface ipv4 show address
 +</​code>​
 Show global TCP/IP Parameters Show global TCP/IP Parameters
  
 +<code bash>
 netsh interface ipv4 show global netsh interface ipv4 show global
 +</​code>​
 Disable and enable a Interface Disable and enable a Interface
  
 +<code bash>
 netsh int set int name="​ethernet"​ admin=disabled netsh int set int name="​ethernet"​ admin=disabled
 netsh int set int name="​ethernet"​ admin=enabled netsh int set int name="​ethernet"​ admin=enabled
 +</​code>​
  
 Show all network ​ interfaces and its link state Show all network ​ interfaces and its link state
  
 +<code bash>
 netsh interface ipv4 show interfaces netsh interface ipv4 show interfaces
 +</​code>​
 Print the routing table Print the routing table
  
 +<code bash>
 netsh interface ipv4 show route netsh interface ipv4 show route
 +</​code>​
 Show all tcp connections Show all tcp connections
  
 +<code bash>
 netsh interface ipv4 show tcpconnections netsh interface ipv4 show tcpconnections
 +</​code>​
 +Which Multicast groups are joined
  
-Which Multicast groups are joined+<code bash>
 netsh interface ipv4 show joins netsh interface ipv4 show joins
 +</​code>​
 Show dynamic portrange for outgoing connections Show dynamic portrange for outgoing connections
 +<code bash>
 netsh interface ipv4 show dynamicportrange protocol=tcp netsh interface ipv4 show dynamicportrange protocol=tcp
 +</​code>​
 Set a static IP Address (172.16.254.2),​ Subnet Mask (255.255.255.192) and Gateway (172.16.254.1) on a specific interface (Local Area Connection 2) persistent Set a static IP Address (172.16.254.2),​ Subnet Mask (255.255.255.192) and Gateway (172.16.254.1) on a specific interface (Local Area Connection 2) persistent
  
 +<code bash>
 netsh interface ipv4 set address name="​Local Area Connection 2" static 172.16.254.2 255.255.255.192 172.16.254.1 store=persistent netsh interface ipv4 set address name="​Local Area Connection 2" static 172.16.254.2 255.255.255.192 172.16.254.1 store=persistent
 +</​code>​
 and temporary up to the next reboot and the parameters at full length. After the reboot the IP Address is empty. and temporary up to the next reboot and the parameters at full length. After the reboot the IP Address is empty.
 +<code bash>
 netsh interface ipv4 set address name="​Local Area Connection 2" static address=172.16.254.2 mask=255.255.255.192 gateway=172.16.254.1 store=active netsh interface ipv4 set address name="​Local Area Connection 2" static address=172.16.254.2 mask=255.255.255.192 gateway=172.16.254.1 store=active
 +</​code>​
 Set DNS Servers without a DNS check, the  set dnsservers command supports only one server as argument Set DNS Servers without a DNS check, the  set dnsservers command supports only one server as argument
 +<code bash>
 netsh interface ipv4 set dnsservers name="​Local Area Connection 2" ​ source=static address="​172.16.254.250"​ validate=no netsh interface ipv4 set dnsservers name="​Local Area Connection 2" ​ source=static address="​172.16.254.250"​ validate=no
 +</​code>​
 you have to add a second DNS Server with the add dnsservers directive you have to add a second DNS Server with the add dnsservers directive
  
 +<code bash>
 netsh interface ipv4 add dnsservers name="​Local Area Connection 2" address="​172.16.254.251"​ validate=no index=2 netsh interface ipv4 add dnsservers name="​Local Area Connection 2" address="​172.16.254.251"​ validate=no index=2
 +</​code>​
 Set IP Address assignment on Interface to DHCP Set IP Address assignment on Interface to DHCP
 +<code bash>
 netsh interface ipv4 set address name="​Local Area Connection 2" source=dhcp netsh interface ipv4 set address name="​Local Area Connection 2" source=dhcp
 +</​code>​
 and also the DNS Servers and also the DNS Servers
 +<code bash>
 netsh interface ipv4 set dnsservers name="​Local Area Connection 2" source=dhcp netsh interface ipv4 set dnsservers name="​Local Area Connection 2" source=dhcp
 +</​code>​
 Add a route  for subnet 172.16.1.0/​24 over interface “Local Area Connection 2” and router 172.16.254.254 Add a route  for subnet 172.16.1.0/​24 over interface “Local Area Connection 2” and router 172.16.254.254
 +<code bash>
 netsh interface add route prefix=172.16.1.0/​24 interface="​Local Area Connection 2" nexthop=172.16.254.254 netsh interface add route prefix=172.16.1.0/​24 interface="​Local Area Connection 2" nexthop=172.16.254.254
 +</​code>​
 Note: Since Windows Vista its not possible to set the dns search suffix with netsh, you have to use WMI for this. Note: Since Windows Vista its not possible to set the dns search suffix with netsh, you have to use WMI for this.
 To set the DNS search suffix use powershell and wmi. To set the DNS search suffix use powershell and wmi.
 Define your Domains Define your Domains
  
 +<code bash>
 [string[]]$aDNSSearchSuffixes=@("​subdomain.domain1.local","​subdomain.domain2.local"​) [string[]]$aDNSSearchSuffixes=@("​subdomain.domain1.local","​subdomain.domain2.local"​)
 +</​code>​
 Get the WMI Class to invoke the static method SetDNSSuffixSearchOrder Get the WMI Class to invoke the static method SetDNSSuffixSearchOrder
 +<code bash>
 $oNetworkadapterConfiguration=[wmiclass]"​Win32_NetworkadapterConfiguration"​ $oNetworkadapterConfiguration.SetDNSSuffixSearchOrder($aDNSSearchSuffixes) $oNetworkadapterConfiguration=[wmiclass]"​Win32_NetworkadapterConfiguration"​ $oNetworkadapterConfiguration.SetDNSSuffixSearchOrder($aDNSSearchSuffixes)
 +</​code>​
 Or invoke the method directly by calling the Invoke-WmiMethod commandlet Or invoke the method directly by calling the Invoke-WmiMethod commandlet
  
 +<code bash>
 Invoke-WmiMethod -Class Win32_NetworkadapterConfiguration -Name SetDNSSuffixSearchOrder -ArgumentList @(@("​subdomain.domain1.local","​subdomain.domain2.local"​),​$null) Invoke-WmiMethod -Class Win32_NetworkadapterConfiguration -Name SetDNSSuffixSearchOrder -ArgumentList @(@("​subdomain.domain1.local","​subdomain.domain2.local"​),​$null)
 +</​code>​
 or or
  
 +<code bash>
 Invoke-WmiMethod -Class Win32_NetworkadapterConfiguration -Name SetDNSSuffixSearchOrder -ArgumentList @($aDNSSearchSuffixes,​$null) Invoke-WmiMethod -Class Win32_NetworkadapterConfiguration -Name SetDNSSuffixSearchOrder -ArgumentList @($aDNSSearchSuffixes,​$null)
 +</​code>​
 Note: If the aDNSSearchSuffixes Array contains more then one element a second parameter of $null is requiered otherwise the Invoke-WmiMethod command failed with error: Invoke-WmiMethod : Unable to cast object of type ‘System.String’ to type ‘System.Array’. Note: If the aDNSSearchSuffixes Array contains more then one element a second parameter of $null is requiered otherwise the Invoke-WmiMethod command failed with error: Invoke-WmiMethod : Unable to cast object of type ‘System.String’ to type ‘System.Array’.
 +
 +
infra-estrutura/microsoft/windows_visualizando_configurando_rede_utilizando_netsh.txt · Última modificação: 2019/04/07 19:36 por ricardobarbosams