Assume that the NIC to be configured is eth0
1. edit the file:/etc/sysconfig/network-scripts/ifcfg-eth0, modify the values of the following items
Bootproto = static # If the IP address is obtained dynamically, the value of bootproto is DHCP.
Ipaddr = 192.168.1.100 # static address based on your network settings
Netmask = 255.255.255.0
# Subnet mask, set according to Network
Gateway = 192.168.1.1 # set according to Network
Dns1 = xx. xx # DNS address.
The other values remain unchanged.
2. a dns address is configured above. You can also configure the RedHat DNS address to edit the file:/etc/resolv. conf and add:
Nameserver xx. xx
If there are more than one, add multiple lines!
/Etc/resolv. the conf file will be overwritten when the network is restarted, and the added nameserver will be deleted. You can modify chattr + I/etc/resolv. conf to add attributes to the file and cannot be modified (I do not know what else to ensure
Files are not modified)
3. ifdown eth0, IFUP eth0 restart Nic
/Etc/init. d/network restart the network