Friday, August 5, 2011

To manually sync CentOS time to NTP Servers

1. Stop NTP service in CentOS
  • service ntpd stop
2. Run manual NTP update command
  • ntpd update 192.168.10.100
3. Run sync command
  • sync
4. Restart NTP service in CentOS
  • service ntpd start

Change CentOS IP address


To change interface eth0 IP address.
  1. Edit /etc/sysconfig/network-scripts/ifcfg-eth0
  2. Run service network restart

Change VMWare Player 3.X IP Address


To change the IP address range or the DHCP addresses when using Windows as the host OS use the program called vmnetcfg.exe.
This program is included in the installer but isn’t installed. To get to it:
1. Run the installer with /e option. For example:
VMware-player-3.0.0-197124.exe /e vm
All contents will be extracted to “vm” folder.
2. Open “network.cab” and copy vmnetcfg.exe to your installation folder,
typically “C:\Program Files\VMware\VMware Player\”.
Now you can use vmnetcfg.

Wednesday, August 18, 2010

NetApp - Simulator and ESX Networking

This is a known problem with running the Data ONTAP simulator on ESX 3.5 and above.

Symptoms
After installing the Data ONTAP simulator within a guest VM and starting up the simulator, you cannot access (ssh/telnet/http) the Simulator's IP address.
Problems running the Data ONTAP Simulator on VMware ESX

Solution

Modify the 'Promiscuous Mode' setting to 'Accept' on the vswitch to which the guest VM (hosting the Data ONTAP simulator) is connected to. From within the VI Client, perform the following:

  1. Select 'Configuration' Tab.
  2. Select 'Networking'.
  3. Select 'Properties' for the vswitch.
  4. Under 'vswitch', select 'Edit'.
  5. Select 'Security' Tab.
  6. Change the dropdown for 'Promiscuous Mode' to 'Accept'.
  7. Click OK.

Monday, August 16, 2010

Putty - Improve Putty settings on Windows

Improving Putty settings on Windows

Configure your Putty first, then make entries.

This is important advice. First configure your environment before you start using it. This is especially true for Putty, since you always start off from the default, it is important to configure the default entry before you create entries from these defaults. It will save you a lot of time afterwards to get things straight.

So before you make any changes, open the default template in Category: Session by selectingDefault Settings and pressing the Load button.

Make SSH the default.
If you have an older version of Putty, chances are that you have Telnet as the default protocol. Changing it to SSH will probably save you some time when you start Putty out-of-the-blue. For this go to Category: Session and select SSH.

Keep windows around.
Putty cleverly exits when you leave a session, but I don't like that. I like to be able to still copy&paste from console even when one of my sessions times out or I closed one bash/session too many. Since I consider terminal output as possible interesting information I don't want to loose that by mistake (or inconsiderate intent). So you'd want to set in Category: Session the optionClose window on exit to Never.

Annoying PC bell.
Some systems have quite annoying (and loud) PC speaker bell sounds and since I am not fond of audible notifications (and I can imagine my colleagues even less when I frantically expand stuff in bash) I always enable visual bell in Category: Terminal > Bell and select Visual bell.

I also like to have taskbar notifications (when eg. putty is minimized or in the background) so I setTaskbar/caption indication on bell to Flashing.

Increase scrollback buffer.
By default Putty buffers 200 lines of output, which is too little in lots of circumstances. And the moment you actually need this number increased, chances are you already lost some information you wanted. So it is wise to increase this number. What I do is go to Category: Window and increase Lines of scrollback to 20000.

Scrollback behavior
One thing I hate about terminal consoles is that if you are scrolling back output while the system is still producing output, the terminal jumps back to the bottom. I can see why this is the default, people might be confused if they are not aware that they are looking at the terminal buffer.

So in Category: Window I disable the Reset scrollback on display activity but I do enableReset scrollback on keypress.

Choose a good font.
The newer Putty binaries are able to make use of ClearType which drastically improves the font quality compared to Antialiased. Go to Category: Window > Appearance, choose ClearTypeand a nice font. I prefer Lucida Console, 9-point.

When you are there, you might want to change the Gap between text and window edge to 3pixels.

Use proper character encoding.
Nowadays all Linux systems are able to use Unicode (UTF-8) so to make sure that the output in Putty (especially everything non-ascii) looks fine, go to Category: Window > Translation and change the character set to UTF-8, make sure that also the line drawing characters use Unicode as well.

Linux copy-and-pasting.
I prefer to do an implicit copy when selecting and using the middle mouse button for pasting. So I go to Category: Window > Selection and set the Action of mouse buttons to xterm (Right extends, Middle pastes)

When you are there, also enable the option Paste to clipboard in RTF as well as plain text, which is nice when you are copy-and-pasting to emails or text documents that allow fonts and colours. Your console output will look much the same as it does on your screen!

Change dark colours on a black background.
One of the more annoying things with terminal applications (xterm has the same issue) is that by default dark-blue is too dark to be visible on a black background. Not only is this frustrating, it makes the experience for new users so bad that they prefer to disable colours (or hate the ls colour output or syntax highlighting in vim).

So if you are like me, go to Category: Window > Colours and select ANSI Blue in the Select a colour to adjust to Red:74 Green:74 Blue:255. I do the same for ANSI Blue Bold toRed:140 Green:140 Blue:255.

Keeping idle sessions active.
Another frustrating problem is induced by the time-to-live of inactive or idle TCP sessions on firewall or switch configurations. At some companies this is put aggressively low so that TCP sessions that have no activity for 1 minute or even 30 seconds are being dropped. If you are using an SSH connection over such a network device, you have to take care to send keep-alive packets over your idle session. To do this go to Category: Connection and set Seconds between keepalives (0 to turn off) to 25.

Enable X11 forwarding.
Together with Xming, Putty allows you to run graphical Linux applications on your Windows system, so enabling X11 forwarding by default can be useful. To enable this, got to: Connection > SSH > X11 and enable Enable X11 forwarding.

Also dynamic forwarding is very useful to connect to systems on a remote network, even when you do not know in advance having it enabled can be useful. This option however reserves a local port on the system so enabling it by default is not really practical. However you can still enable it from a running Putty by selecting Change settings.

Finally, saving the default.
Now, don't forget to save the changes you just made to the default template. If you loaded the Default Settings at the start, return back to Category: Session and press the Save button. Now you are done !

Putty settings summary.
Category: Session
Connection type: SSH
Close window on exit: Never

Category: Terminal > Bell
Action to happen when a bell occurs: Visual bell (flash window)
Taskbar/caption indication: Flashing

Category: Window
Lines of scrollback: 20000
Reset scrollback on keypress: Checked
Reset scrollback on display activity: Unchecked

Category: Window > Appearance
Font: Lucida Console, 9-point
Font quality: ClearType
Gap between text and window edge: 3

Category: Window > Translation
Character set: UTF-8
Handling of line drawing characters: Unicode

Category: Window > Selection
Action of mouse buttons: xterm (Right extends, Middle pastes)
Paste to clipboard in RTF as well as plain text: enabled

Category: Window > Colours
ANSI Blue: Red:74 Green:74 Blue:255
ANSI Blue Bold: Red:140: Green:140 Blue:255

Category: Connection
Seconds between keepalives (0 to turn off): 25

Category: Connection > SSH > X11
Enable X11 forwarding: enabled

Friday, August 13, 2010

Linux - Tuning NFS for better performance

The Network File System (NFS) is still very popular on Linux systems, but it can use some help to increase performance by tweaking the relatively conservative defaults that most Linux distributions ship with. This can be done by tweaking both NFS servers and clients.

On the server side, you must ensure that there are enough NFS kernel threads to handle the number of connections by the clients. You can determine whether or not the default is sufficient by looking at RPC statistics using nfsstat on the NFS client:

# nfsstat -rc
Client rpc stats:
calls retrans authrefrsh
3409166 330 0

Here you can see that the retrans value is quite high, meaning that retransmissions were often necessary since the last reboot. This is a clear indication that the number of available NFS kernel threads on the server is insufficient to handle the requests from this client. The default number of threads for rpc.nfsd to start is typically eight threads.

To tell rpc.nfsd to use more kernel threads, the number of threads must be passed as an argument to it. Typically, most distributions will have a file such as/etc/sysconfig/nfs to configure this; on a Mandriva Linux system, the configuration item RPCNFSDCOUNT in /etc/sysconfig/nfs is used to determine the number of kernel threads to pass to rpc.nfsd. Increase this number — perhaps to 16 — on a moderately busy server, or increase up to 32 or 64 on a more heavily used system. Re-evaluate using nfsstat to determine whether or not the number of kernel threads is sufficient; if the retrans setting is 0 then it is enough; but, if the client still needs to retransmit, increase the number of threads further.

On the client side of things, remote NFS mounts should be mounted with the following options:

rsize=32768,wsize=32768,intr,noatime

By default, most clients will mount remote NFS file systems with an 8-KB read/write block size; the above will increase that to a 32-KB read/write block size. It will also ensure that NFS operations can be interrupted if there is a hang and will also ensure that the atime won’t be constantly updated on files accessed on remote NFS file systems.

If NFS file systems are mounted via /etc/fstab, make the changes there; otherwise, you will need to make them to any configuration files belonging to your chosen automounter. In the case of amd, the /etc/amd.net file would look like:

/defaults fs:=${autodir}/${rhost}/root/${rfs};opts:=nosuid,nodev,rsize=32768,wsize=32768,intr,noatime
* rhost:=${key};type:=host;rfs:=/

By tweaking the defaults of NFS servers and clients, you can make using NFS faster and more responsive, particularly if you make heavy use of NFS file systems.

Linux - How to Find the Block Size

To find the block size for the second partition of the first HDD, the following can be used:

/sbin/dumpe2fs /dev/hda2 | grep 'Block size'

Because dumpe2fs provides a large amount of information, it is convenient to use the filter grep to remove everything from the output except the block size. Because grep is case-sensitive and the word Block begins with an upper case (i.e., capital) B, it is necessary to use an upper case B in this command.