CentOS 7 Network Configuration Guide

To configure network interfaces and parameters, you can follow the steps below:

  1. Open the terminal and enter the following command to edit the network configuration file:
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0

The eth0 here refers to the network card name and should be replaced with the corresponding network card name based on the actual situation.

  1. In editing mode, you can add or modify the following parameters to configure the network interface:
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4

The meanings of the parameters here are as follows:

  1. Device: Network card name
  2. BOOTPROTO: IP address acquisition method, can be selected as static or dynamic.
  3. ONBOOT: Whether to start automatically when the system boots up.
  4. IPADDR: Internet Protocol Address
  5. NETMASK: subnet mask
  6. Gateway: the address of the gateway.
  7. DNS1 and DNS2: Addresses of DNS servers.
  1. Save and exit editing mode, then reboot the network service using the following command to apply the configuration changes:
sudo systemctl restart network

By following the steps above, you can successfully configure the network interface and network parameters. Please modify the corresponding configuration information according to the actual situation.

bannerAds