Centos7 setting Solution can not be a static IP Internet

Installed in VMWare virtual machine CentOS7 local operating systems, dynamic IP addresses change frequently, after setting a static IP address, the local LAN can visit each other, but CentOS7 system can not access the Internet, follow these steps to resolve this problem.

1, the system administrator to open VMWare

Here Insert Picture Description

2. Select the Virtual Network Editor menu

Here Insert Picture Description

3, select this line VMnet8

Here Insert Picture Description

4, restore default settings VMnet8

Here Insert Picture Description

5, modify the parameters of VMnet8

Here Insert Picture Description

VM subnet IP addresses and subnet mask of your own to be, if you are unskilled, will be set according to the contents of the image above is not a problem.

6, NAT settings

Here Insert Picture Description

Here Insert Picture Description

7. Save Settings

Here Insert Picture Description

8. Verify that the virtual NAT mode

Here Insert Picture Description

9, start the virtual machine CentOS7

10, do not set a static IP address of CentOS7

Modify the virtual machine network card configuration files such as / etc / sysconfig / network-scripts / ifcfg-ens33, note that the file name is not necessarily the ifcfg-ens33, determined according to your situation.

1) modify BOOTPROTO parameters, the protocol was changed to a static IP address mode.

BOOTPROTO=static  # dhcp-动态分配,static-静态分配(重要)。

2) modify ONBOOT parameters, the start-up ONBOOT option set to yes.

ONBOOT=yes  # 是否开机引导。

3) Set IP DSN server, add the following content.

DNS1=114.114.114.114  # 第1个DSN服务器的IP地址。
DNS2=1.2.4.8  # 第2个DSN服务器的IP地址。

4) Set the IP address, subnet mask and gateway parameters CentOS7, add the following.

IPADDR=192.168.226.128  # IP地址(重要)。
NETMARSK=255.255.255.0  # 子网掩码(重要)。
GATEWAY=192.168.226.2   # 网关(重要)。

11, restart CentOS7 network services

systemctl restart network

12, test results

ping about Baidu.

Here Insert Picture Description

ok。

13 Notes

If you are not familiar with the network knowledge, or virtual machines are not familiar with, as recommended by this article Yihuhuhuapiao, copy parameters.

14, Copyright

C Language Technology Network original article, reproduced please indicate the source link to the article, the author and original.
Source: C Language Technology Network (www.freecplus.net)
Author: Ethics code Agriculture

If the article typos, or content errors, or other suggestions and comments, please correct me message, thank you very much! ! !

Guess you like

Origin www.cnblogs.com/wucongzhou/p/12588705.html
Recommended