PowerShell Scirpt for Vsphere

 

To import the PowerShell modules for VMware from PSGallery

Vsphere esxcli command for deep dive network troubleshooting

Top  ESXI network command for troubleshooting->

esxcli network nic list -> (To collect all connected network details with Name, Driver, Link status, MAC, MTU)

esxcli network nic down -n vmnic0 -> To bring down connected or faulty NIC

esxcli network nic up -n vmnic0 -> To bring up connected or faulty N

esxcli network vswitch standard list -> Command to check standard switch list


esxcli network vswitch standard portgroup list -> To check portgroup created inside the standard switch


esxcli network vswitch dvs vmware list -> Command to list out DVS switch with port group list



esxcli network vm list -> (Command to get VM running on which network, world id)

esxcli network vm port list -w 73276 (VM World ID) -> command to get network port ID, vSwitch, portgorup, MAC, Uplink port ID and IP address


esxcli network port stats get -p 33554440 (Network port ID)-> Command to check pocket sent/received/dropped on network port ID.


esxcli network ip interface list -> Command to get created interface list like (VMk0,vmk1,vmk2) and their port ID

[root@ESXI102:~] esxcli network ip interface list

vmk0

   Name: vmk0

   MAC Address: 00:0c:29:19:f3:7c

   Enabled: true

   Portset: DvsPortset-0

   Portgroup: N/A

   Netstack Instance: defaultTcpipStack

   VDS Name: vDSwitch

   VDS UUID: 50 2c 4b af 80 5c 2d 29-82 c7 a0 74 b6 f3 5f b5

   VDS Port: 22

   VDS Connection: 290654427

   Opaque Network ID: N/A

   Opaque Network Type: N/A

   External ID: N/A

   MTU: 1500

   TSO MSS: 65535

   Port ID: 50331654

 

vmk1

   Name: vmk1

   MAC Address: 00:50:56:60:4d:58

   Enabled: true

   Portset: DvsPortset-0

   Portgroup: N/A

   Netstack Instance: defaultTcpipStack

   VDS Name: vDSwitch

   VDS UUID: 50 2c 4b af 80 5c 2d 29-82 c7 a0 74 b6 f3 5f b5

   VDS Port: 7

   VDS Connection: 290820540

   Opaque Network ID: N/A

   Opaque Network Type: N/A

   External ID: N/A

   MTU: 1500

   TSO MSS: 65535

   Port ID: 50331655

 

vmk2

   Name: vmk2

   MAC Address: 00:50:56:6c:88:09

   Enabled: true

   Portset: vSwitch0

   Portgroup: VSS_MGMT

   Netstack Instance: defaultTcpipStack

   VDS Name: N/A

   VDS UUID: N/A

   VDS Port: N/A

   VDS Connection: -1

 

 

 

esxcli network port stats get -p 50331655 (Network interface port ID) Command to get packets received/send/dropped on interface (vmk0/1/2) level

esxcli network diag ping -H 192.168.1.101  (-H is host name or IP) -> Command to diagnose connectivity between two ESXI host.

Trace:

         Received Bytes: 64

         Host: 192.168.1.101

         ICMP Seq: 0

         TTL: 64

         Round-trip Time: 1898 us

         Dup: false

         Detail:

 

         Received Bytes: 64

         Host: 192.168.1.101

         ICMP Seq: 1

         TTL: 64

         Round-trip Time: 1709 us

         Dup: false

         Detail:

 

         Received Bytes: 64

         Host: 192.168.1.101

         ICMP Seq: 2

         TTL: 64

         Round-trip Time: 1581 us

         Dup: false

         Detail:

   Summary:

         Host Addr: 192.168.1.101

         Transmitted: 3

         Recieved: 3

         Duplicated: 0

         Packet Lost: 0

         Round-trip Min: 1580 us

         Round-trip Avg: 1729 us

         Round-trip Max: 1897 us


vim-cmd hostsvc/net/query_networkhint --pnic-name=vmnic0 -> To list out CDP port details from cli



Linux and Ubuntu command

Linux and Ubuntu command

Basic command-:

Uname -: for product name

Uname –I -: for version

Uname –r -: recursive details

 

How to configure IP in Ubuntu



How to change existing configured IP

Bring NIC interface UP and down

nmcli con up id 'Wireless connection 1'


How to install SSH on Ubuntu-;

sudo apt update

sudo apt install openssh-server




SSH service is running type the following command

sudosystemctl status ssh

If after installation still failing to start ssh service please run this command

sudo apt-get purge openssh-server
sudo apt-get install openssh-server
 

 

 

The default setting in Debian (and hence Ubuntu) for OpenSSH Server is to deny password-based login for root and allow only key-based login. Change this line in /etc/ssh/sshd_config:

PermitRootLogin without-password

to

PermitRootLogin yes

And restart the SSH server:

sudo service ssh restart
 

How to change hostname in Ubuntu-:

Open Terminal and use below command

hostnamectl    to check current hostname

to rename hostname use below command

sudo hostnamectl set-hostname linuxize


 

Change Name and press CTRL +O and enter to save

Ctrl+X to exit.

Now change entry in host file as well for that run below command

How to install python in Ubuntu

If you are installing in on fresh installed Ubuntu and you don’t have installed essential package, you will get below error for that first run below command.

Download Python


Extract this file into home directory

Open terminal go to that path i.e


Run below command

Once configuration done run below command to install python

After installation run below command to check default phython version running

Above python has been installed on 7th Oct that is old version

Run below command to check latest version. Go into installation directory and check which version has installed

Now run below command to set default

How to install JAVA JDK

First check which version is latest one and run below command> change only software Name

How to install Apache in Ubuntu

Installation will start once installation will done.

Open browser and type local host or computer IP or 127.0.0.1 and press enter if the page is opening it means it’s working

You can run this command to start and stop apache service


How to check partition size in Ubuntu

Df–h

Here /dev/sda1 define total size and used size

How to create new partition

Now press t for Type-:



 

How to Save Changes in Vim

Vim Save and Quit Command

To save a file and exit Vim:

1. Switch to command mode by pressing the ESC key.

2. Press (colon) to open the prompt bar in the bottom left corner of the window.

3. Type after the colon and hit Enter. This will save the changes and exit.

Vim Save And Quit The Editor Command

Alternatively, a command that will also save a file and exit the text editor is:

:wq

In which case the stands for write (=save) and stands for quit.

 

Exit Without Saving Changes in Vi / Vim

To exit Vim without saving changes:

1. Switch to command mode by pressing the ESC key.

2. Press (colon) to open the prompt bar in the bottom left corner of the window.

3. Type q! after the colon and hit Enter to exit without saving the changes.

 

How to Save a File in Vi / Vim Without Exiting

To save a file without exiting in Vim:

1. Switch to command mode by pressing the ESC key.

2. Type (colon). This will open the prompt bar in the bottom left corner of the window.

example of saving a file without exiting in Vim

3. Type after the colon and hit Enter. This will save in Vim the changes made to the file, without exiting.

You can also rename an existing file by adding the new name after the commands.

:w [newfilename]

In the picture below, we renamed the existing example1.txt into newexample.

example of renaming a file using vi/vim text editor

 

 

 

 

 

·       Cursor movementh, j, k, l (left, down, up, and right)

·       Delete characterx

·       Delete linedd

·       Mode toggleEscInsert (or i)

·       Quit:q

·       Quit without saving:q!

·       Run a shell command:sh (use 'exit' to return)

·       Save file:w

·       Text search

 

 

  



Linux and Ubuntu command

Linux and Ubuntu command

Basic command-:

Uname -: for product name

Uname –I -: for version

Uname –r -: recursive details

 

How to configure IP in Ubuntu



How to change existing configured IP

Bring NIC interface UP and down

nmcli con up id 'Wireless connection 1'


How to install SSH on Ubuntu-;

sudo apt update

sudo apt install openssh-server




SSH service is running type the following command

sudosystemctl status ssh

If after installation still failing to start ssh service please run this command

sudo apt-get purge openssh-server
sudo apt-get install openssh-server
 

 

 

The default setting in Debian (and hence Ubuntu) for OpenSSH Server is to deny password-based login for root and allow only key-based login. Change this line in /etc/ssh/sshd_config:

PermitRootLogin without-password

to

PermitRootLogin yes

And restart the SSH server:

sudo service ssh restart
 

How to change hostname in Ubuntu-:

Open Terminal and use below command

hostnamectl    to check current hostname

to rename hostname use below command

sudo hostnamectl set-hostname linuxize


 

Change Name and press CTRL +O and enter to save

Ctrl+X to exit.

Now change entry in host file as well for that run below command

How to install python in Ubuntu

If you are installing in on fresh installed Ubuntu and you don’t have installed essential package, you will get below error for that first run below command.

Download Python


Extract this file into home directory

Open terminal go to that path i.e


Run below command

Once configuration done run below command to install python

After installation run below command to check default phython version running

Above python has been installed on 7th Oct that is old version

Run below command to check latest version. Go into installation directory and check which version has installed

Now run below command to set default

How to install JAVA JDK

First check which version is latest one and run below command> change only software Name

How to install Apache in Ubuntu

Installation will start once installation will done.

Open browser and type local host or computer IP or 127.0.0.1 and press enter if the page is opening it means it’s working

You can run this command to start and stop apache service


How to check partition size in Ubuntu

Df–h

Here /dev/sda1 define total size and used size

How to create new partition

Now press t for Type-:



 

How to Save Changes in Vim

Vim Save and Quit Command

To save a file and exit Vim:

1. Switch to command mode by pressing the ESC key.

2. Press (colon) to open the prompt bar in the bottom left corner of the window.

3. Type after the colon and hit Enter. This will save the changes and exit.

Vim Save And Quit The Editor Command

Alternatively, a command that will also save a file and exit the text editor is:

:wq

In which case the stands for write (=save) and stands for quit.

 

Exit Without Saving Changes in Vi / Vim

To exit Vim without saving changes:

1. Switch to command mode by pressing the ESC key.

2. Press (colon) to open the prompt bar in the bottom left corner of the window.

3. Type q! after the colon and hit Enter to exit without saving the changes.

 

How to Save a File in Vi / Vim Without Exiting

To save a file without exiting in Vim:

1. Switch to command mode by pressing the ESC key.

2. Type (colon). This will open the prompt bar in the bottom left corner of the window.

example of saving a file without exiting in Vim

3. Type after the colon and hit Enter. This will save in Vim the changes made to the file, without exiting.

You can also rename an existing file by adding the new name after the commands.

:w [newfilename]

In the picture below, we renamed the existing example1.txt into newexample.

example of renaming a file using vi/vim text editor

 

 

 

 

 

·       Cursor movementh, j, k, l (left, down, up, and right)

·       Delete characterx

·       Delete linedd

·       Mode toggleEscInsert (or i)

·       Quit:q

·       Quit without saving:q!

·       Run a shell command:sh (use 'exit' to return)

·       Save file:w

·       Text search

 

 

  



Featured Post

HPE MSA 2040 configuration step by step

HPE MSA 2040 configuration Default IP range for HP SAN storage MSA 2040 is 10.0.0.1/2 You need to connect your laptop and storage with...