Tag: SMB

Get-NetIPConfiguration

Basic Networking PowerShell cmdlets cheatsheet to replace netsh, ipconfig, nslookup and more

Around 4 years ago I wrote a blog post about how to Replace netsh with Windows PowerShell which includes basic powershell networking cmdlets. After working with Microsoft Azure, Nano Server and Containers, PowerShell together with networking becomes more and more important. I created this little cheat sheet so it becomes easy for people to get started.

Basic Networking PowerShell cmdlets

Get-NetIPConfiguration

Get the IP Configuration (ipconfig with PowerShell)

Get-NetIPConfiguration

List all Network Adapters

Get-NetAdapter

Get a spesific network adapter by name

Get-NetAdapter -Name *Ethernet*

Get more information VLAN ID, Speed, Connection status

Get-NetAdapter | ft Name, Status, Linkspeed, VlanID

Get driver information

Get-NetAdapter | ft Name, DriverName, DriverVersion, DriverInformation, DriverFileName

Get adapter hardware information. This can be really usefull when you need to know the PCI slot of the NIC.

Get-NetAdapterHardwareInfo

Disable and Enable a Network Adapter

Disable-NetAdapter -Name "Wireless Network Connection"
Enable-NetAdapter -Name "Wireless Network Connection"

Rename a Network Adapter

Rename-NetAdapter -Name "Wireless Network Connection" -NewName "Wireless"

IP Configuration using PowerShell

PowerShell Networking Get-NetIPAddress

Get IP and DNS address information

Get-NetAdapter -Name "Local Area Connection" | Get-NetIPAddress

Get IP address only

(Get-NetAdapter -Name "Local Area Connection" | Get-NetIPAddress).IPv4Address

Get DNS Server Address information

Get-NetAdapter -Name "Local Area Connection" | Get-DnsClientServerAddress

Set IP Address

New-NetIPAddress -InterfaceAlias "Wireless" -IPv4Address 10.0.1.95 -PrefixLength "24" -DefaultGateway 10.0.1.1

or if you want to change a existing IP Address

Set-NetIPAddress -InterfaceAlias "Wireless" -IPv4Address 192.168.12.25 -PrefixLength "24"

Remove IP Address

Get-NetAdapter -Name "Wireless" | Remove-NetIPAddress

Set DNS Server

Set-DnsClientServerAddress -InterfaceAlias "Wireless" -ServerAddresses "10.10.20.1","10.10.20.2"

Set interface to DHCP

Set-NetIPInterface -InterfaceAlias "Wireless" -Dhcp Enabled

Clear DNS Cache with PowerShell

You can also manage your DNS cache with PowerShell.

List DNS Cache:

 
Get-DnsClientCache

Clear DNS Cache

 
Clear-DnsClientCache

Ping with PowerShell

PowerShell Networking Test-NetConnection Ping

How to Ping with PowerShell. For a simple ping command with PowerShell, you can use the Test-Connection cmdlet:

 
Test-Connection thomasmaurer.ch

There is an advanced way to test connection using PowerShell

Test-NetConnection -ComputerName www.thomasmaurer.ch

Get some more details from the Test-NetConnection

Test-NetConnection -ComputerName www.thomasmaurer.ch -InformationLevel Detailed

Ping multiple IP using PowerShell

1..99 | % { Test-NetConnection -ComputerName x.x.x.$_ } | FT -AutoSize

Tracert

PowerShell Tracert

Tracert with PowerShell

Test-NetConnection www.thomasmaurer.ch –TraceRoute

Portscan with PowerShell

PowerShell Portscan

Use PowerShell to check for open port

Test-NetConnection -ComputerName www.thomasmaurer.ch -Port 80
Test-NetConnection -ComputerName www.thomasmaurer.ch -CommonTCPPort HTTP

NSlookup in PowerShell

PowerShell Networking NSlookup

NSlookup using PowerShell:

Resolve-DnsName www.thomasmaurer.ch
Resolve-DnsName www.thomasmaurer.ch -Type MX -Server 8.8.8.8

Route in PowerShell

PowerShell Networking Route

How to replace Route command with PowerShell

Get-NetRoute -Protocol Local -DestinationPrefix 192.168*
Get-NetRoute -InterfaceAlias Wi-Fi
 
New-NetRoute –DestinationPrefix "10.0.0.0/24" –InterfaceAlias "Ethernet" –NextHop 192.168.192.1

NETSTAT in PowerShell

PowerShell Networking Netstat

How to replace NETSTAT with PowerShell

Get-NetTCPConnection
Get-NetTCPConnection –State Established

NIC Teaming PowerShell commands

Create a new NIC Teaming (Network Adapter Team)

New-NetLbfoTeam -Name NICTEAM01 -TeamMembers Ethernet, Ethernet2 -TeamingMode SwitchIndependent -TeamNicName NICTEAM01 -LoadBalancingAlgorithm Dynamic

SMB Related PowerShell commands

SMB PowerShell SMB Client Configuration

Get SMB Client Configuration

Get-SmbClientConfiguration

Get SMB Connections

Get-SmbConnection

Get SMB Mutlichannel Connections

Get-SmbMutlichannelConnection

Get SMB open files

Get-SmbOpenFile

Get SMB Direct (RDMA) adapters

Get-NetAdapterRdma

Hyper-V Networking cmdlets

Hyper-V PowerShell Get-VMNetwork Adapter

Get and set Network Adapter VMQ settings

Get-NetAdapterVmq
# Disable VMQ
Set-NetAdapterVmq -Enabled $false
# Enable VMQ
Set-NetAdapterVmq -Enabled $true

Get VM Network Adapter

Get-VMNetworkAdapter -VMName Server01

Get VM Network Adapter IP Addresses

(Get-VMNetworkAdapter -VMName NanoConHost01).IPAddresses

Get VM Network Adapter Mac Addresses

(Get-VMNetworkAdapter -VMName NanoConHost01).MacAddress

I hope you enjoyed it and the post was helpful, if you think something important is missing, please add it in the comments.



Cisco UCS Hardware

Cisco UCS supports RoCE for Microsoft SMB Direct

As you may know we use SMB as the storage protocol for several Hyper-V deployments using Scale-Out File Server and Storage Spaces which adds a lot value to your Hyper-V deployments. To boost performance Microsoft is using RDMA or SMB Direct to accelerate Storage network performance.

RDMA over Converged Ethernet (RoCE) allows direct memory access over an Ethernet network. RoCE is a link layer protocol, and hence, it allows communication between any two hosts in the same Ethernet broadcast domain. RoCE delivers superior performance compared to traditional network socket implementations because of lower latency, lower CPU utilization and higher utilization of network bandwidth. Windows Server 2012 and later versions use RDMA for accelerating and improving the performance of SMB file sharing traffic and Live Migration. If you need to know more about RDMA or SMB Direct checkout my blog post: Hyper-V over SMB: SMB Direct

With Cisco UCS Manager Release 2.2(4), Cisco finally supports RoCE for SMB Direct. It sends additional configuration information to the adapter while creating or modifying an Ethernet adapter policy.

Guidelines and Limitations for SMB Direct with RoCE

  • SMB Direct with RoCE is supported only on Windows Server 2012 R2.
  • SMB Direct with RoCE is supported only with Cisco UCS VIC 1340 and 1380 adapters.
  • Cisco UCS Manager does not support more than 4 RoCE-enabled vNICs per adapter.
  • Cisco UCS Manager does not support RoCE with NVGRE, VXLAN, NetFlow, VMQ, or usNIC.
  • You can not use Windows Server NIC Teaming together with RMDA enabled adapters in Windows Server 2012 and Windows Server 2012 R2 or you will lose RDMA feature on these adapters.
  • Maximum number of queue pairs per adapter is 8192.
  • Maximum number of memory regions per adapter is 524288.
  • If you do not disable RoCE before downgrading Cisco UCS Manager from Release 2.2(4), downgrade will fail.

Checkout my post about Hyper-V over SMB:



Hyper-V Gernal Access dinied error

Hyper-V over SMB: Set SMB Constrained Delegation via PowerShell

When you are having configured a Hyper-V over SMB configuration, which means the virtual machines are running on Hyper-V host and are stored on a SMB file share, and you try to manage the virtual machine remotely from Hyper-V Manager or Failover Cluster Manager, you will run into access denied errors. The same error can also happen if you try live migrate the virtual machine. This error is caused because you are using the credentials from the machine which Hyper-V or Failover Cluster Manager is running on to access the file share via the Hyper-V host. This “double-hop” scenario is not by default not allowed because of security reasons. You can find more about Kerberos Authentication on TechNet.

To avoid this error you have to configure the SMB Constrained Delegation in Active Directory to allow this scenario for specific “double-hops”. In Windows Server 2012 Microsoft made setting up Kerberos constrained delegation much easier by introducing resource-based Kerberos Constrained Delegation. This it wasn’t that easy to deploy and required some step. In Windows Server 2012 R2 Microsoft introduced new Windows PowerShell cmdlets to configure SMB Constrained Delegation directly from PowerShell. These cmdlets are offered by the Active Directory PowerShell module.

On your management box or where ever you want to configure SMB Constrained Delegation you have to install the Active Directory PowerShell module. (You don’t need the module on the Hyper-V host or SMB file servers)

 
Install-WindowsFeature RSAT-AD-PowerShell

Now you can use the following cmdlets.

  • Get-SmbDelegation –SmbServer FileServer
  • Enable-SmbDelegation –SmbServer FileServer –SmbClient HyperVHost
  • Disable-SmbDelegation –SmbServer FileServer [–SmbClient HyperVHost] [-Force]

For example if you are running a two node Hyper-V cluster and you use a Scale-Out File Server cluster (SOFS01) as virtual machine storage, the configuration could look like this.

 
Enable-SmbDelegation –SmbServer SOFS01 –SmbClient HyperV01
 
Enable-SmbDelegation –SmbServer SOFS01 –SmbClient HyperV02

Because these cmdlets only work with the new resource-based delegation, the Active Directory forest must be in “Windows Server 2012” functional level. A functional level of Windows Server 2012 R2 is not required.

And as I mentioned before you can also use System Center Virtual Machine Manager (VMM) to manage your storage, which uses a different approach and does not need the configuration of Kerberos Constrained Delegation.

 



Windows Server 2012 R2 Private CLoud Storage and Virtualization

Windows Server 2012 R2 Private Cloud Virtualization and Storage Poster and Mini-Posters

Yesterday Microsoft released the Windows Server 2012 R2 Private Cloud Virtualization and Storage Poster and Mini-Posters. This includes overviews over Hyper-V, Failover Clustering, Scale-Out File Server, Storage Spaces and much more. These posters provide a visual reference for understanding key private cloud storage and virtualization technologies in Windows Server 2012 R2. They focus on understanding storage architecture, virtual hard disks, cluster shared volumes, scale-out file servers, storage spaces, data deduplication, Hyper-V, Failover Clustering, and virtual hard disk sharing.

Bedsides the overview poster, Microsoft Includes the following Mini-Posters:

  • Virtual Hard Disk and Cluster Shared Volumes Mini Poster
  • Virtual Hard Disk Sharing Mini Poster
  • Understanding Storage Architecture Mini Poster
  • Storage Spaces and Deduplication Mini Poster
  • Scale-Out and SMB Mini Poster
  • Hyper-V and Failover Clustering Mini Poster

You can get the posters from the Microsoft download page.



vmem-page-banner-memory-platform

Violin Memory Scale-out Memory Platform with SMB 3.0 Integration

If you are looking at Storage vendors for Hyper-V you really need to have a look at a storage solutions with SMB 3.0 integration. Because the Hyper-V over SMB scenario will be the future. So until some weeks ago you had 3 options, you could choose EMC VNX, NetApp or a Windows Server Scale-Out File server with or without storage spaces. I haven’t had the chance to test the EMC solution but on paper it looks nice, NetApp solutions lacks a lot of integration such as active-active configurations as well as lacking support for SMB Multichannel or SMB Direct (RDMA). A lot of customers also are looking at the Storage Spaces solutions with Scale-Out file Server which basically supports all the features you need but not offers the benefits an appliance solution brings with support.

Some weeks ago Violin Memory announced a solutions called the Scale-out Memory Platform which is built on their 6000-series. Until today Violin Memory Flash Memory Arrays provide power for performance, high availability, and scalability in enterprise block storage environments. Now these powerful arrays provide a new class of file based solutions with Microsoft Server 2012 R2 directly installed on the array. Microsoft and Violin Memory worked closely to develop this class of solution by bringing the power of memory to Microsoft applications such as SQL Server and Microsoft Hyper-V.

This would offer an appliance solution of the Hyper-V over SMB 3.0 scenario. At the moment there are not a lot of information out there but I will expect more information shortly and if you need more information checkout the Violin Memory page.



Add Windows-based File Server

Manage SOFS Cluster and File Shares from Virtual Machine Manager

In the past months I did several blog posts about Hyper-V over SMB and Storage Spaces. In small environment management of such a Scale-Out File Server Cluster can be a simple thing because you don’t have a lot of changes, you setup the thing once and this will work for some time. In larger enterprise fabric and storage management is a huge topic, now with Hyper-V over SMB you don’t have to do any zoning or configure iSCSI initiators but you still have to set the right permission on the file share. This is where System Center Virtual Machine Manager comes into play.

Virtual Machine Manager also you to not only manage your iSCSI or fiber channel storage appliances via SMI-S, you can also manage your Scale-Out File Server.

First you have to add the Scale-Out File Server to the SCVMM fabric management. You can simple add a resource and Add a Storage Device. This will open a wizard where you can not only select SAN or NAS storage, but you can also select Widows-based file server.

Add Windows-based File Server

Enter the FQDN of your Fileserver Cluster

Enter Fileserver FQDN

This will scan your File Server Cluster and will show you already existing file shares. You can now match Storage Classifications with the existing file shares.

File Server Fileshares and Classification

After you have connected your Scale-Out File Server you can now create new File Shares and Storage Spaces directly from the Virtual Machine Manager Console.

Create File Shares

After you have created the file share you now have to add the permission for the Hyper-V host to the File Share. Virtual Machine Manager does automatically take care of that if you add the File Share to the Hyper-V Host or if you have a Hyper-V Cluster to the Cluster Object.

Add File Share to Hyper-V host

Now you can start using the file shares for placing Virtual Machines on it. The File Shares classifications will also be available in the VM Clouds.

Cloud Storage Resouces

As you can see, System Center Virtual Machine Manager can make your life a lot easier and helps you manage your whole datacenter fabric, from Compute, network up to storage. In 2013 I did several presentations on Fabric Management with System Center Virtual Machine Manager and two of them are online. You should check out the following posts:

Fabric Management with System Center Virtual Machine Manager (German)

Fabric Management with System Center Virtual Machine Manager at the TechDays Basel (German)



EMC – SMB 3.0 is the Future of Storage

At the moment I am working in a lot of customer cloud deployment projects and the huge topic at the moment are networking and storage. In the networking part there is a lot of talk going on, on “small” things like NIC Teaming and also on bigger topics like Network Virtualization. On the storage part I think a lot of customers are ready to take new approach to save money and get a better solutions. The main parts I talk a lot about is Storage Spaces and Hyper-V over SMB. I already wrote a lot about Hyper-V over SMB, which is not only in my opinion the future of storage. EMC released a solution overview for their EMC VNX and VNXe solution which offer SMB 3.0. EMC calls SMB 3.0 “The Future of Storage”.

SMB 3.0 is the Future of Storage

SMB 3.0 in Windows 8 clients and Windows 2012 servers is the future of storage protocols. It gives excellent performance with low CPU overhead – plus fault tolerance. Its load balancing/scaling will adjust throughput to available NICs and it also supports simultaneous access by multiple cluster hosts, with build-in arbitration for data consistency. There’s also file-share VSS (RVSS) backup support that facilitates the capture of application-consistent backups on SMB shares. This resiliency, combined with increasing Ethernet speeds, open up the potential for demanding, mission critical workloads such as Hyper-V and Microsoft SQL Server, to be placed on NAS.

You can read more here: EMC VNX and VNXe with Microsoft SMB 3.0

As I already mentioned I deployed SMB 3.0 and Hyper-V over SMB a couple of times and for me this is absolutely the way to go: No Fiber channel, no more iSCSI. And it’s funny that EMC the owner of VMware is calling SMB 3.0 the Future of Storage. I have to admit the EMC VNX and VNXe solutions on paper look pretty great and it looks like EMC did a great job implementing SMB 3.0. Unfortunately I could not test and VNX or VNXe yet.

EMC SMB 3 the future of Storage

Btw make sure you read my other blog post on SMB 3.0: