RedHat Linux Network Configuration

I’ve decided to start posting a collection of useful tips on Linux configuration. I usually rely on a Google search to find what I need, but I always wanted to have a central location of quick pointer when faced with basic system administration tasks. First stop is a look at the network configuration files.

Network Interface Configuration

/etc/sysconfig/network-scripts/ifcfg-eth#

Sample content

DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.2.255
HWADDR=00:07:E9:E4:2C:E4
IPADDR=192.168.2.30
NETMASK=255.255.255.0
NETWORK=192.168.2.0
ONBOOT=yes
TYPE=Ethernet

Once updated you need to run the following commands to reload the configuration:

root# ifdown eth#
root# ifup eth#

If your only connection to the machine is via ssh, you will want to execute this command instead:

root# /etc/init.d/network reload

If you changed network you will need to change the default gateway address before reloading the new configuration.

Gateway Address

To change to default gateway address edit the following line under /etc/sysconfig/network

GATEWAY=192.168.1.1

Once updated reload the configuration by executing:

root# /etc/init.d/network reload

Hostname

First edit the following line in /etc/sysconfig/network

HOSTNAME=my_hostname

Then edit the following line in /etc/hosts

127.0.0.1 localhost.localdomain localhost


You then need to restart linux for this to take effect.

DNS Servers

The list of DNS servers to look up is defined in /etc/resolv.conf
Here’s an example of what such a file looks like:

search auberger.com
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx

The fist line is optional and defines the network to search for when a host is entered without it’s full address. The remaining 3 lines define the DNS servers to be using in order of precedence.

Post a comment

One Comment

  1. vini
    Posted May 07, 2006 at 1:08 am | Permalink

    Thanks very much . It helped me a lot. Keep Publisihing.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*