19 Static Configuration in CentOS with ifcfg Files
Warning
⚠️ 💥 ⚠️ NOTE: You will not be using a CentOS router in the 2025 NCAE challenge!!!⚠️ 💥 ⚠️
You can safely skip this video!
- Network Configuration in CentOS
- CentOS does not use
/etc/network/interfaces
like Debian-based systems. - Network configurations are managed in
/etc/sysconfig/network-scripts/
. - Each network interface has its own
ifcfg-<interface>
file.
- CentOS does not use
- Finding the Correct Interface File
ls /etc/sysconfig/network-scripts/
lists all network interface files.- Common interfaces include
ifcfg-eth0
,ifcfg-eth1
, andifcfg-lo
. - Modifying the wrong file may result in network misconfiguration.
- Editing Interface Configuration
- Open the correct file using
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
. - The file contains parameters like
BOOTPROTO
,IPADDR
, andNETMASK
. BOOTPROTO=dhcp
means dynamic addressing, whilestatic
requires manual setup.
- Open the correct file using
- Configuring a Static IP Address
- Set
BOOTPROTO=static
to manually assign an IP. - Add
IPADDR=<desired_IP>
andNETMASK=<subnet_mask>
based on network topology. ONBOOT=yes
ensures the interface activates on startup.
- Set
- Applying Network Changes
- Restart the network service with
sudo systemctl restart network
. - Use
ip a
to verify if the new IP address was applied. - Incorrect configurations may disconnect the system from the network.
- Restart the network service with
- Understanding Multi-Network Interfaces
- Servers can have multiple network interfaces (
eth0
,eth1
). - Each interface may connect to different networks, requiring separate configurations.
- Configuring both correctly allows proper network routing and communication.
- Servers can have multiple network interfaces (
Next in Playlist: 20 Static Configuration in Ubuntu with Netplan