Home  >  Article  >  Operation and Maintenance  >  Detailed explanation of how to configure static IP in VMware virtual machine under Linux (picture)

Detailed explanation of how to configure static IP in VMware virtual machine under Linux (picture)

黄舟
黄舟Original
2017-05-27 10:16:272705browse

This article mainly introduces how to configure staticIP in [Linux] VMware virtual machine. It has certain reference value. Interested friends can refer to it

Here is a detailed explanation of how to configure a static IP in a VMware virtual machine.


The above picture is a sketch that roughly explains the VMware network situation. A network segment refers to a certain IP range. For example, one community building and another community building are not the same network segment.

If you are in community A and your girlfriend is in community B, you need to contact her if you want to. through the gateway. Your gay friend lives next door to you, so you don’t need to go through a gateway to communicate with him. VMware

simulates the gateway for us, so when we configure it, we need to set the network IP according to the VMware virtual machine. We configure windows and Linux in the same network segment.

1. View the gateway and network segment

[Edit]--》[Virtual NetworkEditor]

We use NAT mode, so choose VMnet8. Uncheck the [Use local DHCP] service option. This is to dynamically allocate IP. Click NAT Settings.

The gateway IP needs to be remembered. Through this we know that our gateway is 192.168.133.2 and the subnet mask is 255.255.255.0. The subnet IP of 192.168.133.0 means

If you want to add a machine to this network segment, your machine IP can only be in the range of 192.168.133.0~192.168.133.255. In fact, you will find that 192.168.133.2 is the gateway IP. Generally speaking, 192.168.133.255 is a broadcast IP so it is not used. 192.168.133.0 is generally a network segment IP and is not used. That is to say, except for the three numbers 0 2 255, you can set the other

numbers at will.

2. Set the virtual machine IP

Involved file list:

/etc/sysconfig/network-scripts/ifcfg-eth0 (network card), /etc/sysconfig/network (hostname), /etc/resolv.conf (DNS).

Network card information modification: vi /etc/sysconfig/network-scripts/ifcfg-eth0

##ONBOOT: Start at boot.

NM_CONTROLLED: Whether the network management component is enabled. The streamlined version does not have this component. So there is no need to turn it on.

BOOTPROTO: network allocation method, static.

IPPADDR: Manually specify the ip address.

NETMASK: Subnet mask.

GATEWAY: Gateway ip. After editing, save

Exit

.

DNS configuration: vi /etc/resolv.conf

nameserver: The corresponding dns domain name resolution should be filled in here The server's ip. But I didn’t know what to fill in, so I filled in the gateway address. I can download things online, but

seems to be unresponsive when I ping www.baidu.com. I don’t know what’s going on, because it doesn’t affect my internet connection

Update

, so I didn’t pay attention to it.

Host name modification: vi /etc/sysconfig/network

If necessary, modify the host name. If not, forget it. . After configuring the above three files, restart the machine.

3. Use remote tools to connect

1. The Xshell tool is used here. The ip address is set to the ip address filled in above. In the future, the ip of this machine It's all him.

#2. Click OK. This will appear when you connect for the first time. Just confirm.

#3. Enter the user name. The machine you just installed

has only one root user. First log in as root

user.

#4. Enter the password. I like all users to have the same password, so that I only need to fill in the username to log in in the future. Password needs to be remembered.

#5. After logging in, you can play casually.

4. Windows IP settings

1. Set the network adapter configured by VMWare for us, which is the NAT8. Right-click Properties

2, select IPV4, and click Properties.

3. Set the ip address. From now on, Windows will have this IP. The IP network segment range needs to be within the range given to us by the VMWare virtual machine.

5. Special Tips

#If you close the VMWare virtual machine, there will be an option to run it in the background. . In this way, the virtual machine hangs in the background, and it feels like connecting to a remote machine, which is great!

The above is the detailed content of Detailed explanation of how to configure static IP in VMware virtual machine under Linux (picture). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn