Tuesday, June 24, 2008

Troubleshooting Service Console Networking


If certain parts of the service console’s networking are misconfigured, you cannot access your ESX Server 3 host with the VI Client. If this happens, you can reconfigure networking by connecting directly to the service console and using the following service console commands:
Check that vswif0 is present and that the current IP address and Netmask are correct.
If you encounter long waits when using esxcfg-* commands, the DNS might be misconfigured. The esxcfg-* commands require that DNS be configured so that localhost name resolution works properly. This requires that the /etc/hosts file contain an entry for the configured IP address and the 127.0.0.1 localhost address.

Friday, June 6, 2008

ESX -Linux commands-

very useful when you try to do something via CLI...
"type command --help" or "man command-name" to get more info... enjoy..
man
Prints the manual page for a command or a configuration file entered as a parameter to this command.
reboot
Does a nice reboot on the system. Does "Force Power Off" for the VMs.
halt
Does a nice halt on the system. Does "Force Power Off" for the VMs.
shutdown
Generic command for shutting down or rebooting the system.
fdisk
Command line disk partitioning program in Linux. It is powerful and has a very simple user interface.
fdisk /dev/sdb
On command line, starts fdisk against second available SCSI disk. "sda" is the first SCSI disk, "sdc" is the third SCSI disk etc. VMware ESX Server is installed on /dev/sda, and the external storage is /dev/sdb, and maybe some others too.
p
Fdisk subcommand, prints the current partition table on current disk.
d
Fdisk subcommand, deletes current partitions. Enter the partition number to delete. It is recommended to printout the current partition table before deleting anything.
n
Fdisk subcommand, creates a new partition. Select partition type (primary, extended, or logical). Almost always you should use the default starting cylinder. For size, enter "+NNNNNm", where NNNNN is the size in megabytes.
t
Fdisk subcommand, change partition type (id). By default fdisk creates ext2 type partitions. We might also want to use id "fb", the vmfs type, or some other type.
w
Fdisk subcommand, writes the current partition table to disk. If you don't get any errors, you don't have to reboot. If you get errors at this point, the new partition table is used only after next system boot.
mke2fs
This command formats a partition for ext2 filesystem. Example command would be "mke2fs /dev/sdb1".
mount|umount
These commands manually mount/umount CDs, floppies, local partitions, and remote directories to a selected local directory. The local (empty) directory must exist before the mount can succeed. Example mound command would be "mount /dev/sdb5 /data". Permanent mounting is done by editing the /etc/fstab file.
mkdir
Makes a directory.
rm
Removes files and/or directories.
mv
Moves files and/or directories.
kudzu
This is the RedHat's tool to detect and configure hardware: adding new and removing old. When you run kudzu, or system runs it at bootup, be careful. Kudzu might offer to remove hardware you have dedicated solely to the VMs. Know your hardware and configuration. It might be a good idea to refer to /etc/modules.conf file before running kudzu. A safe action in kudzu is "Do nothing". Select it when in doubt.
service
RedHat-made tool for daemon (service) starting/stopping/restarting/status querying. Syntax is "service servname [start|stop|restart|status]". Alternate to this command, which works with all Linuces is to call the script directly, like "/etc/init.d/sshd restart".
groupadd
Adds a new group to the Console OS. It is recommended to use one non-root group for VM admins and add operator/admin users there. To create that group, enter one the following commands:
groupadd -g 7777 vmadmins
groupadd -g 7777 vmadms01
useradd
Adds a new user to the Console OS with status disabled. To create new admins, enter one of the following commands:
useradd -g 7777 johndoe
useradd -g 7777 -c "Kari Mattsson" mattkar2
passwd
Changes the password for the userid entered as a parameter for the command. Only root can change the password for other users. They can only change their own password with command "passwd". Userids are disabled by default. They are activated by setting a password for them. An example command for root to set a password is the following command:
passwd "username"

chown
Changes the owner user and optionally owner group of a directory, or a file. Optionally this command works recursively with parameter "-R". The assignment parameter is of type "user.group", or just "user". Some examples are given below:
chown -R root.operator /vmfs/* /data/*
chown root.esxadmin /vmfs/local/*
chown -R root /data/vmware
chown root.operator /etc/modules.conf
chgrp
Changes the owner group of a directory, or a file. Optionally this command works recursively with parameter "-R". Examples for "chown" apply here, but without the "root." part, as only the group is changed here.
chattr
Change special attribute of a directory, or a file. Immutable attribute is set with parameter "-i".
chmod
This command is the main command for changing file modes. Like chown, it can do things recursively with parameter "-R". Below are some example commands:
chmod -R 0775 /vmfs/* /data/*
chmod u=rwx,g=rwx,o=r /vmfs/freebsd462/*
chmod g+rwx /vmfs/vm007/*
chmod -R u+rwx,g=r,o-rwx /var/log/*
chmod u=rw,g=rw,o=r /etc/modules.conf
chmod 664 /etc/modules.conf
dd
With this command you can create ISO images and floppy images. Example command to create an ISO CD/DVD images is "dd if=/dev/cdrom of=/vmfs/local/suse82pro-dvd.iso bs=20480". For diskettes, use "if=/dev/fd0", and "bs=512".
cat
ConCATenate file from start to standard output (terminal screen by default). Usually takes filename as a parameter.
ls
LiSt files in a directory. -R makes it recursive, and -l shows more information on each item.
stat
Show statistics of a file. This is the most comprehensive directory entry examiner.
tac
Like "cat", but starts from the end of the file (or standard input).
head
Show selected amount of lines from the start of a file.
tail
Like "head", but start from the end of the file. Practical command to follow what is happening with a log file is command like "tail -f /var/log/messages".
grep
Search for a string from standard input or from a file. This is a powerful command.
find
Find files by name or many of the other attributes. Another very powerful command. Below are some example commands:
find / -type f -name *.bak
find . -type d -name sbin
find / -type f -name *
tar
Tape ARchive, a command which combines many files into one for backup purposes. Below are some example commands:
tar -cvzf /vmfs/local/esx.tar.gz --except /proc --except /vmfs /
tar -cf /vmfs/local/vm-configs.tar /data
tar -xvzf /vmfs/local/vm007-config.tar.gz
gzip|gunzip
These command compress and decompress files. The recommended and default extension is .gz.
more|less
These commands usually act in a pipe. They are used for file pagination to terminal
ntpdate
This command takes an NTP server as a parameter and synchronises the clock once. This command doesn't work when local NTP daemon is running.

Thursday, June 5, 2008

How to:

Enable remote connections to ESX :

On your esx Virtual Infrastructure client go to FIREWALL configuration tab under security profile.

Configuration -> security Profile-> Firewall click properties and check SSH Client check box

restart SSHD daemon:

service sshd restart

Wednesday, June 4, 2008

enable root ESX

How to Enable root (SSHD) change to “yes” PermitRootLogin setting in the /etc/ssh/sshd_config file using nano… or using VI ( good luck with that option..).


log into ESX console as root

cd /

cd /etc/ssh

nano sshd_config file

change PermitRootLogin to yes.

ctrl-x and save the changes

then restart SSHD deamon using following command:

service sshd restart