Home > OS >  7 virtual machine CentOS setting fixed IP explanation
7 virtual machine CentOS setting fixed IP explanation

Time:09-28


1, laptop host IP is set to automatically, no matter what circumstances, is not affected by the virtual machine, as long as the network can be normal access to the Internet;


2, as long as the laptop host can be normal access network, start the virtual machine CentOS system can be normal access to the network, no need to make any Settings;


3, the virtual machine is set to a fixed IP, no matter what host in the network environment, is broken network environment, or connect to any network segment access to the network environment, the virtual machine's IP are fixed, and use the terminal connection, constant, a normal connection;


4, the virtual machine fixed IP can be in accordance with the optional Settings that you want to set the IP address of the segment, such as I wanted to set a fixed IP as 192.168.2.2,


The above 4 points, I didn't find a online posts can achieve the result that I ask, after I this period of time to study, through various attempts, problems during and after test stability, summarized below to share to you, hope to be of help, little detours,


By way of NAT mode + fixed IP mode,


Configuration environment description: host for Win10 home edition, the virtual machine VMware Workstation 12 Pro Chinese version, the virtual machine in 7 64 - bit Linux system for CentOS,


1. Set the virtual machine network connection mode:


According to the following figure set, ck in English can








2. The virtual machine configuration of NAT model specific address parameters:


(1) the editor - virtual network editor - change the Settings





(2) choosing VMnet8, uncheck the use local DHCP - set subnet IP, gateway IP Settings (behind remember setting here, want to use), the following figure


Note: modify the subnet IP Settings, set free fixed IP, if you want to set a fixed IP as 192.168.2.2-255, such as 192.168.2.2, IP subnet for 192.168.2.0; If you want to set a fixed IP of 192.168.1.2 instead - 255, 192.168.1.2 instead, for example, the IP subnet is 192.168.1.0;





(3) the gateway IP can be modified with reference to the following format: 192.168.2.1








3. Configure laptop host specific VMnet8 local address parameters:





Note: IP address arbitrarily set in step 6, but make sure not to set up the virtual machine with you fixed IP,








4. Changes in the virtual machine CentOS 7 system for fixed IP configuration file:


(1) to centos7 command-line interface, modify the following content:


# CD/etc/sysconfig/network - scripts/
# vi ifcfg - eno16777736







Description:


# the IPV6... . Agreements are comments;
BOOTPROTO=# static boot protocol, DHCP and static;
ONBOOT=yes # set to start boot;
DNS1=114.114.114.114 # this is domestic DNS address, is fixed;
IPADDR=192.168.2.2 # you want to set a fixed IP, theoretically 192.168.2.2-255 can be, please make your own validation;
NETMASK=a subnet mask 255.255.255.0 #, do not need to be changed;
GATEWAY=# 192.168.2.1 GATEWAY, here is your in "2. Configure NAT model specific address parameters of the virtual machine" (2) choose VMnet8, uncheck the use of local DHCP - set subnet IP, GATEWAY IP Settings,

(2) restart the network service


The service network restart




5. Test configuration success


(1) to examine the modified fixed IP as 192.168.2.2, configuration is correct;


The ifconfig




7 (2) test in the virtual machine CentOS system whether can connect outside network, data back, that can connect to the network;


Ping www.baidu.com




(3) to test whether the machine can ping virtual machine fixed IP data back, that you can use the normal connection terminal tool;


Right mouse on the start menu, select the command prompt (administrator), open a command interface:


Ping 192.168.2.2







6. A remote terminal connection


(1) have a problem, if the connection fails because CentOS 7 firewall port is not open, such as open 80330 port, the final must restart the firewall;


# to check the firewall status
Systemctl status firewalld
# open port 80
Firewall - CMD - zone=public - add - port=80/TCP - permanent
# open port 3306
Firewall - CMD - zone=public - add - port=3306/TCP - permanent
# restart the firewall:
Firewall - CMD - reload

(2) the connection is successful








Result all the above requirements, and can completely from the virtual machine CentOS 7 as a server, deploy a variety of services on!!!
  • Related