• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

same IP address in /etc/hosts

 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Hope this is the right forum for this question.

I by mistake made two entries in /etc/hosts file with same ip address but different host name and now i cant connect to it even when i m doing ssh with IP address.

Will machine rebooting will solve this problem? because i need to revert the changes.

machine = solaris 10

 
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why not going back to that /etc/hosts file and reedit it again ? and adjust your problem ?

it should be a text file, and you could have access to it using a shell, take a look on how to edit files using "vi" and here you go. the vi is a bit confusing to be used, but looking at some tutorial you would be able to modify the file to your needs.
 
Himanshu Rawat
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sir,

The problem is not changing the file, the problem is after changing the file, i cant connect to machine.

/etc/hosts

# IP adress hostname
10.20.3.4 abc
10.20.3.4 def

now because 2 host names have same IP, i cant connect.....i think it resulted in IP conflict.

Putty cant connect...not even ssh from command prompt..

so will machine rebooting will help???
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
aha now I understand, but if you connect using the IP address directly dosen't it work ?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you can reboot the machine, that means you have physical access to it; can you just log in on it's terminal? Unless it doesn't have one, of course.
 
Himanshu Rawat
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
rebooting was the solution and accessing the terminal and then editing.

Thanks guys
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's something wrong with the target machine - evidently it's not listening for ssh clients (sshd stopped?). The purpose of /etc/hosts is to translate a hostname into an IP address. If you're giving the IP address directly, you skip that step.

There's nothing magic about /etc/hosts, and it's perfectly legal to assign multiple hostnames to a single IP address in /etc/hosts. I do it all the time, since that allows me to target services rather than machines - for example cvs.mousetech.com, svn.mousetech.com www.mousetech.com all might be the same IP. But if SVN outgrows the www box, I can move it to a different machine, change the hosts files and the clients will mostly never know the difference.

Although I should mention that /etc/hosts is only the first entry in my resolver chain and that DNS handles most of the non-critical stuff. /etc/hosts works best when only the hosts that you must be able to resolve even if DNS is unavailable are in it. That's because DNS server all machines, but you have to manually keep each box's /etc/hosts file up to date.
 
Himanshu Rawat
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks tim for detailed explanation. /etc/hosts was not the culprit, as you said ssshd stopped...exactly same thing happened..but who did and how i don't know.

Actually, everything was going fine until i made above said changes in hosts file and that made me to think that change did that.

But now its OK..

 
Hold that thought. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic