Friday, November 2, 2012

Assigning multiple IP's to RedHat Linux.

1. Create a file ifcfg-eth0-iprange.
2. Add the following content in the file depending on your requirement.
3. Change IPADDR_START & IPADDR_END as per the need.
4. save the file.
5. service network restart

ONBOOT=yes

IPADDR_START=192.168.217.129
IPADDR_END=192.168.217.132
CLONENUM_START=0
NETMASK=255.255.255.0
NO_ALIASROUTING=yes

[root@rajlinux network-scripts]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:0C:29:B7:4F:7C

inet addr:192.168.217.128 Bcast:192.168.217.255 Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:feb7:4f7c/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:44792 errors:0 dropped:0 overruns:0 frame:0

TX packets:32995 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:3933587 (3.7 MiB) TX bytes:5143510 (4.9 MiB)

Interrupt:5 Base address:0x2024


eth0:0 Link encap:Ethernet HWaddr 00:0C:29:B7:4F:7C

inet addr:192.168.217.129 Bcast:192.168.217.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Interrupt:5 Base address:0x2024


eth0:1 Link encap:Ethernet HWaddr 00:0C:29:B7:4F:7C

inet addr:192.168.217.130 Bcast:192.168.217.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Interrupt:5 Base address:0x2024


eth0:2 Link encap:Ethernet HWaddr 00:0C:29:B7:4F:7C

inet addr:192.168.217.131 Bcast:192.168.217.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Interrupt:5 Base address:0x2024


eth0:3 Link encap:Ethernet HWaddr 00:0C:29:B7:4F:7C

inet addr:192.168.217.132 Bcast:192.168.217.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Interrupt:5 Base address:0x2024


lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:13956 errors:0 dropped:0 overruns:0 frame:0

TX packets:13956 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:10042055 (9.5 MiB) TX bytes:10042055 (9.5 MiB)

Thanks.

Monday, July 9, 2012

Adding aliases, Allowing root login, changing PS1 value, Changing hostname on the fly - On X86

To add aliases in Solaris 10:

1. touch the .profile file in the home dir.

# touch .profile

-bash-3.2# more .profile

alias ll='ls -l'

---------------------------------

Enable ssh root login in Solaris 10

1. Change the file /etc/ssh/sshd_config with PermitRootLogin yes to replace PermitRootLogin no

2. restart the services

-bash-3.2# svcs -a | grep ssh

online 14:20:00 svc:/network/ssh:default

-bash-3.2# svcadm restart svc:/network/ssh:default

#svcadm restart svc:/network/ssh:default

----------------------------------

Changing the PS1 value in Solaris 10:

The PS1 value need to be added to the .bash_profile file.

PS1="\u@\h: \W $ "

to make the change to take immediate effect

# source .bash_profile

root@rajsolaris: / $

------------------------------------

Changing hostname on the fly:

1. /etc/hosts

2. cd /var/crash

# mv unknown

3. /etc/hostname.e1000g0 - Edit this file in the vi editor & add the desired hostname.

do ^ D

login again.

root@rajsolaris: / $

-------------------------------------

Wednesday, May 30, 2012

Finding WWN of HBA on Linux

/usr/sbin/hbanyware/hbacmd listhbas

[root@hqiqlrajdb01 ~]# /usr/sbin/hbanyware/hbacmd listhbas


Manageable HBA List

Port WWN : 10:20:00:00:c9:cc:52:08

Node WWN : 20:00:00:00:c9:cc:52:08

Fabric Name: 20:29:00:35:73:a1:15:01

Flags : 8010fe0d

Host Name : testdb01

Mfg : Emulex Corporation

Serial No. : 5CJKL11490ZD

Port Number: 0

Mode : Initiator


Port WWN : 10:00:99:00:c9:cc:52:09

Node WWN : 20:00:90:00:c9:cc:52:09

Fabric Name: 00:00:00:00:00:00:00:00

Flags : 8000fe0d

Host Name : testdb01

Mfg : Emulex Corporation

Serial No. : 5ZF11490ZD

Port Number: 1

Mode : Initiator




Thursday, May 3, 2012

TimeZone change (Permanent without reboot) on RedHat Linux 5.7.

Today I would like to share Time Zone chane on RHEL 5.7 - Simple
But need to have the info on time & quick. Four commnds! :-)

