To configure the network card on a Red Hat Enterprise Linux (RHEL) 5 system, you can follow these steps:
Edit the /etc/sysconfig/network-scripts/ifcfg-ethX
file: Open the /etc/sysconfig/network-scripts/ifcfg-ethX
file in a text editor, where X
is the number of the network interface you want to configure. For example, to configure the eth0
interface, you would edit the /etc/sysconfig/network-scripts/ifcfg-eth0
file.
Configure the network settings: In the ifcfg-ethX
file, you can specify the following settings:
DEVICE
: The name of the network interface.BOOTPROTO
: The method of obtaining an IP address. Valid values are dhcp
or static
.ONBOOT
: Whether the interface should be activated at boot time. Valid values are yes
or no
.IPADDR
: The static IP address of the interface. This is required if BOOTPROTO
is set to static
.NETMASK
: The network mask of the interface. This is required if BOOTPROTO
is set to static
.GATEWAY
: The default gateway for the interface. This is required if BOOTPROTO
is set to static
.For example, to configure the eth0
interface with a static IP address of 192.168.1.100
, a network mask of 255.255.255.0
, and a default gateway of 192.168.1.1
, you would set the following values in the ifcfg-eth0
file:
DEVICE=eth0 BOOTPROTO=static ONBOOT=yes IPADDR=192.168.1.100 NETMASK=255.255.255.0 GATEWAY=192.168.1.1
ifcfg-ethX
file and exit the text editor. Then, restart the network service by running the following command:service network restart
This will apply the new network settings and activate the network interface.