Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change the ip on a linux server

Status
Not open for further replies.

djr111

Technical User
Aug 5, 2006
357
US


by editing files, what file(s) do I have to edit to change the ip address on a linux server

I think it is /etc/sysconfig/network, I thought I did it there, but am finding alot of different stuff on google.

How do I specify in what ever file I edit the ip, gateway ...etc

sorry for the dumb question..




thanks
 
It depends on the disribution.

On RHEL it's in /etc/sysconfig/network-scripts/ifcfg-<if_name> and routing is set in /etc/sysconfig/network.

On SLES 10 the files are in /etc/sysconfig/network/ and the ones you want are "routes" and "ifcfg-eth-id-<mac_addr>".

You'll also probably want to edit /etc/hosts as that usually has the local host's address.

 
a lot of distros come with a nice tool called netconfig.
You can run it from the command line (as root) and it'll go through step by step to configure a network interface.
 
netconfig does not work well for multiple interfaces.

I recommend always the good old command prompt.

Anyway, standard command for any linux distros is ifconfig
an example is below

Code:
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up


Follow lgarner's post to make the changes permanent


QatQat

Life is what happens when you are making other plans.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top