Solve the problem centos 7 can not configure a static IP Internet

 

Disclaimer: This article is a blogger original article, follow the  CC 4.0 BY-SA  copyright agreement, reproduced, please attach the original source link and this statement.
This switched: https://blog.csdn.net/weixin_43166531/article/details/83305081

Solve the problem centos 7 can not configure a static IP Internet

Internet has recently been used in learning Linux NAT mode, but after each restart ens33 in the IP will disappear or directly changed, so would like to configure a static IP.
The Internet to find a lot of information after configuring IP network still can not ping, only recently found out that the difference between virtual machines in bridge mode and NAT mode caused, so the next time I recorded a learning experience.

This article seniors to say the difference between the two modes in great detail, I will direct recording method to solve it.

Change the network link in the virtual machine settings to bridge mode, check the physical network connection state replication

Virtual Network Editor to restore the default settings, do not restore normal settings, like auto bridge

Host run → cmd → ipconfig / all, view the IP address, subnet mask, gateway
Here Insert Picture Description

Enter linux vim / etc / sysconfig / network- scripts / ifcfg-ens33 ( this last document as the case may be, may ls to look at on a folder)
change = BOOTPROTO "static"
ONBOOT = "yes" if you net mode can be networked, this should already be a yes
to add the IP subnet mask, gateway
IP and host of the top three same
subnet mask and gateway same as host

Upon completion: wq save and exit, restart the network input systemctl retart network.service

Enter ifconfig or ip ip addr confirm successful configuration

Here Insert Picture Description

Baidu attempt at ping, success!
Here Insert Picture Description

Guess you like

Origin www.cnblogs.com/qiubenming-oracle/p/11598849.html