Wednesday, December 12, 2012

Configuring NTP server for a client and troubleshooting

Configuring NTP server for a client and troubleshooting


Prerequisites: Need to have a TIME server with which client will sync the time.

Declaration:

 (Server: 9.57.167.220)
 (Client: 9.57.167.221)

On the NTP server ,perform the below steps:

1. Verify that you have a suitable NTP server. Enter:
# lssrc -ls xntpd
NOTE: Sys peer should show a valid server or 127.127.1.0.
If the server is "insane", you will need to correct it by adding a server line to /etc/ntp.conf and restarting xntpd. This can be done by following these steps:


a) Add the local host “server 127.127.1.0” entry in /etc/ntp.conf.
# vi /etc/ntp.conf
Add:
server 127.127.1.0
Double check that "broadcast client" is commented out.
Having added , “tail /etc/ntp.conf” should be akin to below:

  
b) Stop and start the xntpd.

# stopsrc -s xntpd
# startsrc -s xntpd
NOTE: If the server runs databases, use the -x flag to prevent the clock from changing in a negative direction. Enter the following:
# startsrc -s xntpd -a "-x"
2. Repeat the step 1. to verify if we have a suitable NTP server, server should not be insane. Sys peer should show a valid server or 127.127.1.0, like below:
 

NOTE: The syncronization may take few minutes ,untill then the output will not show the valid server in “Sys peer”.
This concludes the configuration part on NTP server end , neverthless it's always a good practice to check and ensure that the “xntpd” daemon is running.
On Client, perform the below steps:
1. Specify your xntp server in /etc/ntp.conf, enter:
# vi /etc/ntp.conf
(Comment out the "broadcastclient" line and add server ip.address.of.server prefer.)
Leave the driftfile and tracefile at their defaults.



Server 9.57.167.220 is the NTP server we have declared.
2. Start the xntpd daemon:
# startsrc -s xntpd
(Use the -x flag if it is appropriate for your environment.)
  • Uncomment xntpd from /etc/rc.tcpip so it will start on a reboot. (This is optional and depends on envrionment )
# vi /etc/rc.tcpip
3. Uncomment the following line:
start /usr/sbin/xntpd "$src_running"
If using the -x flag, add "-x" to the end of the line. You must include the quotes around the -x.
4. Verify that you have a server suitable for synchronization. Enter:
# ntpdate -d ip.address.of.server/hostname
Eg: 
# ntpdate -d 9.57.167.220
or
# ntpdate -d hostname 

The offset must be less than 1000 seconds for xntpd to synch. 
**If the offset is greater than 1000 seconds like in below artifact;



# change the time manually on the client so as to meet the nearest time with the NTP server and run the ntpdate -d again , the offset will be below 1000.
NOTE: It's very important to keep the offset below 1000 ,then only it'll synch with the NTP server.
If you get the message, "no server suitable for synchronization found", verify xntpd is running on the server (see above) and that no firewalls are blocking port 123.
5. Verify that the client is synched once the offset is set/exist below 1000.
# lssrc -ls xntpd





NOTE: Sys peer should display the IP address or name of your xntp server. This process may take up to 12 minutes.









 

unable to remove lv in aix

#rmlv fslv00
0516-1008 rmlv: Logical volume fslv00 must be closed.  If the logical volume
        contains a filesystem, the umount command will close the LV device.

#rmfs -r /mksysb
rmfs: No record matching '/fslv00' was found in /etc/filesystems.

In my case 'fslv00' was mapped to 2 different file systems in /etc/filesystems. i.e /testfs & /mksysb

#grep -ip fslv00 /etc/filesystems
/mksysb:
        dev             = /dev/fslv00
        vfs             = jfs2
        log             = /dev/loglv00
        mount           = false
        account         = false
        quota           = no

/testfs:
        dev             = /dev/fslv00
        vfs             = jfs2
        log             = /dev/loglv00
        mount           = true
        account         = false
        check           = true

#umount -f /testfs
forced unmount of /testfs
forced unmount of /testfs


#rmfs /mksysb
rmlv: Logical volume fslv00 is removed.

lslv fslv00
0516-306 lslv: Unable to find  fslv00 in the Device
        Configuration Database.

=====================

If the above solution doesn't work then try with the below commands:

# synclvodm -v <volume group> fslv00

# syncvg -l fslv00

once executed any of the above commands go and try removing the File system / LV and it should work.





Wednesday, June 13, 2012

Linux basic user admin commands




#ls –l
 File / Folder listing in a specific  directory
#id <user id>
 To check if the user exists / also to find the UID and groups of the existing user
#finger <user id>
 To check the user last login time stamp/ home directory path / login shell / gecos field
#cat <file name> 
 To read the file which is less than 1 page
#less <file name>
 To read the file which is more than a page
#head <file name>
To read the first 10 lines of the file
#tail <file name>
To read the last 10 lines of the file
#hostname
 To find the hostname of the logged in server
#uname
 To find the flavor of unix OS
#uname –r
 To find the kernel version
#uname  -a
 To find complete info of the server which includes flavor, kernel OS build date
#which <command name>
To find the path of the command which needs to be executed

#/usr/local/bin/sudo /usr/sbin/useradd -u 7014 -g users -d /home/<login id>-m -c "Teju Nagaraj" -s /sbin/bash <login id>
 Command to create a user in Linux server
#/usr/bin/sudo passwd <login id>
 Command to set password for a user
#/usr/bin/sudo /usr/sbin/userdel <login id>
Command to delete the user without deleting home directory
#/usr/bin/sudo /usr/sbin/userdel -r <login id>
 Command to delete the user including home directory
#ssh <hostname>
 Command to remotely login to a different server
#/usr/bin/sudo /usr/sbin/usermod –c ”000/C///lastname, Firstname” <login id>
 Command to modify the gecos filed of a user
#/usr/bin/sudo /usr/sbin/usermod –s <shell name> <login id>
 To change the shell of a user