Set the gate gateway to connect two VMS

Source: Internet
Author: User

Set the gate gateway to connect two VMS. 1. Prepare before the experiment. 1. clone two VMS. When vm1 is not started, select VM-> clone... and select full clone. Repeat once. Rename them to vm2 and gate respectively. 2. When the network interface gate is not started, VM-> Settings-> Add: Ethernet2 3. Configure host VM-> Settings, and select network connection: host interface connection vm1 Ethernet M m-> VMnet1 vm2 Ethernet Custom-> VMnet8 gate Ethernet Custom-> VMnet1 Ethernet2 Custom-> VMnet8 2, network 192.168.0.0 two virtual subnets under VMware: + ------------------------- + | VMnet1 | 192.168.20./ 24 | win1 vm1 | 192.168.17.1 192.168.17.3 | + ------------- + | eth0 192.168.1 7.4 + --------- + | gate | + --------- + | eth1 192.168.248.4 | + ------------- + signature + | win2 vm2 | 192.168.248.1 192.168.248.3 | VMnet8 | 192.168.248.0/24 | + ------------------------- + 2. Test vm1, gate, and vm2. log on to login as the root user: rootroot@192.168.17.3's password: Last login: Sun Mar 17 17:00:33 2013 from 192.168.17.1 [root @ vm1 root] #1. vm1 operations [root @ localhost root] # cd/etc /Sysconfig [root @ localhost sysconfig] # cat networkNETWORKING = yesHOSTNAME = localhost. localdomain [root @ localhost sysconfig] # vi network [root @ localhost sysconfig] # cat network // modify the host name to vm1NETWORKING = yesHOSTNAME = vm1 [root @ localhost sysconfig] #2. For vm2 [root @ localhost root] # cd/etc/sysconfig [root @ localhost sysconfig] # cat networkNETWORKING = yesHOSTNAME = localhost. localdomain [root @ localhost sysconfig] # vi Network [root @ localhost sysconfig] # cat network // change the host name to vm2NETWORKING = yesHOSTNAME = vm2 [root @ localhost sysconfig] #3. Perform gate operations [root @ localhost root] # cd/etc/sysconfig [root @ localhost sysconfig] # cat networkNETWORKING = yesHOSTNAME = localhost. localdomain [root @ localhost sysconfig] # vi network [root @ localhost sysconfig] # cat network // modify the host name to gateNETWORKING = yesHOSTNAME = gate [root @ localhost sysconfig] # * vm1 // add master Machine routing [root @ vm1 sysconfig] # vi/etc/hosts [root @ vm1 sysconfig] # cat/etc/hosts # that require network functionality will fail.127.0.0.1 localhost. localdomain localhost192.168.17.3 vm119425248.3 vm2 [root @ vm1 root] # * vm2 // Add host route [root @ vm2 sysconfig] # vi/etc/hosts [root @ vm2 sysconfig] # cat/etc /hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost. localdomain localhost192.168.248.3 vm2192.168.17.3 vm1 [root @ vm2 sysconfig] # * gate // Add host route [root @ gate root] # vi/etc/hosts [root @ gate root] # cat/etc /hosts # Do not remove the following line, or various programs # that require network functionality will fail.127.0.0.1 localhost. localdomain localhost192.168.248.3 vm2192.168.17.3 vm1 [root @ gate root] # // enable the forwarding function [root @ localhost root] # c At/proc/sys/net/ipv4/ip_forward0 // gate no forwarding function [root @ localhost root] # vi/proc/sys/net/ipv4/ip_forward [root @ localhost root] # cat/proc/sys/net/ipv4/ip_forward1 // The forwarding function starts * vm1 [root @ vm1 sysconfig] # route add-net 192.168.248.0 netmask 255.255.255.0 gw 192.168.17.4 [root @ vm1 sysconfig] # // route added successfully [root @ vm1 root] # ping vm2PING vm2 (192.168.248.3) 56 (84) bytes of data.64 bytes from vm2 (192.168.248.3): icm P_seq = 1 ttl = 63 time = 0.624 MS // ping vm2 * vm2 [root @ localhost root] # ping vm1connect: network is unreachable [root @ vm2 root] # route add-net 192.168.20.netmask 255.255.255.0 gw 192.168.248.4 [root @ vm2 root] # // route addition successful [root @ vm2 root] # ping vm1PING vm1 (192.168.17.3) 56 (84) bytes of data.64 bytes from vm1 (192.168.17.3): icmp_seq = 1 ttl = 63 time = 2.90 MS // ping through vm1 * gate [root @ gate root] # ping vm1PING Vm1 (192.168.17.3) 56 (84) bytes of data.64 bytes from vm1 (192.168.17.3 ): icmp_seq = 1 ttl = 64 time = 0.398 MS [root @ gate root] # ping vm2PING vm2 (192.168.248.3) 56 (84) bytes of data.64 bytes from vm2 (192.168.248.3 ): icmp_seq = 1 ttl = 64 time = 1.16 MS 3. Experiment Summary 1. I have done this experiment several times and I don't understand how the network works on linux at first, I don't know the principle of using gate to connect to vm1 and vm2. The first experiment was totally blind by incomplete notes. Of course, it is self-evident that I made a mess of linux virtual machines. The first lab class also failed. I felt very envious when I saw my classmates connecting to a host. 2. Later, I carefully thought about the principles and connection points, found out the course materials the teacher gave me last semester, and finally pinged the network through two attempts. 3. This is not a celebration, but for me, learning is a task that consumes energy. It is useless to blindly dry it. As the saying goes: Sharpen the knife without mistake to cut firewood. Therefore, it is important to understand the principles before the operation.

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.