Centos manual IP and DNS configuration, centosipdns
Set IP addresses manually
If the virtual machine cannot automatically obtain the IP address, you can only manually configure it as follows:
Enter the command
# Vi/etc/sysconfig/network-scripts/ifcfg-eth0 [edit Nic configuration file]
Enter the preceding command and press enter to open the configuration file. Use the arrow key to move the cursor to the last line. Press "O" to enter the editing mode. Enter the following content:
IPADDR = 192.168.4.10
NETMASK = 255.255.255.0
GATEWAY = 192.168.4.1
In addition, move the cursor to the line "ONBOOT = no" and change it to ONBOOT = yes.
"BOOTPROTO = dhcp", changed to BOOTPROTO = none
After that, press the ESC key in the upper left corner of the keyboard. Enter wq in the lower left corner of the screen and press enter to save the configuration file.
Restart the network service. The command is
# Servicenetwork restart
After the network is restarted, the ip address of eth0 takes effect. Run the command # ifconfigeth0 to view
Next, check whether the configured IP address can be pinged. On the physical machine, use the shortcut key WINDOWS + R to open the run box, enter the command cmd, and enter ping 192.168.4.10. ping indicates that the IP address is correctly configured.
Note: The network segment of my physical machine is 192.168.4.0. During the experiment, you can set up your own environment to keep the virtual machine and the physical machine in the same network segment.
1. modify the configuration file vi/etc/resolv. conf.
Ii. Modify by format
nameserver 8.8.4.4nameserver 8.8.8.8
Modify the Domain Name System IP address of Google in the preceding format. Save the modification and the modification takes effect.
In Guangdong, this is 202.96.128.86.