Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On CentOS I no longer have a ifcfg-eth0 configuration file (I deleted it). When I run system-configure-network it shows no interfaces that I can edit. How can I recreate the ifcfg-eth0 configuration file? (Like the CentOS installer does)

I can manually do a: ifconfig eth0 192.168.0.199 and then a ping 192.168.0.1. But that's not the proper way. How can I do it using the CentOS network scripts?

I prefer not to do this by hand as there are many hardlinks and confusing stuff. I am new to CentOS.

share|improve this question
add comment

3 Answers 3

up vote 7 down vote accepted

There might be a utility, but I don't know what it is. You can just create a file at /etc/sysconfig/network-scripts/ifcfg-eth0 with contents similar to:

DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.0.199
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
share|improve this answer
    
Running system-config-network seems to be a good idea after recreating the ifcfg-eth0 file. –  unixman83 May 24 '11 at 4:22
add comment

I use the command: system-config-network-tui

Creating the file by hand is a good answer too, but this will get the MAC address for you.

share|improve this answer
add comment

There is a utility called sysconf-network or something like that to allow you to manager the network connections. That is a command line utility.

Here is a link to the FAQ about their /etc/sysconfig system.

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.