3 Replies Latest reply: Feb 26, 2013 11:02 PM by 993094 RSS

    Could not ping and access a server after changing its ip

    993094
      I could not ping and access a (destination) machine from another (source) machine after changing destination machine ip although I modified hosts file and hosts map in the source machine
      I can access the destionation using IP. This problem happened in case of using hostname not IP

      My source machine is omcsp4 (192.6.6.40) and destination machine is omcsp8 (10.57.217.80).
      Here is the host file for two machines:

      omcsp4
      hosts:
      10.57.217.80     omcsp8
      127.0.0.1     localhost     
      192.6.6.40     omcsp4     omcsp4.localdomain omc_splat omc_4gl omc_pm loghost
      #Firewall
      192.6.6.200 FIREWALL

      hosts.equiv
      omcsp4
      omcsp8

      omcsp8
      hosts:
      #
      # Internet host table
      #
      127.0.0.1     localhost     
      10.57.217.80     omcsp8     omcsp8.localdomain omc_splat omc_4gl omc_pm loghost
      192.6.6.40 omcsp4

      hosts.equiv:
      omcsp8
      omcsp4

      Here's logfile when I try to ssh on both machine
      hostname
      omcsp4
      bash-3.00# grep omcsp8 h /etc/hosts
      10.57.217.80 omcsp8
      bash-3.00# ypcat hosts | grep omcsp8
      10.57.217.80 omcsp8
      bash-3.00# ping -a omcsp8
      no answer from omcsp8(192.6.6.180)
      bash-3.00# ping 10.57.217.80
      10.57.217.80 is alive
      bash-3.00# ssh 10.57.217.80
      The authenticity of host '10.57.217.80 (10.57.217.80)' can't be established.
      RSA key fingerprint is c7:d6:32:81:bb:6e:b5:f0:d0:5f:9f:05:f4:6e:be:3f.
      Are you sure you want to continue connecting (yes/no)? yes
      Warning: Permanently added '10.57.217.80' (RSA) to the list of known hosts.
      Password:
      Last login: Thu Feb 21 19:42:08 2013 from omcsp1
      Sun Microsystems Inc. SunOS 5.10 Generic January 2005
      You have new mail.
      # hostname
      omcsp8
      # ping omcsp4
      omcsp4 is alive
      # ifconfig -a
      lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
      inet 127.0.0.1 netmask ff000000
      ce0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
      inet 10.57.217.80 netmask ffffff00 broadcast 10.57.217.255
      ether 0:14:4f:67:32:cb
      #
      #
      #
      # exit
      Connection to 10.57.217.80 closed.
      bash-3.00# hostnae me
      omcsp4
      bash-3.00# id
      uid=0(root) gid=0(root)
      bash-3.00# cd /var/yp
      bash-3.00# make hsost osts
      updated hosts
      pushed hosts
      bash-3.00# ping -a omcsp8
      no answer from omcsp8(192.6.6.180)
      bash-3.00# grep omcsp8 /etc/hosts
      10.57.217.80 omcsp8
      bash-3.00# ypcat hosts | grep omcsp8
      10.57.217.80 omcsp8

      Edited by: 990091 on Feb 25, 2013 6:10 PM
      I've change from "server" to "machine" to avoid misunderstand
        • 1. Re: Could not ping and access a server after changing its ip
          rukbat
          Why would ping be enabled on a server?
          That is a security vulnerability.

          You may need to spend some time with your favorite web search site (for example: Google) researching why and how to enable ping or whether you even should enable ping.
          • 2. Re: Could not ping and access a server after changing its ip
            993094
            Update for this situation
            omcsp4
            IP: 192.6.6.40
            omcsp8
            old IP: 192.6.6.180
            new IP: 10.57.217.80

            When I ping from omcsp4 to omcsp8, there's no answer and the hostname is resolved as *192.6.6.180* which is the old IP. But in hosts file, the IP is the new one.
            omcsp4:omcadmin > ping -a omcsp8
            no answer from omcsp8(192.6.6.180)
            omcsp4:omcadmin > grep omcsp8 /etc/hosts
            10.57.217.80 omcsp8
            omcsp4:omcadmin > ypcat hosts | grep omcsp8
            10.57.217.80 omcsp8     
            omcsp4:omcadmin > ping 10.57.217.80
            10.57.217.80 is alive

            These above operations show that the hosts file and NIS are both updated with the new IP address of omcsp8. But when i ping omcsp8 (by name) it returns the old IP address. So the question is from where the system omcsp4 resolve the hostname omcsp8???
            • 3. Re: Could not ping and access a server after changing its ip
              993094
              Finally I found that problem.
              The reason is I haven't restarted network service on the source machine. So that the source machine still resolves the destination machine's name as the old address which is not available since it is changed to the new one.
              I've restarted the network service on source machine by this command and it works fine:
              +# svcadm restart network/physical+