2 thoughts on “Urgent !!!!!! Network settings about virtual machines”

  1. In many cases, computer enthusiasts need to have a network environment to learn the installation and settings of online servers, hacking and defense technology, etc., but often most amateur computer enthusiasts do not have such conditions. The appearance of virtual machine software VMware makes us You can get a very efficient and practical network experimental platform at a very low price. However, the network settings of VMware virtual machines have always been confused by many beginners. They often see people seeking related VMware network settings on major computer forums. Although there are many articles on the Internet, although there are many articles on the Internet, it is often not complete, or it is too professional, so that beginners are still a cloud and mist after reading. After all kinds of articles and VMware software documents, combine their own experience to organize these contents, and try to explain the setting process of VMware virtual machine network.
    n Taking the installation and network settings of the Linux platform as an example to illustrate the installation and network settings of VMware.

    . Installation of VMware

    1, get VMware

    can download the trial version of VMware on the Internet. Many Linux sites can be downloaded.

    The websites with VMware downloaded:

    addr: 127.0.0.1 Mask: 255.0.0.0

    up loopback running MTU: 16436 Metric: 1

    RX Packets: 454 ERRRORS: 0 Dropped: 0 OverRuns: 0 Frame: 0
    N TX Packets: 454 Errs: 0 Droppedd : 0 overruns: 0 carrier: 0

    : 0: 0

    Rx bytes: 33512 (32.7 kb) tx bytes: 33512 (32.7 kb)
    r n  vmnet1 Link encap:Ethernet HWaddr 00:50:56:C0:00:01 rn  rn  inet addr:192.168.221.1 Bcast:192.168.221.255 Mask:255.255.255.0rn  r N UP Broadcast Running Multicast MTU: 1500 Metric: 1

    RX Packets: 191 Errors: 0 Dropped: 0 OverRuns: 0 Frame: 0
    N TX Packets: 63 Errors: 0 Dropped: 0 OverRuns: 0 Carrier: 0

    : 0: 100

    rx bytes: 0 (0.0 B) tx bytes: 0 (0.0 B)
    n n n n n n n n n n n n n n n n n n n n n n n n n n rn  vmnet8 Link encap:Ethernet HWaddr 00:50:56:C0:00:08 rn  rn  inet addr:172.16.74.1 Bcast:172.16.74.255 Mask:255.255.255.0rn  r n up! Running Multicast MTU: 1500 Metric: 1

    RX Packets: 0 errors: 0 Dropped: 0 OverRuns: 0 Frame: 0

    TX Packets: 0 ERROROPED: 0 Overruns: 0 carrier: 0

    : 0: 100

    rx bytes: 0 (0.0 b) tx bytes: 0 (0.0 b)
    n n You can see VMware's virtual network device VMNet1 and VMNet8

    If the iFconfig command did not see these two virtual devices, it indicates that VMware's background service program is not running, and it will make an error when performing vmware, please use it, please use it. The command mentioned above runs.

    VMware is not a free software. You need to enter the serial number when running for the first time. You can press the GET SN to twist from the official website of VMware to get a three -month sequence number. In order to avoid trouble, I posted a few here:

    VMware 3.0 for linux:

    625AX-8DE40-46ra3-30Hum
    n 625AX-8DE40 -46ra3-30Hum

    60N88-8DW44-16H77-32KT4

    6818x-84WD1kdk-3JN9x
    n for win v3.2.0-2230 2230
    R n
    0F11N-004u4-0u0HJ-12XDG

    04590-00NU1-0umkx-161AW
    n 0dm1j-004h0kta4-1614F n r

    04hcm-085k0-0R8um -fh0u

    0451J-0AJHJ-0kxkx-1412u
    n n And these are easier to master, so this part should be explored by readers.

    The "Power on" button on the VMware Toolbar to start the virtual machine, press the F2 key to enter the BIOS settings, let the virtual machine start from the CD, and resume the virtual machine after saving. , Installed the system.

    (Note: I found such a problem in the use of VMware: It will be slow to install the virtual system on the virtual machine without installing the graphics card 3D driver without installing the graphics card 3D driver, and it often loses the response. However, the installation of the 3D acceleration driver installed with the graphics card is significantly accelerated, so if you find similar problems in the process of installing the virtual system, you can install the graphics card 3D first.)

    The system installation of the system is installed. Don't forget to install VM Tools, (VMware Toolbar-> Settings-> VMware Tools Install) This will significantly increase the performance of the virtual system.

    . The network settings of the virtual machine (principle)

    Before the official start, I think it is necessary to learn some necessary network knowledge. Otherwise, although the gourd painting scoop can be solved without understanding any principle, it can only stare at the situation when the specific situation changes. Due to space limitations, only a simple network knowledge related to VMware settings here.

    1, what is the network?

    Tternet refers to "interconnected network". It seems that this sentence is a bit redundant, but there are indeed many people who have a wrong understanding of him. Some people imagine the messy interconnection of a computer. When we need to communicate with a computer with a distant computer, we first form a local computer into a network. Of course, the distant computers must also form a network to "connect" these two networks and form a "interconnected network". When using the telephone line and MODEM to dial -up the Internet, first connect your computer to the network of ISP (Internet Services network service provider) through the phone line, and then communicate with computer communication through the ISP network.

    2, how does the computer pass data through the network?

    1 Each network requires a network address, and the computer in the network requires a unique identification in the network. The host number is composed. When your computer is to communicate with other computers, the computer will first determine whether the target host is in the local network or in the remote network based on the IP address and the subnet mask. The data packet is sent to the local network, and the target host has the opportunity to detect and receive it. If the target host needs to be forwarded to the remote network via a computer called a gateway, the gateway can be regarded as the connection network and the connection network and The concept of network bridges and gateways is very wide. For the sake of simplification, we think that it is the same concept as the router. Router is a special computer connecting the network and network and selecting the path of the IP packet transmission. In many cases, the concept of the gateway is equivalent to the router.

    3, what are the requirements for the IP address of the computer in the network?

    In the same network, each computer must have the same network number, so that the computer believes that the target host is in this network and can be sent correctly. The data cannot be delivered directly on this network with the network cable. Even if the two computers are close at hand, it is still a remote computer in the computer. For example, a network number of a network is 192.168.0, then the network in the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network of the network, then the network on the network, then the network of the network then The IP address of the computer must start with 192.168.0. If you want to transmit a network with a data packet to the network number 192.168.1, you must forward it through the router. If there is no router in the network, the sending fails. Therefore, in order to connect the two networks, there must be at least two network interfaces (network cards, modem and other connected devices such as network interfaces). The relationship between the network and router is shown in the figure below:

    --------------------------------- ----------

    | Network A | | Router | Network B |

    | | | | r
    | □-| ----------------- □ □-| --------------- □ | r
    | 1 | | 2 3 | 4 |

    --------------------------------- ---------

    Figure 1

    The small box in the figure represents the network card or other network interface.

    The can see at least two network interfaces in the router.

    I assume that the address of network A is 192.168.0 The address of the network card 1 is 192.168.0.1

    The address of network B is 192.168.1.1

    then the network card 2 on the router must belong to the network 192.168.0 address to 192.168.0.x (x is the number of any less than 255)

    The network card 3 on the router must belong to Network 192.168.1 The address is 192.168.1.x (X is the number of any less than 255)

    means that the router belongs to both network A and network B, so that the bridge is played.

    Is when data is sent from network A to network B, the router receives data from network card 2, and after modification, send data to network B via a network card 3 to network B.

    . We said that the address of the network card 2 is 192.168.0.x. n
    4, VMware virtual machines provide those virtual network devices?

    In default installation, VMware provides virtual network card VMNet1 and VMNet8, and the virtual network card "AMD PCNet Family PCI Ethernet Adapter" on the virtual system N
    Please note that VMNet1 and VMNet8 are virtual devices on the main system. You can use the ifconfig command, and "AMD PCNet Family PCI Ethernet Adapter" is a virtual device on the virtual system. It is seen in the device manager that the first two belong to the real system, which is the device in your real computer. The latter belongs to the virtual system. It is a device in a virtual computer. Do not confuse.

    ------------------------------------------------------------------------------------- -

    | Network A | | router | | Network B |

    | | |
    n | □-| --- -------- |-□ □-| --------------- □ |

    | | 2 3 | 4 |

    ------------------------------------------------------------------------------------

    ---------------------------------------- -------------

    | Virtual System | | Main System (router) | | real network |
    n | | | | | | |

    | □-| --------------- □ □ u003C----> □ ----------- □ |

    | AMD PCNet Card | | VMNET1 VMNet8 Real Network Card | | 4 |

    ----------------------------------------------------------------------- ---------------------------------------

    n
    The comparison with the relationship between the network and router above.

    It to see that the virtual system and the main system communication must make the AMD PCNET network card and VMNET1 form a network.

    . VMNet1 is originally in the main system, and the system can be accessed directly, so the main system acts as the function of the router. As long as these two virtual equipment main systems and virtual systems can communicate.

    The key lies in three points:

    1. The network number of the network card AMD PCNet and VMNet1 is the same.

    2. Set network attributes in the virtual system and set the gateway address to the address of VMNet1.

    3. Open the routing function of the main system to make it a router.

    The. In fact, if you only need to communicate with virtual systems and main systems, without having to communicate with other hosts on the real network where the main system is located, just meet the first point. Because the first point is satisfied, the main system and the virtual system are on the same network, and it can be communicated without routers. But in most cases, we need the real network communication where the virtual system and the main system are located, which needs to meet the other two points.

    . The network settings of the virtual machine (implementation articles)

    1, let's first contact the virtual system and the main system.

    In VMware installation, the installation program will automatically allocate an IP address to VMNET1. Below is an example of the author's computer:

    vmnet1 link encap: ethernet Hwaddr 00:50:56 : C0: 00: 01

    inbet addr: 192.168.221.1 BCAST: 192.168.221.255 MASK: 255.255.255.0
    n up the Broadcast Running MTU: 1500 Metric: 1 R

    Rx packets: 191 ERRORS: 0 Dropped: 0 OverRuns: 0 Frame: 0

    TX Packets: 63 Errs: 0 Dropped: 0 OverRuns: 0 Carrier: 0

    : 0: 100

    rx bytes: 0 (0.0 b) tx bytes: 0 (0.0 b)

    The IP address assigned by VMNET1 is 192.168.221.1 (note that the VMware IP address is randomly assigned each time, and the actual situation will be different from the example here). That is, virtual network card VMNET1 belongs to the Internet 192.168.221. Therefore, we need to start the virtual system, set the network attribute, and set the IP address of the virtual system's network card "AMD PCNET FAMILY PCI Ethernet Adapter" to 192.168.221.x (X is any number of the number between 2 to 254 except 1 and 254 Set it to 2), and set the gateway to VMNet1. Address: 192.168.221.1 (if you do not communicate with the real network of the outside world)

    Windows 2000 and XP set up immediately after setting, WIN98 Win98 Need to restart, Linux needs to restart the network service:

    #Service network restart

    -C 3 192.168.221.2

    ping 192.168.221.2 (192.168.221.2) from 192.168.221.1: 56 (84) bytes of data. n
    64 bytes from 192.168.221.2 : ICMP_SEQ = 1 TTL = 128 Time = 6.91 ms

    64 bytes from 192.168.221.2: ICMP_SEQ = 2 TTL = 128 Time = 0.425 ms
    64 bytes from 192.168.221.2 : icmp_seq = 3 ttl = 128 time = 0.527 ms

    --- 192.168.221.2 ping ---

    3 packets, 3rived, 0% Loss, Time 2001ms

    RTT min/avg/max/mDEV = 0.425/2.623/6.917/3.036 ms

    Yeah!

    It ping main system on the virtual system:

    c:> ping 192.168.221.1

    pinging 192.168.221.1 with 32 bytes of data:

    REPLY from 192.168.221.1: bytes = 32 Time u003C10ms TTL = 64

    repide from 192.168.221.1: bytes = 32 TIME u003C10ms TTL = 64

    repide from 192.168.221.1: Bytes = 32 Time u003C10ms TTL = 64

    repide from 192.168.221.1: bytes = 32 Time u003C10ms TTL = 64

    Ping for 192.168.221.1: R
    Packets: sent = 4, Received = 4, LOST = 0 (0% Loss),

    und trip time in milli-seaconds:

    minimum = 0ms, maximum = 0ms, average = 0ms

    Yeah! The main system and the virtual system are successfully connected!

    2, let the real network communication where the virtual system and the main system are located

    First of all, you need a piece of network card connected to the real network on your computer (as shown in Figure 2 Show). VMNet8 works when communicating with the real network. VMNet8 will correspond to the real network card. When the virtual system needs to send a data packet to the real network, the real system is a router. First After the router (here is the main system Linux) to VMNET8. Since VMNet8 and the real network card correspond to it, this mechanism is done with VMware, so the network card issued on VMNet8 is equivalent Send to the real network through the real network card, please see Figure 2 throughout the whole process. If you have two or more real network cards on your system, the installation program will ask when installing the installation program and which real network card corresponds to the virtual network card. You can choose according to the actual situation.

    The IP address of VMNet8 to the address of the same network card as the real network card. Assuming that the network number of the real network is 192.168.0, the IP address of the real network card is 192.168.0.1, then the IP of VMNET8 can be set. The address is 192.168.0.2

    It the Chinese method as follows:

    #IFCONFIG VMNet8 double
    n #ifconfig vmnet8 192.168.0.2 up

    Igone the three conditions mentioned above:

    ----------------------------------------------------------------------------------------------------------------- ----------------------------------

    The key lies in three points:

    1. The network number of the network card AMD PCNet and VMNet1 is the same.

    2. Set network attributes in the virtual system and set the gateway address to the address of VMNet1.

    3. Open the routing function of the main system to make it a router.

    --------------------------------------------------------------------------------------------------- --------------------rn  rn  前两点我们已经在第一部分中做好了,现在只要开启了linux的路由功能虚拟The system can communicate with the outside world.

    Linux is a natural network operating system. His powerful functions in the network make it widely applied in the field of network server. Use Linux to make routers without even additional software, Linux's kernel directly supports the function of static routing. What we have to do is just open the route function.

    It first look at the routing table:

    #route

    Determine the IP address or network address of all network cards is in the column, as shown in the figure below :

    -------------------------------------------------------------------------------------- --------------------------------------

    kernel ip routing table

    gateway geenmask flags metric ref use iface

    192.168.0.0 * 255.255.0 U 0 0 0 0 eth1 n n 192.168.0.0 * 255.2555.0.0 U 0 0 0 0 0 eth1

    192.168.0.0 * 255.255.255.0 U 0 0 VMNet8

    192.168.221.0 * 255.255.0 u 0 0 vmnet1
    n n n n n n n n
    127.0.0.0 * 255.0.0.0 U 0 0 LO

    default work restart

    >/proc/sys/net/ipv4/ip_Forward

    . At this point, the routing function of Linux has been opened. Your Linux system has become a router, connecting virtual networks and real networks. You can communicate between the virtual network and the real network. For security reasons, if necessary, you need to use the iptables command to set the routing rules.

Shopping Cart