Featured

    Featured Posts

Interview-questions-&-answers

Server Down issue / unable to ssh the server / server not responding to pings.

There are so many reasons for a hostname/ip is not pingable.
a few reasons are:
1. Software issue
2. Hardare issue
3. Network issue
4. Other issue

First we will ping the server and check whether server is responding to pings or not.

Command:      ping hostname

Here, we can see packet drops, if  0% packet loss, then server is reachable/responding to pings.
If  100% packet loss then host is not reachable.


1.Network related issue : ( make sure our network is working fine)
   Cause:
    a. Network link down   →  check with DC ( Data center ) or Hardware team.
    b. Network cables are loose or damaged  → check with DC  ( Data center ) team.
    c. no connection exist between our system to remote system  → Check with Network team

2.  Due to software issue: Host might be completely down
     Get the approval to reboot the host if it is not sshable/pingable.
     Login to console and set the host to boot from disk.
     You can monitor the boot logs to find out the cause
     or once the host is up , check the /var/log/messages or dmesg logs to find root cause.

3. Due to hardware issue : Host might be completely down
    get the approval to reboot the host if it is not sshable/pingable.
    Login to console and set the host to boot from disk.
    You can monitor the boot logs to find out the cause
    or once the host is up , check the /var/log/messages or dmesg logs to find root cause.
    if still the host is not up , then check with DC team to know investigate further on  hardware issue.

4. Other reasons: Host might be in power off state
     cause:
     a.somebody manually powered off the host due to any maintenanace activity
     b. Power supply unit (PSU) problem, fan or temperature issue so system might went down.

NOTE: If Reboot / hardware maintenance ( drive replacement / cable replacement etc., ) , get necessary approvals nd proceed.





To check hostname?

$hostname

To change hostname

edit   /etc/sysconfig/network

HOSTNAME=newname.example.com                   →  Modify this name to new name.
:wq

Once the file is saved, you need to reboot the server OR restart the below services to reflect the new server name.

#service network restart
#service NetworkManager restart

done.
Now verify using hostname command.



How to check the server IP address.

#hostname -i

#ifconfig           →  here you can see ip address as inet addr against eth0 interface

#ip addr show


To get the IP adress of interfaces:

$sudo ifconfig|awk 'sub(/inet addr:/,"") {print $1}'


To get interfaces only:

$echo `ifconfig`|awk '{print $1}'


script to print the ip adress for the interface when interface is given as first parameter to the script

echo -e "enter interface: \c"
read a
c=`ifconfig|awk 'sub(/$a/,"") {print $1}'`
echo "IP address of $a is : $c"




To check which ports are listening to the host
# netstat -nlp

# netstat -an | grep -i <portnumber>

# lsof -i:<portnumber>



If command is throwing permission denied 

then I will try the following commands

1. Check whther I'm running the command as a root user or normal user.
   ( if im a root user , it should work)
2. If I dont have root access, then atleast I will try with
sudo command
3.I will see the path of command
sudo command /bin -maxdepth 1 -type f

4. if it is a script then i will try with
chmod u+x program_name

5. I will check the permsission of command using

   ls -l /bin/ping

if it shows
-rwSr-xr-x 1 root root 36892 date  /bin/ping

here lower case S in permission  indicates execute permission is not set to user
(suid concept)

How to recover or reset Root password in LINUX?

  Steps:
   1. Reboot the system , while the server shows Grub, click Esc (escape )
   2. Select the kernel , press the "e" key to edit the entry
   3. Select second line (the line starting with the word kernel)
   4. Press the "e" key to edit kernel entry so that you can append single user mode
   5. Just give space and type 1
   6. Click ENTER key
   7. Now press the b key to boot the Linux kernel into single user mode
   8. At prompt type passwd command to reset password of root.





Post a Comment

www.CodeNirvana.in

COPYRIGHT © 2017. Powered by Blogger.

Featured Posts

Featured Posts

Featured Posts

Popular Posts

Translate

Total Page Views

blog counter
Copyright © gskLinux | Linux Tutorials | Designed By | Gnanasekhar