For some reason, if you want to perform a test in a virtual machine and require a fixed IP address, record this process. 1. obtain your GATEWAY first, so that you can use the menu bar Edit-& gt; VirtualNetworkEditor to select VMnet8 in cento system configuration. click NATSettings to view the GATEWAY address. the GatewayIP here is 192.168
For some reason, if you want to perform a test in a virtual machine and require a fixed IP address, record this process.
1. first obtain your GATEWAY for later use in cento system configuration
Choose Edit> Virtual Network Editor from the menu bar.
Select VMnet8 and click NAT Settings to view the GATEWAY address. The Gateway IP address here is 192.168.110.2.
Next, you can go to the topic.
2. set the CentOS static IP address:
Three configuration files are involved:
/Etc/sysconfig/network
/Etc/sysconfig/network-scripts/ifcfg-eth0
/Etc/resolv. conf
A. First modify/etc/sysconfig/network as follows:
Specify the Gateway address.
B. Then modify/etc/sysconfig/network-scripts/ifcfg-eth0:
[Html]View plaincopy
- DEVICE = "eth0"
- # BOOTPROTO = "dhcp"
- BOOTPROTO = "static"
- IPADDR = 192.168.110.129
- NETMASK = 255.255.255.0
- HWADDR = "00: 0C: 29: 53: A8: 1D"
- IPV6INIT = "no"
- NM_CONTROLLED = "yes"
- ONBOOT = "yes"
- TYPE = "Ethernet"
- UUID = "f933b2bf-47eb-42f3-bea9-1f54088a2cb7"
- DNS1 = 192.168.110.2
C. finally, configure/etc/resolv. conf: (in fact, this step can be omitted. after the DNS Server address is set above, the system will automatically modify this configuration file .)
[Html]View plaincopy
- # Generated by NetworkManager
- Nameserver 192.168.110.2
After a few steps, the IP address of the VM is 192.168.110.129.
After the IP address is fixed, you can set the host