Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a Centos 5.8 server. How can I add my server IP address 192.168.20.254 so that it reflects when I run the command hostname -i

At the moment the command only shows the loopback IP 127.0.0.1 and the software I am trying to install complains that the server IP is not reflected here.

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

Edit file /etc/hosts and add line:

192.168.20.254 this.is.my.host

Of course instead of this.is.my.host enter proper hostname. You can check it by running hostname without any parameters.

share|improve this answer
add comment

The hostname of the machine can be changed in the following file

#/etc/sysconfig/network 

The

#/etc/hosts

is for local IP > name resolution (No DNS available)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.