Detailed examples of Centos6 network configuration
**Foreword: **
To achieve permanent custom IP or change DNS, you need to modify the configuration file, mainly modify the following configuration files
/etc/sysconfig/network-scripts/ifcfg-ethX, where X in ifcfg-ethX represents the number of network cards, usually the first one, which is ifcfg-eth0
The following is an explanation of the configuration items, here is the configuration file of custom IP and DNS
DEVICE=eth0#Network card device name
TYPE=Ethernet#Network card type
UUID=06c04617-25d9-4a88-aab0-d8f0028f80ca#Device UUID number
ONBOOT=yes#Whether to start automatically
NM_CONTROLLED=yes#Is it managed by NetworkManager
BOOTPROTO=none#Type of startup{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#Custom ip
PREFIX=24#Subnet mask
GATEWAY=192.168.1.1#Gateway
DNS1=192.168.1.1#Primary DNS
DOMAIN=114.114.114.114
LAST_CONNECT=1430925668 #Last connection time
When using DHCP to automatically assign IP, just change
BOOTPROTO=none
To
BOOTPROTO=dhcp
That's it
After 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 the community of this site to discuss, thank you for reading, hope to help you, thank you for your support to this site!
Recommended Posts