VMware Network Mode settings (the simplest article)

Source: Internet
Author: User
Tags nameserver dns forwarder

VMware provides four Network Connection Methods
========================================================== ========================
Bridge: This method is the simplest. You can directly bridge the virtual network card to a physical network card. It is similar to binding two different addresses to the next network card in Linux. In fact, you can set the network card to the hybrid mode, this allows you to listen on multiple IP addresses.

In this mode, the network card (for example, eth0 in Linux) inside the virtual machine is directly connected to the network where the physical network card is located. It can be imagined that the virtual machine and the host machine are in the same status, the network relationship is equal, and no one is behind it.

This method is easy to use, provided that you can get more than one address. it is not suitable for users who want to conduct various network experiments, because you cannot control the network of the virtual machine and it goes out directly.

Nat mode: In this mode, a virtual Nic vmnet8 (by default) appears inside the host. If you have experience as a NAT server, the vmnet8 here is equivalent to the NIC connected to the Intranet, the Virtual Machine itself is equivalent to a machine running on the Intranet, and the network adapter (eth0) in the virtual machine is independent of vmnet8.

In this way, the DHCP service provided by VMware is loaded to the vmnet8 interface by default, so that the virtual machine can use the DHCP service. more importantly, VMWare provides Nat services and provides address translation from vmnet8 to the Internet. Therefore, a real Nat server is running, it is only for virtual machines. obviously, this method is suitable if you only have one Internet address.

Hostonly:
This should be the most flexible method. If you are interested, you can conduct various network experiments. the only difference with Nat is that there is no address translation service in this mode. Therefore, by default, virtual machines can only access the host, which is also the name of hostonly. by default, a DHCP service is also loaded to vmnet1. in this way, the VM connected to vmnet8 can still be set to DHCP to facilitate system configuration.

Is there no way to connect to the Internet in this way? Of course not. In fact, this method is more flexible. You can use your own method to achieve the best configuration, for example:
A. Use your own Dhcp Service: First stop the DHCP service provided by VMware to make the DHCP service more unified.
B. Use your own Nat to facilitate the addition of the firewall. There are many Nat methods for Windows host, such as Internet sharing for Windows XP and complex Nat services for Windows Server.
C. Use your own firewall. Because you have full control over vmnet1, you can add (or test) a firewall between the network card of vmnet1 and the Internet.

As you can see from the above, the hostonly mode is similar to the normal Nat server with the entire intranet, so you can easily conduct relevant experiments, such as setting a strong fire prevention.

1. Bridge Mode (everything is the same as host, only the IP address cannot be the same as host)
IP 192.168.39.222
Netmask: 255.255.252.0
Gateway: 192.168.39.254
Primary nameserve: 192.168.39.252

2. Nat Mode
First, check the vmnet8 IP address (e.g. 192.168.255.1) in the host ).
Start VMWare, and click Edit virtual network setting... , The virtual network editor dialog box is displayed;
View the NAT tab and record the NAT gateway IP Address: 192.168.255.2
In config, enter:
IP: 192.168.255.5 (different addresses in the same CIDR block as 192.168.255.1)
Netmask: 255.255.255.0 (same as the password of 192.168.255.1)
Gateway IP: Enter the NAT Gateway 192.168.255.2 in VMware.
Primary nameserver: Enter the NAT Gateway 192.168.255.2 in VMware.

 

---------------------------------------------- Detailed Nat settings -------------------------------------------------------

 

Follow these steps:
1. Open VMWare, double-click Ethernet in the devices area, and select "Nat ".

2. in VMware, edit-> virtual network settings. The settings shown in the following two figures indicate that vmnet8 is enabled. When vmnet8 is enabled, the VMware software virtualizes a network switch with a DHCP function and serves as a NAT server.

Note the gateway IP address in the second figure vmnet8.

 

3. Open the Linux Virtual Machine and log on to the system with the root account. If the graphic interface is used, press "CTRL + ALT + F1" to switch to the terminal command line mode.

4. Set the Host Name and default gateway (open the/etc/sysconfig/network file in the VI editor)

[Root @ hostname root] # vi/etc/sysconfig/Network

Follow the settings. Note that the hostname is set to daquan.wang.com. After the configuration is complete, the hostname is changed to Daquan after the machine is restarted.

5. Set Nic parameters (open the/etc/sysconfig/network-scripts/ifcfg-eth0 file in the VI editor)

[Root @ hostname root] # vi/etc/sysconfig/network-scripts/ifcfg-eth0

Follow the settings.

6. Set the IP address of the DNS host (open the/etc/resolv. conf file in the VI editor)

[Root @ hostname root] # vi/etc/resolv. conf

You do not need to set the IP address. If the IP address is not set as follows, the IP address of vmnet8 is automatically set to DHCP when the machine is restarted, nameserver acts as the DNS server in windows. This setting is similar to the DNS forwarder in Windows Domain environment. It means that this address will automatically forward DNS queries to the host's DNS.

7. Restart network settings
Because the/etc/sysconfig/network file has been changed, restart the VM according to the following three commands. If not, reboot the VM.

See

Bytes ----------------------------------------------------------------------------------------------------------------

 

3. hostonly Mode
(1) view the attributes of your Nic connected to the Internet, select the "advanced" label, set to allow sharing, and set the allowed network interface to vmnet1

(2) Check the attributes of your vmnet1 instance and the settings of the TCP/IP protocol.

192.168.0.1/255.255.255.0,

(3) The settings in windows are completed and transferred to the virtual machine running Linux. Set your eth0 IP address to static (if no static IP address is selected during installation ).

Press the Red Hat icon-> system settings-> network (or other methods you know)
IP: 192.168.0.2 (or other addresses on this network segment)
Netmask: 255.255.255.0
Default Gateway: 192.168.0.1 (vmnet1 address)
DNS: enter your own DNS (the DNS used in the host)
Save settings. If you have not set the Host Name:
CD/etc/sysconfig
VI Network
Edit hostname
CD/etc
VI hosts
Join:
192.168.0.2 yourhostname
Restart the service
Su
/Sbin/service network restart
(4) test
Gateway: Ping 192.168.0.1
DNS: Ping dnsserver

==================================
(1) bridged Mode
In this way, the IP address of the virtual system can be set to the same network segment as the local system. The virtual system is equivalent to one in the network. an independent machine is inserted in a hub together with the local machine. Other machines in the network can access the virtual system, and the virtual system can also access other machines in the network, of course, it is not a problem with the two-way access of the local system.

(2) Nat
This method can also achieve two-way access between the local system and the virtual system. however, other machines in the network cannot access the virtual system. The virtual system can use the NAT protocol to access other machines in the network. nat-Based IP Address Configuration method: the virtual system uses DHCP to automatically obtain the IP address. VMWare services in the local system assigns an IP address to the virtual system. If you want to use a fixed IP Address at each start, set this IP address directly in the virtual system.

(3) Host-only mode
As the name suggests, this method only supports Network Communication between virtual machines and hosts. Other machines in the network cannot access the virtual system or other machines.

(4) not use method
The Virtual System is a single machine.

In general, the bridged method is the most convenient and easy to use. however, if the local system is Win2000 and the network cable is not plugged in (or there is no nic at all), the Network is likely to be unavailable (most of the machines with PCI Nic ), in this case, you can only use the NAT mode or host-only. The two virtual NICs mentioned previously are prepared to adapt to the two network types.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.