When using CentOS system, we may feel that some settings are not suitable for them, although not cause big mistake, but it does give us a lot of small trouble, here I come to give you some suggestions, change it your DNS, gateway, and IP address. Then we explain how to modify it!
1, CentOS modify the DNS system to modify the corresponding network card DNS configuration file # vi /etc/resolv.conf modify the following nameserver 8.8.8.8 #google domain name server nameserver 8.8.4.4 #google domain name server 2, CentOS system modifications gateway to modify the corresponding card the gateway configuration file [root @ centos] # vi / etc / sysconfig / network modify the following NETWORKING = yes (indicate whether the system is using the network, usually set to yes. If set to no, you can not use the network, and many system services the program will not start) hOSTNAME = CentOS (set the host name of the machine, corresponding to the hostname be provided here and / etc / hosts set) the gATEWAY = 192.168.1.1 (gateway is provided connected to the machine's IP address. For example, gateway 10.0.0.2) . 3, the IP address of the CentOS system modifies the configuration file corresponding to the modified NIC IP address # vi / etc / sysconfig / network -scripts / ifcfg-eth0 modify the following dEVICE = eth0 # corresponding to the description of the card device alias, e.g. ifcfg-eth0 file it as eth0
Way BOOTPROTO = static # set ip address of the network card, possible options for the static, dhcp or bootp, corresponding to the specified static ip address, obtained by ip address dhcp protocol, obtained by ip address bootp protocol
BROADCAST = 192.168.0.255 # corresponding subnet broadcast address
HWADDR = 00: 07: E9: 05: E8: B4 # corresponding network card physical address
IPADDR = 12.168.1.2 # If the network card ip address static manner specified, this field will specify the NIC ip address corresponding
IPV6INIT = NO
IPV6_AUTOCONF = NO
nETMASK corresponding NIC # = 255.255.255.0 network mask
nETWORK = 192.168.1.0 # card corresponding network addresses
when ONBOOT = yes # network interfaces this system is set at startup, set to yes activate this device during system startup
4, restart the network configuration service network restart /etc/init.d/network restart or modify the IP address with immediate effect: ifconfig eth0 192.168.0.2 255.255.255.0 Netmask start to take effect: modify / etc / sysconfig / network-scripts / ifcfg-eth0 modify gateway default gateway immediate effect: route the Add default gw 192.168.0.1 dev eth0
Start to take effect:
modify / etc / sysconfig / network
Modify DNS
modify /etc/resolv.conf
after modification can take effect immediately, starting as effective
to modify host name
with immediate effect:
hostname centos1
start to take effect:
modify / etc / sysconfig / network
CentOS system, we finished modifying DNS, gateway, IP address, restart the network configuration, we can see the effects.
1, CentOS modify the DNS system to modify the corresponding network card DNS configuration file # vi /etc/resolv.conf modify the following nameserver 8.8.8.8 #google domain name server nameserver 8.8.4.4 #google domain name server 2, CentOS system modifications gateway to modify the corresponding card the gateway configuration file [root @ centos] # vi / etc / sysconfig / network modify the following NETWORKING = yes (indicate whether the system is using the network, usually set to yes. If set to no, you can not use the network, and many system services the program will not start) hOSTNAME = CentOS (set the host name of the machine, corresponding to the hostname be provided here and / etc / hosts set) the gATEWAY = 192.168.1.1 (gateway is provided connected to the machine's IP address. For example, gateway 10.0.0.2) . 3, the IP address of the CentOS system modifies the configuration file corresponding to the modified NIC IP address # vi / etc / sysconfig / network -scripts / ifcfg-eth0 modify the following dEVICE = eth0 # corresponding to the description of the card device alias, e.g. ifcfg-eth0 file it as eth0
Way BOOTPROTO = static # set ip address of the network card, possible options for the static, dhcp or bootp, corresponding to the specified static ip address, obtained by ip address dhcp protocol, obtained by ip address bootp protocol
BROADCAST = 192.168.0.255 # corresponding subnet broadcast address
HWADDR = 00: 07: E9: 05: E8: B4 # corresponding network card physical address
IPADDR = 12.168.1.2 # If the network card ip address static manner specified, this field will specify the NIC ip address corresponding
IPV6INIT = NO
IPV6_AUTOCONF = NO
nETMASK corresponding NIC # = 255.255.255.0 network mask
nETWORK = 192.168.1.0 # card corresponding network addresses
when ONBOOT = yes # network interfaces this system is set at startup, set to yes activate this device during system startup
4, restart the network configuration service network restart /etc/init.d/network restart or modify the IP address with immediate effect: ifconfig eth0 192.168.0.2 255.255.255.0 Netmask start to take effect: modify / etc / sysconfig / network-scripts / ifcfg-eth0 modify gateway default gateway immediate effect: route the Add default gw 192.168.0.1 dev eth0
Start to take effect:
modify / etc / sysconfig / network
Modify DNS
modify /etc/resolv.conf
after modification can take effect immediately, starting as effective
to modify host name
with immediate effect:
hostname centos1
start to take effect:
modify / etc / sysconfig / network
CentOS system, we finished modifying DNS, gateway, IP address, restart the network configuration, we can see the effects.
Reproduced in: https: //my.oschina.net/cjkall/blog/195878