Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get IP address in linux

 
shiva kumar nanda
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am working on Linux.
I have a problem of getting the IP Address.
Can any one help me in getting the IP Address.
And my IP Address changes day by day.

Using InetAddress class i am able to get the IP Address on Windows, but this is failing on Linux.

Thank You
 
Arun Bommannavar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you getting when you do InetAddress.getLocalHost()?.
what does your /etc/hosts have?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic