What are the steps for configuring the network in CentOS 7?

The steps to configure the network on CentOS 7 are as follows:

  1. Open the terminal and log in as root user.
  2. Edit the network configuration file. Use the following command to open the network configuration file:
  3. Open the file ifcfg-eth0 located in the network-scripts directory.
  4. ifcfg-eth0 is the default network card configuration file, and if you are using a different network card, you need to modify the file name accordingly.
  5. Configure the IP address. Add or modify the following lines in the file, according to your network configuration.
  6. BOOTPROTO is set to static with the IP address 192.168.1.100, subnet mask 255.255.255.0, gateway 192.168.1.1, and DNS servers configured as 8.8.8.8 and 8.8.4.4.
  7. IPADDR is the IP address you want to set, NETMASK is the subnet mask, GATEWAY is the gateway address, and DNS1 and DNS2 are the DNS server addresses.
  8. Set the network device name. Add or modify the following lines in the file to set the network card device name as eth0:
  9. Ethernet device=eth0
  10. If you are using a different network card device, you need to modify the device name accordingly.
  11. Save and close the file. Hit the Esc key, then type :wq, then press Enter to save and exit the vi editor.
  12. Restart the network service. Use the following command to restart the network service to apply the configuration:
  13. Restart the network service using systemctl.

After completing the above steps, the network configuration of your CentOS 7 system will be updated to the specified IP address and other settings.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds