What is the method for configuring the main network card in CentOS?
To configure the main network card on CentOS, follow these steps:
- Open the terminal and log in to the system with root permissions.
- Open the network configuration file using any text editor by opening the file /etc/sysconfig/network-scripts/ifcfg-eth0.
- Ensure that the following parameters in the file are set correctly:
- Ethernet device name is eth0
Use static IP address
Enable network card on boot
IP address is 192.168.0.100
Subnet mask is 255.255.255.0
Gateway address is 192.168.0.1
DNS server address is 8.8.8.8 - These parameters can be adjusted according to the requirements and actual situation.
- Save the file and exit the editor.
- You can use the following command to restart the network service:
- restart the network using systemctl
- Or perhaps
- Restarting the service network.
- You can check if the network connection is working properly by using the following command:
- Send a request to google.com
- If you can successfully ping through, it means that the network connection is working properly.
The above is the basic method for setting up the main network interface in CentOS, which may vary depending on the specific circumstances.