Objective
Stepping out of the ivory tower, into the company, because all the company's products are Linux, it is necessary for this period of time in their own work machine to learn first. Project code is to use the source insight to view, always CTRL + Alt Che cut off inconvenient, so Xshell appearance. This raises the question of how to configure a static IP in a VMware Linux virtual machine.
Check
Using the company's working machine----system WIN7, first install VMware + rhel-6.5. The following issues occur
Question 1:
The Virtual NIC connection mode (NAT, bridging, etc.) has not been modified, and the virtual network card in win cannot be enabled, either Vmnet0 or Vmnet8.
status : After right-clicking the Enable option, it is automatically disabled after a few seconds. Its virtual machine and host is a one-way ping, specifically the virtual machine----> host is the path.
Workaround:
- Uninstalling two virtual NICs in device management VMnet0 and VMnet8 including their drivers
- Open VMware---> Edit---> Virtual network Editor as Administrator---> Restore default settings
- Just wait
- After the restore succeeds, open the Network Sharing Center to enable VMNET8 (because VMnet8 is NAT)
- What or can not be enabled, that is to enable several times, more than a few times, multi-enabled several times, this method does not know what scientific basis, but it is successful!
I don't know if this is VMware's bug!.
After writing, I hope you can see clearly the description of the problem with yourself is not similar, or waste time can not solve the problem, because the virtual network card is not enabled, and the company is the intranet, first of all, it is to replace the network card connection mode, but also restart the virtual machine, restart the computer, and then secretly took the phone to sacrifice nap time Well! Baidu's most of the solution homogenization, and did not solve, so wasted a day. To summarize this solution, it is hoped that if someone encounters this problem, it can be solved quickly.
Question 2:
Use Xshell to go to ssh virtual machine, do not want to enter the virtual machine every time ifconfig and look at the IP. So the virtual machine has to configure a static IP, eliminating the hassle.
System Redhat, other systems slightly different but roughly the same
Workaround:
- Open VMware---> Edit---> Virtual Network editor--->vmnet8 (NAT) as an administrator, and view the subnet IP, such as my subnet ip:192.168.152.0, can also be modified to the IP you want, In order to conveniently change the third digit (1~255), then the IP, gateway and DNS only need to change the last digit (3~254), do not conflict with other virtual machines.
- Enter Linux (RedHat),Vim/etc/sysconfig/network-scripts/ifcfg-eth
- Modify
Device=eth0 #网卡名
Hwaddr=00:0c:29:16:d4:95 #MAC地址
Type=ethernet #网络类型
uuid=69a73897-d4a4-4c34-be7e-42a20cbf7408
onboot=yes #开机自动挂载
Nm_controlled=yes
bootproto=static #static静态IP DHCP dynamic IP
dns1=192.168.152.2 #DNS (set as gateway IP), can not be the key to the Internet
ipv6init=no #关闭IPV6
ipaddr=192.168.152.65 # IP
netmask=255.255.255.0 # subnet Mask
gateway=192.168.152.2 # gateways (VMware seems to be. 2 for gateways)
4. Restart the network card, service network restart
5. Host and virtual machines ping each other to check
Conclusion:
I hope I can help you!
Configuration of a static IP for a network configuration of a Linux virtual machine in VMware