Missing eth0 configuration file

Posted on

Problem :

I have two servers both running Scientific Linux 6 on the same network. Since I want SSH access to both of them, I want to give them both static IPs so I can setup port forwarding and not worry how my router assigns local IPs. I found that I need to edit the configuration file /etc/network-scripts/ifcng-eth0, however that file does not exist. The network card works fine, and I am able to ssh as long as I access the router and find the local ip.

Can I simply make my own configuration file, or did I miss some step in configuring the system that I need to complete?

Solution :

It should be enough to simply edit /etc/hosts. So, assuming your server is called server1 and you want to give it the IP, edit /etc/hosts as root and add this line:    server1

Then restart the networking service or your machine and you should have a static IP.

As a general note, usually when a file you are supposed to edit on Linux to configure something or other is absent, it is a safe bet that you can simply create it and add the specified lines. Not always, mind you, but often.

If that does not work, it may be necessary to create the eth0 configuration file. Follow the instructions here to do so.