how to NIC teaming in ESXi and ESX

NIC teaming in ESXi and ESX

Source: VMware KB: NIC teaming in ESXi and ESX

Purpose

This article provides information on configuring NIC teaming.

A NIC team can share the load of traffic between physical and virtual networks among some or all of its members, as well as provide passive failover in the event of a hardware failure or network outage.

Resolution

https://www.youtube.com/watch?v=Hx9FAo7_H2k

To utilize NIC teaming, two or more network adapters must be uplinked to a virtual switch. The main advantages of NIC teaming are:

  • Increased network capacity for the virtual switch hosting the team.
  • Passive failover in the event one of the adapters in the team goes down.

Observe these guidelines to choose the correct NIC Teaming policy:

  • Route based on the originating port ID: Choose an uplink based on the virtual port where the traffic entered the virtual switch.
  • Route based on an IP hash: Choose an uplink based on a hash of the source and destination IP addresses of each packet. For non-IP packets, whatever is at those offsets is used to compute the hash.
  • Route based on a source MAC hash: Choose an uplink based on a hash of the source Ethernet.
  • Use explicit failover order: Always use the highest order uplink from the list of Active adapters which passes failover detection criteria.
  • Route based on physical NIC load (Only available on Distributed Switch): Choose an uplink based on the current loads of physical NICs.

Before you begin :

To configure NIC teaming for standard vSwitch using the vSphere / VMware Infrastructure Client:

  1. Highlight the host and click the Configuration tab.
  2. Click the Networking link.
  3. Click Properties.
  4. Under the Network Adapters tab, click Add.
  5. Select the appropriate (unclaimed) network adapter(s) and click Next.
  6. Ensure that the selected adapter(s) are under Active Adapters.
  7. Click Next > Finish.
  8. Under the Ports tab,highlight the name of the port group and click Edit.
  9. Click the NIC Teaming tab.
  10. Select the correct Teaming policy under the Load Balancing field.
  11. Click OK.

To configure NIC teaming for standard vSwitch using the vSphere Web Client:

  1. Under vCenter Home, click Hosts and Clusters.
  2. Click on the host.
  3. Click Manage > Networking > Virtual Switches.
  4. Click on the vSwitch.
  5. Click Manage the physical network adapters.
  6. Select the appropriate (unclaimed) network adapter(s) and use the arrow to move the adapter(s) to Active Adapters.
  7. Click Edit settings.
  8. Select the correct Teaming policy under the Load Balancing field.
  9. Click OK.

Manage Office 365 Forward Mail in PowerShell

Manage Forward Mail by using PowerShell | Office 365

<#

this script set Automatic mail Forwarding to Recipient in office 365

#>

#start script

##########################

#$user=’internal user idestity’ #the source internal user to forward emails from
#$destemail=’internal user email destination address’ #internal destination user to forward emails to
#$destemailext=’xxx@gmail.com’ #external destination email address to forward emails to
#$DisplayName’MailContact Display Name’ #MailContact Display Name
#$mailintext=’Office 365 User Email ‘ #<Office 365 User Email Address for external user (MailContact)

##########################

#Connect to Exchange Online Office 365 using remote PowerShell
#$UserCredential = Get-Credential
#$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
#Import-PSSession $Session

##########################

#Forward Email to internal Recipient & DONT saves local copy
#Set-Mailbox $user -ForwardingAddress $destemail -DeliverToMailboxAndForward $False

##########################

#Forward Email to internal Recipient & save local copy (Default)
#Set-Mailbox $user -ForwardingAddress $destemail

##########################

#Forward Email to External Recipient & save local copy (Default)
#Set-Mailbox $user -ForwardingsmtpAddress $destemailext

##########################

#Forward Email to External Recipient & DONT saves local copy
#Set-Mailbox $user -ForwardingsmtpAddress $destemailext -DeliverToMailboxAndForward $False

##########################

#Create External contact with internal email address + Forward email address (External Email Address)
#Step 1: Create External contact with External email address
#New-MailContact -Name $DisplayName -ExternalEmailAddress $destemailext
#Step 2: Set External contact email address to internal email address and forwarding email address (External email address) PowerShell command syntax:
#New-MailContact $DisplayName -emailaddresses SMTP:$mailintext, $destemailext

##########################

#Display information about Forwarding rule
#Get-Mailbox $user

##########################

#Display more information about Forwarding rule
#Get-Mailbox John | FL DeliverToMailboxAndForward,ForwardingAddress,ForwardingSmtpAddress

##########################

#Find all users with Forwarding Address is set to Internal Recipient
#Get-Mailbox | Where {$_.ForwardingAddress -ne $Null} | Select Name, ForwardingAddress, DeliverToMailboxAndForward

##########################

#Turn off Email Automatic Forwarding to internal Recipient
#Set-Mailbox $user -ForwardingAddress $Null

##########################

#Turn off email Automatic Forwarding to External Recipient
#Set-Mailbox $user -ForwardingSmtpAddress $Null

##########################

#Forward Email of ALL Users to internal Recipient & save local copy
#Step 1: Save local copy
#Get-Mailbox | Where {$_.RecipientType -eq “UserMailbox”}| Set-Mailbox -DeliverToMailboxAndForward $True
#Step 2: Forward email to the destination recipient (internal\organization recipient)
#Get-Mailbox | Where {$_.RecipientType -eq “UserMailbox”}| Set-Mailbox -ForwardingAddress $destemail

##########################

#Forward Email of ALL Users to External Recipient & save local copy
#Step 1: Save local copy
#Get-Mailbox | Where {$_.RecipientType -eq “UserMailbox”}| Set-Mailbox -DeliverToMailboxAndForward $True
#Step 2: Forward email to the destination recipient (external recipient)
#Get-Mailbox | Where {$_.RecipientType -eq “UserMailbox”}| Set-Mailbox -ForwardingSmtpAddress $destemailext

##########################

#Turn off email Automatic Forwarding to External Recipient
#Get-Mailbox | Where {$_.RecipientType -eq “UserMailbox”}| Set-Mailbox -ForwardingAddress $Null

##########################

#verify that the email is set to forword
#Get-Mailbox $user| FL DeliverToMailboxAndForward,ForwardingAddress,ForwardingSmtpAddress

##########################

#end Exchange Online Office 365 remote PowerShell Session
#Remove-PSSession $Session

#end script

Search WMI for Useful Information in  PowerShell

Search WMI for Useful Information

Source: Search WMI for Useful Information – Power Tips – PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources

<#

WMI is a great source of information, but it is not always easy to find out the names of valid WMI classes to query.

Here is a little search tool: it asks for a keyword, then searches WMI for all valid classes with this keyword. The results are shown in a grid view window, and when you choose a class and press OK, the tool queries the class for you, showing the results:

#requires -Version 3

#>

function Search-WMI
{
param([Parameter(Mandatory=$true)]$Keyword)

Get-WmiObject -Class “Win32_*$Keyword*” -List |
Where-Object { $_.Properties.Count -gt 6 } |
Where-Object { $_.Name -notlike ‘Win32_Perf*’ } |
Sort-Object -Property Name |
Select-Object -Property @{Name=’Select one of these classes’; Expression={$_.Name }} |
Out-GridView -Title ‘Choose one’ -OutputMode Single |
ForEach-Object {
Get-WmiObject -Class $_.’Select one of these classes’ | Out-GridView
}
}

<#

Example:

Search-WMI -Keyword network

#>

how to Assign Multiple IP Addresses to One Single Network Interface in Linux

The concept of creating or configuring multiple IP addresses on a single network interface is called IP aliasing. IP aliasing is very useful for setting up

Source: Create Multiple IP Addresses to One Single Network Interface

Assign Multiple IP Addresses to One Single Network Interface

  1. The device network (NIC) files located in “/etc/sysconfig/network-scripts/” directory.
  2. Navigate to the directory and do “ls -l” to list all devices.

                cd /etc/sysconfig/network-scripts/

ls –l

[root@******** network-scripts]# ls -l

total 236

-rw-r–r–. 1 root root   394 Nov  5 13:13 ifcfg-ens192

  1. Copy existing parameters of interface “ifcfg- ens192” in virtual interfaces called ifcfg- ens192:0, ifcfg- ens192:1 and ifcfg- ens192:2.

cp ifcfg- ifcfg-ens192 ifcfg- ifcfg-ens192:0

                                cp ifcfg- ens192 ifcfg- ens192:1

                                cp ifcfg- ens192 ifcfg- ens192:2

  1. edit each file and rename the DEVICE name to its corresponding alias and change the IPADDR address.

For example:

DEVICE=” ens192 ” replace with ens192:0

BOOTPROTO=static

ONBOOT=yes

TYPE=”Ethernet”

IPADDR=172.16.16.125 replace with the new virtual IP.

NETMASK=255.255.255.224

GATEWAY=172.16.16.100

HWADDR=00:0C:29:28:FD:4C

  1. Once, you’ve made all changes, save all your changes and restart/start the network service for the changes to reflect.

[root@*************]# /etc/init.d/network restart

How to Assign Multiple IP Address Range

  1. if you would like to create a range of Multiple IP Addresses to a particular interface called “ifcfg-eth0“.

cd /etc/sysconfig/network-scripts/

cp -p ifcfg-eth0 ifcfg-eth0-range0

  1. Now open “ifcfg-eth0-range0” file and add “IPADDR_START” and “IPADDR_END” IP address range as shown below.

[root@***********]# vi ifcfg-eth0-range0

 

#DEVICE=”eth0″

#BOOTPROTO=none

#NM_CONTROLLED=”yes”

#ONBOOT=yes

TYPE=”Ethernet”

IPADDR_START=172.16.16.126

IPADDR_END=172.16.16.130

IPV6INIT=no

#GATEWAY=172.16.16.100

  1. Save it and restart/start network service

[root@**************]# /etc/init.d/network restart

how to Output File Sizes in Different Formats in PowerShell

Access free scripts, daily tips, and videos to help you master Windows Powershell. Get expert advice from DR. Tobias Weltner, Poweshell MVP. Free Membership!

Source: Outputting File Sizes in Different Formats – Power Tips – PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources

<#

When you store a number in a variable, you may want to display the number in different units. Bytes are very precise, but sometimes displaying the bytes as kilobytes or megabytes would be more appropriate.

Here is a clever trick that overwrites the internal ToString() method with a more versatile one: it takes a unit, the number of digits you want, and the text of a suffix. This way, you can display the number in various formats, just as needed.

The content stays untouched, so the variable still holds an integer value that you can safely sort or compare to other values:

#requires -Version 1

#>

$a = 1257657656
$a = $a | Add-Member -MemberType ScriptMethod -Name tostring -Force -Value { param($Unit = 1MB, $Digits=1, $Suffix=’ MB’) “{0:n$Digits}$Suffix” -f ($this/($Unit)) } -PassThru

<#

And here are some examples on how you can use $a now:
PS> $a
1.199,4 MB

PS> $a.ToString(1GB, 0, ‘ GB’)
1 GB

PS> $a.ToString(1KB, 2, ‘ KB’)
1.228.181,30 KB

PS> $a -eq 1257657656
True

PS> $a -eq 1257657657
False

PS> $a.GetType().Name
Int32

#>

how to Convert Date/Time Formats in PowerShell 

Converting Date/Time Formats

Source: Converting Date/Time Formats – Power Tips – PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources

#Here is a simple PowerShell filter that can convert any DateTime object into any date/time-format you like:

#requires -Version 1

filter Convert-DateTimeFormat
{
param($OutputFormat=’yyyy-MM-dd HH:mm:ss fff’)

try {
([DateTime]$_).ToString($OutputFormat)
} catch {}
}

<#
And here are some examples on how to run it:
PS> Get-Date | Convert-DateTimeFormat
2015-10-23 14:38:37 140

PS> Get-Date | Convert-DateTimeFormat -OutputFormat ‘dddd’
Friday

PS> Get-Date | Convert-DateTimeFormat -OutputFormat ‘MM”/”dd”/”yyyy’
10/23/2015

PS> ‘2015-12-24’ | Convert-DateTimeFormat -OutputFormat ‘dddd’
Thursday

As you see, you can pipe into Convert-DateTimeFormat anything that either is a DateTime object already, or can be turned into one. By default, the function displays the ISO format for it, but with -OutputFormat you can specify your own format as well.

When you look at the source code, you can see the letters that resemble date and time components. Note that these are case-sensitive (“m” represents a minute, whereas “M” represents a month), and the more of them you specify, the more detailed will that information be displayed.

Anything you want to appear as literal text needs to be included in quotes.
#>

Location of ESXi 5.1 and 5.5 log files

VMware ESXi

Source: VMware KB: Location of ESXi 5.1 and 5.5 log files

ESXi 5.1 Host Log Files

Logs for an ESXi 5.1 host are grouped according to the source component:

  • /var/log/auth.log: ESXi Shell authentication success and failure.
  • /var/log/dhclient.log: DHCP client service, including discovery, address lease requests and renewals.
  • /var/log/esxupdate.log: ESXi patch and update installation logs.
  • /var/log/lacp.log: Link Aggregation Control Protocol logs.
  • /var/log/hostd.log: Host management service logs, including virtual machine and host Task and Events, communication with the vSphere Client and vCenter Server vpxa agent, and SDK connections.
  • /var/log/hostd-probe.log: Host management service responsiveness checker.
  • /var/log/rhttpproxy.log: HTTP connections proxied on behalf of other ESXi host webservices.
  • /var/log/shell.log: ESXi Shell usage logs, including enable/disable and every command entered. For more information, seevSphere 5.5 Command-Line Documentation and Auditing ESXi Shell logins and commands in ESXi 5.x (2004810).
  • /var/log/sysboot.log: Early VMkernel startup and module loading.
  • /var/log/boot.gz: A compressed file that contains boot log information and can be read using zcat /var/log/boot.gz|more.
  • /var/log/syslog.log: Management service initialization, watchdogs, scheduled tasks and DCUI use.
  • /var/log/usb.log: USB device arbitration events, such as discovery and pass-through to virtual machines.
  • /var/log/vobd.log: VMkernel Observation events, similar to vob.component.event.
  • /var/log/vmkernel.log: Core VMkernel logs, including device discovery, storage and networking device and driver events, and virtual machine startup.
  • /var/log/vmkwarning.log: A summary of Warning and Alert log messages excerpted from the VMkernel logs.
  • /var/log/vmksummary.log: A summary of ESXi host startup and shutdown, and an hourly heartbeat with uptime, number of virtual machines running, and service resource consumption. For more information, see Format of the ESXi 5.0 vmksummary log file (2004566).
  • /var/log/Xorg.log: Video acceleration.

How to Clean up the WinSxS Directory and Free Up Disk Space on Windows Server 2008 R2.

Source: Disk Cleanup Wizard addon lets users delete outdated Windows updates on Windows 7 SP1 or Windows Server 2008 R2 SP1

Download Update for Windows Server 2008 R2 x64 Edition (KB2852386).

After you install this update, follow these steps to clean up Windows update files.

Note You must have administrator permissions to do this.

  1. Start the Disk Cleanup wizard. To do this, use one of the following methods:
    • Method 1: Click Start, type cleanmgr in the Start Search box, and then click OK.
    • Method 2: Click Start, click All Programs, click Accessories, click System Tools, and then click Disk Cleanup.
    • Method 3: If a Low Disk Space notification appears, click the notification to open the Disk Cleanup wizard.
  2. Select the Windows 7 or Windows Server 2008 R2 system drive, and then click OK.NoteThis operation might take several seconds because the Disk Cleanup wizard searches for files on the drive that can be cleaned up.
  3. If the Windows Update Cleanup option is not displayed on the Disk Cleanuptab, click Clean up system files. If the Windows Update Cleanup option is displayed on the Disk Cleanup tab, go to step 5.Note The Windows Update Cleanup option is available only when you log on by using administrator permissions.
  4. Select the Windows 7 or Windows Server 2008 R2 system drive, and then click OK.
  5. On the Disk Cleanup tab, select Windows Update Cleanup, and then click OK.Note By default, the Windows Update Cleanup option is already selected.
  6. When a dialog box appears, click Delete Files.

Notes

  • The Disk Cleanup wizard runs in the background.
  • You may have to restart the computer to finish the cleanup process.