Set static IP for virtual machine centos7

In the virtual machine menu bar, select Edit → Virtual Network Editor, open the virtual network editor dialog box, select the Vmnet8 Net network connection method, set the subnet IP, click the NAT settings page, view the subnet mask and gateway, and modify the static IP later Will use
Insert picture description here
Insert picture description here

Check the host VM8 network card settings,
open the network sharing center, change the adapter options,
Insert picture description here
edit vmware8 properties,
Insert picture description here
here the subnet mask and default gateway need to be consistent with the settings just now
Insert picture description here

Enter the virtual machine to modify the network configuration file.
View the ip and network card name
Insert picture description here
vi /etc/sysconfig/network-scripts/ifcfg-your network card name.
Here my network card is named ens33
, so enter:
vi /etc/sysconfig/network-scripts/ifcfg -ens33

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static" #启用静态IP
IPADDR="192.168.130.128" #设置IP地址
NETMASK="255.255.255.0" #设置子网掩码
GATEWAY="192.168.130.2" #设置网关
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="32ab8b79-b059-4fa3-8c3a-bcf1fd596f02"
DEVICE="ens33"
ONBOOT="yes" #开机自启

Set DNS
vi /etc/resolv.conf
Set gateway address

nameserver 192.168.130.2

Restart network service

service network restart

That's it!

Guess you like

Origin blog.csdn.net/weixin_42494845/article/details/108796090
Recommended