CentOS 5.2 /etc/sysconfig/networking

The file located in /etc/sysconfig/networking/profiles are created by the GUI network interface management tool. These files should not be edited manually and when changes need to be made they should be made directly to the files as shown below. CentOS 5 is easy to get around from the command line and it is beneficial to understand each of the below files if you are going to manage a server.

Need to make a change to hostname?
First modify /etc/sysconfig/network and modify the following line:
HOSTNAME=your.hostname.here



Also make sure you modify /etc/hosts to include lines like the following.
127.0.0.1 localhost.localdomain localhost
192.168.0.10 someother someother.yourdomain.com
192.168.0.20 thisserver thisserver.yourdomain.com

Need to modify the IP address of an Ethernet interface?
Modify the IP information in /etc/sysconfig/network-scripts to something like the below:
If your primary Ethernet interface is eth0 the file would be /etc/sysconfig/network-scripts/ifcfg-eth0 and its contents will look similar to this:
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.12.255
HWADDR=00:0C:29:23:6d:47
IPADDR=192.168.1.20
IPV6_AUTOCONF=yes
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
GATEWAY=192.168.1.1
TYPE=Ethernet

Before you make any changes to the network configuration make sure you understand the change you are making. Its always a good idea to back up each file before you make a change to it though make sure you do not back it up to the same directory as it could be read as an active file depending on how you name it and you will wonder why your changes aren’t working! Also once you have made changes and you are about to reboot or restart networking (/etc/init.d/network restart) double and triple check your changes to make sure they are accurate.

This is a great book on Linux networking!

Linux Networking Cookbook (Paperback)

By (author): Carla Schroder


List Price: $44.99 USD
New From: $24.55 USD In Stock
Used from: $1.68 USD In Stock

Share