Red Hat
- Redoso
- General
- Red Hat
This Page Contains information about Red Hat By tony in category General with 3 Replies. [44], Last Updated: Sat Jun 01, 2024
tony
Wed Jun 10, 2009
3 Comments
40 Visits
Redhat IP Configuration
The IP configurations on the Redhat distribution of the Linux operating system are stored in the directory /etc/sysconfig/network-scripts/. Each interface, as well as sub-interface, requires a unique configuration file.
The below example assigns the interface eth0 an IP address of 192.168.1.42 on a class C network with 192.168.1.1 as the gateway.
/etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE=eth0
IPADDR=192.168.1.42
NETMASK=255.255.255.0
ONBOOT=yes
GATEWAY=192.168.1.1
In order to assign multiple IP addresses on the same interface (eth0), there must be a configuration file for the sub-interface eth0:0 (incrementing as necessary). The below example will add three more IP addresses to the same interface:
/etc/sysconfig/network-scripts/ifcfg-eth0:0:
DEVICE=eth0:0
IPADDR=192.168.1.41
NETMASK=255.255.255.0
ONBOOT=yes
/etc/sysconfig/network-scripts/ifcfg-eth0:1:
DEVICE=eth0:1
IPADDR=192.168.1.44
NETMASK=255.255.255.0
ONBOOT=yes
/etc/sysconfig/network-scripts/ifcfg-eth0:2:
DEVICE=eth0:2
IPADDR=192.168.1.45
NETMASK=255.255.255.0
ONBOOT=yes
Note that a gateway statement is not necessary in this file because the same gateway was defined in /etc/sysconfig/network-scripts/ifcfg-eth0.
To update your system's IP configuration after making changes to the /etc/sysconfig/network-scripts/ directory, execute
# service network restart