General discussion

Locked

Linux IP Address Change

By gkaiser ·
I am trying to change the IP address of my Linux Machine, I logged onto the box and used the following command "ifconfig eth0 192.168.1.2" but each time I reboot it changes back to the old address, is there any way to make this change permenant?

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Linux IP Address Change

by spiceman In reply to Linux IP Address Change

Do it through the GUI interface (Network Configuration) and save the changes!

Good luck

Collapse -

Linux IP Address Change

by gkaiser In reply to Linux IP Address Change

Poster rated this answer

Collapse -

Linux IP Address Change

by jcmcintyre In reply to Linux IP Address Change

If you are running a GUI, you can use netcfg. The netcfg utility may run directly from the command line, as root, or through the gnome control-panel utility. You may also use linuxconf. In linuxconf, go to client tasks --> Host name and IP network devices, and change teh Ip address and subnet mask for the appropirate interface.

The best way haowever, is to edit your /etc/hosts file. As root, open /etc/hosts, and enter the new hostanme and IP address for you machine. This method works on all linux systems, and no gui is required.

Jim

Collapse -

Linux IP Address Change

by gkaiser In reply to Linux IP Address Change

Poster rated this answer

Collapse -

Linux IP Address Change

by Joe Prochazka In reply to Linux IP Address Change

If you goto the following directory:
/etc/sysconfig/network-scripts/
You will see a file in there:
ifcfg-eth0

You may see some other files in there also:
ifcfg-eth0:0
ifcfg-eth0:1

ifcfg-eth0 will be the configuration file of the primary address for your network card. The other ifcfg-eth0:0, ifcfg-eth0:1, etc...
are the configuration files containing the informaion for ip aliases set for device eth0.

Now if your looking to change your primary ip address just edit ifcfg-et0 the following to suit your needs:


BROADCAST=10.0.0.255 <--Generally your ip with 255 at the end

IPADDR="166.102.18.2" <---your new ip address

NETMASK="255.255.255.0" <--Netmask if changed

NETWORK=166.102.18.0 <--Generally your ip just a zero at the end

After making the changes on this file you should everytime after reboot your system will read these files and load your new ip address.

Collapse -

Linux IP Address Change

by gkaiser In reply to Linux IP Address Change

Poster rated this answer

Collapse -

Linux IP Address Change

by gkaiser In reply to Linux IP Address Change

This question was closed by the author

Back to Linux Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums