How to modify network card configuration file in CentOS?
You can modify the network card configuration file in CentOS by following these steps:
- Login to the CentOS system as the root user.
- Open the network card configuration file with any text editor, such as using the vi editor.
vi /etc/sysconfig/network-scripts/ifcfg-eth0
Here, eth0 is the name of the network card, modify it according to your own situation.
- The following parameters can be modified in the opened network card configuration file:
- BOOTPROTO: Used to configure the network settings, can be set to static (static IP) or dhcp (dynamic IP).
- IPADDR: used to configure a static IP address.
- NETMASK: Used to configure the subnet mask.
- GATEWAY: Used to configure the gateway address.
- Modify the values of the parameters above as needed and save the file.
- Restart the network service to apply the configuration.
service network restart
You have successfully modified the network card configuration file for CentOS. Please be aware that after modifying the configuration file, you may need to restart the network service or the system for the changes to take effect.