19 January 2009

Fault tolerance for NIC

More and more data centers are in the process of setting up unmaned data centers.Admins are trying their best to have a fault tolerance solution for each software and Hardware component.
Here is a fault tolerance soultion for a Network interface via bonding in Linux

1.Create a file ifcfg-bond under /etc/sysconfig/network-scripts where is the binding number.
2.cat ifcfg-bond0

DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETWORK=192.168.41.0

NETMASK=255.255.255.0
IPADDR=192.168.41.250
USERCTL=no


3.Network interfaces to be bound together must be configured by adding MASTER= and SLAVE= directives to their configuration files.

4.Configuration files for the two interface files

DEVICE=eth<0/1>
BOOTPROTO=none

ONBOOT=yes
MASTER=bond0

SLAVE=yes
USERCTL=no

5.Configuring alias in modprobe.conf
alias bond0 bonding

options bond0 milmon=80 mode=1

modprobe to activate the aliases and restart the network service.

6. Now bond0 will be up.Output of ifconfig will show the same ip-address for bond0,eth0 & eth1.

27 August 2008

How to list the contents of the EFI directory on hp-ux IPF systems?

First find the default boot device using the setboot command
# setboot
Primary bootpath : 0/4/1/0.0.0.7.0
HA Alternate bootpath : 0/0/2/0
Alternate bootpath : 0/4/1/0.0.0.6.0
Autoboot is ON (enabled)#


Find the corresponding dirver for the Hardware path using ioscan
# ioscan -funC disk

disk 39 0/4/1/0.0.0.6.0 sdisk CLAIMED DEVICE HP DG146ABAB4
/dev/dsk/c17t6d0 /dev/dsk/c17t6d0s2 /dev/rdsk/c17t6d0 /dev/rdsk/c17t6d0s2
/dev/dsk/c17t6d0s1 /dev/dsk/c17t6d0s3 /dev/rdsk/c17t6d0s1 /dev/rdsk/c17t6d0s3
disk 40 0/4/1/0.0.0.7.0 sdisk CLAIMED DEVICE HP DG146ABAB4
/dev/dsk/c17t7d0 /dev/dsk/c17t7d0s2 /dev/rdsk/c17t7d0 /dev/rdsk/c17t7d0s2
/dev/dsk/c17t7d0s1 /dev/dsk/c17t7d0s3 /dev/rdsk/c17t7d0s1 /dev/rdsk/c17t7d0s3
#


List the contents of EFI shell.This can be useful to compare root and root mirror disks.

# lifls -l /dev/rdsk/c17t7d0s2
volume ISL10 data size 7984 directory size 8 06/10/27 14:23:07
filename type start size implement created
===============================================================
ISL -12800 584 242 0 06/10/27 14:23:07
AUTO -12289 832 1 0 06/10/27 14:23:07
HPUX -12928 840 1024 0 06/10/27 14:23:07
PAD -12290 1864 1468 0 06/10/27 14:23:07
LABEL BIN 3336 8 0 08/07/01 05:19:23#

22 August 2008

Sudoers file on Solaris 10

sudo is available from the SFWsudo package on Solaris 10.
To use it a /etc/sudoers file has been set but still leading to the following error

user NOT in sudoers

Hopefully, truss will help :-)

root@server:/# truss -o /tmp/output sudo ls

The /tmp/output file is answering the enigma:

root@server:/# grep sudoers /tmp/output
lstat("/opt/sfw/etc/sudoers", 0xFFBFFB28) = 0
open("/opt/sfw/etc/sudoers", O_RDONLY) = 4

The sudoers file to edit is in /opt/sfw/etc

01 July 2008

Raw devices & Block devices

Most of the people will get confused when to use /dev/dsk/c0t1d0s7 and /dev/rdsk/c0t1d0s7 device files.

Generally /dev/dsk is a block disk device whereas /dev/rdsk is a character disk device

As a thumb rule raw devices are used before filesystem creation.Block devices are user after filesystem creation.

E.g., In Solaris whenever you create a new slice using format command a raw physical slice or a Raw Device will be created which is addressed as /dev/rdsk/c#t#d#s#
After formatting it with newfs command the slice will be addressed as /dev/dsk/c#t#d#s# which can now be used for mounting.

newfs /dev/rdsk/c0t1d0s4
mkdir /oracle
mount /dev/dsk/c0t1d0s4 /oracle

After mounting /dev/dsk/c#t#d#s# is called as Block Device

29 May 2008

Soft limit & Hard limit

Most of us encountered to increase the limit of file descriptors while installing a high end 3pp(party product).In doing so we will encounter with two different kinds of limits i.e.soft vs hard.

Hard limits are a kernel-configurable item and users can't exceed them. Soft limits are the user defaults and users can change that using the ulimit command.

Basically, soft limits can be changed to anything up to the hard limit. Soft limits are warning barrier. When a user reaches the soft limit they will get an warning message but are still allowed to use more space up to the hard limit.

Since its a kernel tunable we have to define the value in /etc/system and /etc/sysctl.conf for Pre-Solaris 10 and Linux respectively.

E.g.,

To set a hard limit of 4096 and soft limit of 1024 in Solaris 8.

set rlim_fd_max=4096 [Refers Hard limit]
set rlim_fd_cur=1024 [Refers Soft limit]


To raise the allowed limit in Linux based distributions update either /etc/limits.conf or /etc/security/limits.conf

07 March 2008

How to Password Protect GRUB Boot loader

The main reason to password protect the GRUB boot loder is to prevent access to single user mode — If attackers can boot the system into single user mode, they are logged in automatically as root without being prompted for the root password.

To do this, open a shell prompt, log in as root, and type:

/sbin/grub-md5-crypt


When prompted, type the GRUB password and press Enter. This returns an MD5 hash of the password.

Next, edit the GRUB configuration file /boot/grub/grub.conf. Open the file and below the timeout line in the main section of the document, add the following line:

password --md5


Replace with the value returned by /sbin/grub-md5-crypt

Relative vs. Absolute Pathnames

Commands can be given file name arguments in two ways.

If you are in the same directory as the file (i.e., the file is in the current directory), then you can just enter the file name on its own (e.g., cp my_file new_file). Otherwise, you can enter the full path name, like cp /home/john/my_file /home/jack/new_file.

Very often administrators use the notation ./my_file to be clear about the distinction, for instance, cp ./my_file ./new_file. The leading ./ makes it clear that both files are relative to the current directory.

File names not starting with a / are called relative path names, and otherwise, absolute path names.

26 February 2008

Steps to Configure IP for MP-Port in HP Servers

Step 1: Connect a terminal to the console port of the system.

Step 2:
Login tothe console using username and password. The default username for MP is typically Admin and the default
password is Admin.
Step 3: Type “cm” on the MP prompt to go to the MP command menu
Step 4: Type “lc” on the MP CM prompt to modify the LAN configuration and press “A” when prompted for modification
Current LAN Configuration:
- - MAC Address : 0x001635b66433
D - DHCP Status : Disabled
I - IP Address : ---------------
M - MP Host Name: ---------------
S - Subnet Mask : ---------------
G - Gateway Address : ------------
L - Link State : Auto Negotiate
W - Web Console Port Number : 2023
- - SSH Access Port Number : - (MP Feature Not Licensed)
- - IPMI / LAN Port Number : 623A


Enter parameter(s) to change, A to modify All, or [Q] to Quit:


Step 5: Type the IP address of the MP port.

IP Address:
Current -&gt;
127.0.0.1 (default)

Modifying this parameter will cause all present LAN and Web connections to be dropped.
Enter new value, or Q to Quit: 172.16.1.100
Step 6: Type the hostname of the MP port.
Host Name:
Current -&gt;
mp001635b66433 (default)

Enter new value, or Q to Quit: m1sys100
Step 7: Type the Subnet Mask of the MP port.
Subnet Mask:
Current -&gt;
255.255.255.0 (default)

Modifying this parameter will cause all present LAN and Web connections to be dropped.

Enter new value, or Q to Quit: 255.255.224.0
Step 8: Type the Gateway of the MP port.
Gateway Address:
Current -&gt;
127.0.0.1 (default)

Enter new value, or Q to Quit: 172.16.0.1
Step 9: Press “Enter” when prompted for Web Console Port Number.
Web Console Port Number:
Current -&gt; 2023 (default)
Options: 23, 2000 to 2400

Modifying Web Port number will cause all present Web connections to be dropped.

Enter new value, or Q to Quit:

-&gt; Current Web Console Port Number has been retained

Step 10: Press “Enter” when prompted for SSH Console Port Number.
SSH Console Port Number:
Current -&gt; 22 (default)
Options: 22, 2000 to 2400

Enter new value, or Q to Quit:
-&gt; Current SSH Console Port Number has been retained
Step 11: Type “Disabled” or “D” when prompted for DHCP Status.
DHCP Status:
Current -&gt; D - Disabled
E - Enabled (default)

Modifying this parameter will cause all present LAN and Web connections to be dropped.

Enter new value, or Q to Quit: Disabled

Step 12: Press “Enter” when prompted for Link State.
Link State:
Current -&gt; A - Auto Negotiate (default)
T - 10BaseT

Modifying this parameter will cause all present LAN and Web connections to be dropped.


Enter new value, or Q to Quit:

-&gt; Current Link State has been retained

Step 13: Type “xd” on the MP CM prompt and press “r” to reset MP.
Step 14: From any of the lab machines, ping to the newly configured IP address of the GSP and see if it is alive on the
network.

21 February 2008

Online Security testing for Mail Server (SMTP)

To check whether your SMTP server reliable and fully secured.Check the URL http://www.test-smtp.com

How to Make USB Pen drive as a bootable device (RedHat)

If you cannot boot from the DVD/CD-ROM drive, but you can boot using a USB device, such as a USB pen drive, the following alternative boot method is available:

To boot using a USB pen drive, use the dd command to copy the diskboot.img image file from the /images/ directory on the DVD or CD-ROM. For example:

dd if=diskboot.img of=/dev/sda

Note: Your BIOS must support booting from a USB device in order for this boot method to work