1. Modify DNS
Modify the DNS configuration file of the corresponding Nic
VI/Etc/resolv. conf
Content format (xigong University)
; Generated by/sbin/dhclient-Scriptnameserver114.114.114.114Nameserver202.117.80.2Nameserver202.117.80.3Nameserver202.117.80.200
2. Modify the Gateway
VI/Etc/sysconfig/Network
Modify the following content
Networking =Yes (indicates whether the system uses the network, which is generally set to yes. If it is set to no, the network cannot be used, and many system service programs cannot be started.) hostname= Centos (set the Host Name of the local machine. The host name and/etc/The host name set in hosts corresponds to) Gateway=192.168.1.1(Set the IP address of the gateway connected to the local machine. For example, the gateway is 10.13.32.1)
3. Specify the IP address
VI/Etc/sysconfig/network-scripts/ifcfg-eth0
Make sure the specified IP address does not conflict.
Device = eth0 # describe the device alias corresponding to the NIC, for example, ifcfg- In the eth0 file, it is eth0bootproto = Static # Set the way for the NIC to obtain the IP address. The possible options are static, DHCP or BOOTP, which correspond to the IP address specified at the static state, the IP address obtained through the DHCP protocol, and the IP address obtained through the BOOTP protocol. Hwaddr = 00 : 07 : E9: 05 : E8: B4 # physical IP address of the corresponding network adapter ipaddr = 10.13 . 32.123 # If you set the method for obtaining the IP address from the NIC to static, this field specifies the IP address of the NIC.Gateway = 10.13.32.1 # Gateway
Netmask =255.255.255.0# Network mask corresponding to the NIC
Prefix = 24
Defroute = Yes
Ipv6init = No1_6_autoconf = No Onboot = Yes
Type = Ethernet
Nm_controlled = Yes
Centos DNS modification, fixed IP, and other operations