CentOS7 static IP online settings tutorial in virtual machine, centos7 online settings
The following describes how to configure the network connection of the centos 7 system in the vmwarevm.
Step 1: in VMware, click "edit"-"Virtual Network Editor". For example, I chose the NAT mode:
Click Change settings in the lower-right corner, select NAT mode, and deselect the "use local DHCP service to allocate IP addresses to virtual machines" option to set the subnet IP address. The subnet IP address and Host ip address must not be in the same address range. Otherwise, even if the VM can access the Internet, the network is slow and unstable. The ip address segment of my host is 192.168.0.xxx, So I configured 192.168.32.xxx to avoid the ip address segment of the host. The third ip address number is from 0 to 254 and is not 0. The NAT mode is equivalent to configuring a sub-router. Some friends who have set too many levels of routes should be aware of this. You can configure a subnet IP address based on the ip address of your machine. Details are shown in
Click the "NAT Settings" button in the interface to view the virtual machine's gateway. This gateway will be used in step 3. The gateway here is 192.168.32.2.
Step 2: edit the file/etc/sysconfig/network-scripts/ifcfg-eno16777736 with root permissions, the effect is as follows:
TYPE = Ethernet
BOOTPROTO = static # Set static IP
DEFROUTE = yes
20174_failure_fatal = no
IPV6INIT = yes
IPV6_AUTOCONF = yes
Required 6_defroute = yes
20176_failure_fatal = no
NAME = eno16777736
UUID = 4f40dedc-031b-4b72-ad4d-ef4721947439
DEVICE = eno16777736
ONBOOT = yes # If no, change to yes, indicating that the NIC device is automatically started.
PEERDNS = yes
PEERROUTES = yes
IPV6_PEERDNS = yes
20176_peerroutes = yes
20176_privacy = no
GATEWAY = 192.168.32.2 # the GATEWAY address here is the GATEWAY address obtained in step 1.
IPADDR = 192.168.32.150 # configure the ip address. If the ip address configured in step 2 is in the range of 192.168.32.xxx, set it to 150 as long as it is not the same as the gateway.
NETMASK = 255.255.255.0 # Subnet Mask
DNS1 = 8.8.8.8 # dns Server 1. Enter the available dns server address in your network.
DNS2 = 223.5.5.5 # dns Server 2
The key parameters are marked with colored shading. Keep the default values for others. Save and exit after confirming they are correct.
Step 3: restart the NIC service, execute service network restart, and then access the Internet: You can ping Baidu's domain name to check whether the connection is successful.