Discussion Locked

ifconfig ??

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello.
I have changed the network address using ifconfig with this statement:
(ifconfig eth0 145.145.45.6 netmask 255.255.0.0). It takes, but only lasts for the login session. How do I change it at the command prompt permanently?????

Thanks again Pat

6 replies

by some guy in seattle

you need to edit the interface files in the /etc directory. In this directory is at least one file called "hostname." where is the physical name of the interface (hme0, qfe0, le0, etc). To get the interface name, use the ifconfig -a command. In the /etc/hostname.* file, put the hostname. In the "hosts" file, put this data in the following format:

IP address hostname listed in hostname.* file

Remember that each file needs a carriage return to a blank line in order for the OS to read it properly on boot.

Hope that helps -

by theword

Hello.
I have no hostname in the /etc directory, and I checked elsewhere, but nogo. I have the host file, and it looks fine as you described. One thing. I can use the KDE and configure it, and it works like a champ, and stays permantently. Also, ifconfig -a just gives me the interfaces, but no hostnames listed in the information itself, but only on the command prompt.
Anything else you could offer would be great. Pat

by cpfeiffe

The hostname.* file is the Unix method. Some versions of Linux use this and some don't. What version of Linux are you using? If it is Red Hat or Caldera you can look in /etc/sysconfig/network-scripts. There will be an ifcfg-interface file whereinterface is your interface id, like eth0. In that file you can change the IP address, broadcast, etc. Also in the /etc/sysconfig/network file you can change the default gateway and add static routes. Sometimes you can change the default gateway in the file I mentioned first (depends on software and version). The best thing to do is go to /etc/sysconfig and do a find . -type f -exec grep ip_address {} \;
This will look in the files under /etc/sysconfig for your IP address and return the ones that have it. Most versions of Linux use /etc/sysconfig in some way to set the permanent network and hostname information.

I hope this helps.

by shanghai sam

Thank you. I found it where you said it would be, and now I know. I have RedHat 7.1, by the way.
Bye Pat

This discussion is closed to new replies.