cd /etc
rm localtime
ln -s /usr/share/zoneinfo/America/New_York localtime
date

Thats it!

Thanks.

Thursday, March 29, 2012

How to Add NAS path on the mount point on RHEL 5.7.

This is a short note on adding the NAS path once it has been allocated by the EMC storage Engineer for the respective servers.


You will get the path information looking like this:


file://10.168.11.111/234590_MQL.


You have to convert that according to the fstab file syntax.


10.168.11.111:/234590_MQL /usr/app/share nfs rw,nolock,soft,intr,bg,nfsvers=3,rsize=32768,wsize=32768,proto=tcp 0 0


Now reboot the server and run df -h command to check the NAS mount.

Below is an example:


root@sandbox03 ~ # df -h

Filesystem Size Used Avail Use% Mounted on


10.168.11.111:/234590_MQL

197G 608K 197G 1% /usr/app/share



Thanks,

-Raj

Thursday, March 1, 2012

Finding only "Files", "Directories and soft links in the Existing directory.

Hi This may be a small and good tip - instead of writing a shell script, which I was trying to find only files in the existing directory. And just thought of using the unix inbuilt command "find" to do this :-)
1.Find only Files in the existing dir:
 find . -type f -name '*'
2.Find only Directory in the existing directory.
 find . -type d -name '*'
3 find only symbolic links
 find . -type l -name '*' 10:12:10

10:12:10 rsangvik@test100 $ ls -l


total 188

-rw-r--r-- 1 rsangvik users 65 Feb 29 10:12 an.pl

-rw-r--r-- 1 rsangvik users 138 Feb 29 12:23 apple

-rwxr-xr-x 1 rsangvik users 75 Feb 29 10:32 array.pl

-rwxr-xr-x 1 rsangvik users 181 Feb 23 15:48 break

-rwxr-xr-x 1 rsangvik users 216 Feb 16 15:03 com_output.sh

-rwxr-xr-x 1 rsangvik users 186 Feb 23 15:36 dater

-rwxr-xr-x 1 rsangvik users 276 Feb 29 10:28 default_scalar.pl

-rw-r--r-- 1 rsangvik users 784 Feb 29 11:32 echo

-rwxr-xr-x 1 rsangvik users 67 Feb 29 10:03 foreach.pl

-rwxr-xr-x 1 rsangvik users 151 Feb 29 09:32 if.pl

-rwxr-xr-x 1 rsangvik users 125 Feb 29 09:26 input.pl

-rw-r--r-- 1 rsangvik users 7001 Feb 29 11:56 mytestfile

-rwxr-xr-x 1 rsangvik users 87 Feb 29 15:32 num.pl

-rwxr-xr-x 1 rsangvik users 282 Feb 29 15:11 parse1.pl

-rwxr-xr-x 1 rsangvik users 224 Feb 29 11:52 parse.pl

-rwx------ 1 rsangvik users 113 Feb 13 16:16 passcrypt.pl

-rwxr-xr-x 1 rsangvik users 139 Feb 29 10:57 pop.pl

-rwxr-xr-x 1 rsangvik users 168 Feb 29 11:15 push.pl

-rwxr-xr-x 1 rsangvik users 241 Feb 29 15:02 regex.pl

lrwxrwxrwx 1 rsangvik users 6 Mar 1 10:06 soft -> num.pl

drwxr-xr-x 2 rsangvik users 4096 Mar 1 09:43 test

-rwxr-xr-x 1 rsangvik users 66 Feb 29 10:10 while.pl

-rw-r--r-- 1 rsangvik users 7001 Feb 29 11:56 yourtestfile

[~/script]

10:12:13 rsangvik@test100 $ find . -type f -name '*'

./parse1.pl

./com_output.sh

./num.pl

./foreach.pl

./an.pl

./parse.pl

./apple

./passcrypt.pl

./echo

./break

./push.pl

./yourtestfile

./pop.pl

./if.pl

./default_scalar.pl

./input.pl

./while.pl

./dater

./regex.pl

./mytestfile

./array.pl

[~/script]

10:12:19 rsangvik@test100 $ find . -type d -name '*'

./test

[~/script]

10:12:26 rsangvik@test100 $ find . -type l -name '*'

./soft