A detailed example of Centos6 network configuration

  • 2020-06-23 02:23:59
  • OfStack

A detailed example of Centos6 network configuration

Preface:

To implement permanent custom IP or to change DNS you need to modify the configuration file, mainly the following configuration file
etc/sysconfig/ ES11en-ES12en/ES13en-ES14en, in which ES15en-ES16en X represents the number of network card, 1 is generally the first block, that is, ES18en-eth0

Below is a description of the configuration project, showing the configuration files for custom IP and DNS


DEVICE=eth0# Network card device name  
TYPE=Ethernet# Card type  
UUID=06c04617-25d9-4a88-aab0-d8f0028f80ca# equipment UUID Serial number  
ONBOOT=yes# Whether to start automatically or not  
NM_CONTROLLED=yes# Whether be NetworkManager management  
BOOTPROTO=none# Type of boot {none|dhcp} 
DEFROUTE=yes 
IPV4_FAILURE_FATAL=yes  
IPV6INIT=no 
NAME="System eth0" # Network name  
HWADDR=08:00:27:E5:F9:B4 #MAC address  
IPADDR=192.168.1.140# The custom ip 
PREFIX=24# Subnet mask  
GATEWAY=192.168.1.1# The gateway  
DNS1=192.168.1.1# The main DNS 
DOMAIN=114.114.114.114 
LAST_CONNECT=1430925668 # The last 1 Subconnection time  

When using DHCP to automatically assign IP, as long as the


BOOTPROTO=none  

Instead of


BOOTPROTO=dhcp 

It is ok

After the modification, run the following command to restart the network service


[root@git network-scripts]# /etc/init.d/network restart 

If you have any questions, please leave a message or go to this site community exchange discussion, thank you for reading, hope to help you, thank you for your support to this site!


Related articles: