Connect to your network with VM VMS

Source: Internet
Author: User

Today we are going to do an experiment with routing, which involves the following knowledge points
(1) In the environment construction process, we want to clone the virtual machine, modify the network card. This is two very important operations.
(2) Configuring the router
Let me take a step-by-step explanation of the experiment.

One: The purpose of the experiment

Using 6 virtual machines, four units as routers, two PCs, connect the network.

Two: Configure the Environment 1 clone virtual Machine 1.1: Clone virtual machine, modify network card (method one)

There are two ways to clone a virtual machine, let's start with the first
(1) Copy the virtual machine file and open it in the VM. After opening the following window will pop up, we want to select ' I have copied this virtual machine ', note that the MAC address of the network card in the copied virtual machine will change automatically after selecting this option!

(2) View the copy of the virtual machine's Nic Mac, does change. And found that the name of the NIC is not eth0,eth1, so the next step is to modify the network card

(3)

  vim /etc/udev/rules.d/70-persistent-net.rules     #将其中对应要修改的网卡最后的NAME="eth2"改为所需要的名称    ethtool -i eth2     #查看驱动模块名    modprobe -r pcnet32    #卸载模块    modprobe pcnet32    #重新加载模块    cd /etc/sysconfig/network-scripts    #将该目录下原网卡的配置文件改文件名,使其格式为ifcfg-网卡名,接着修改该配置文件,将其中的DEVICE=改为网卡名    ifdown eth0    ifup eth0

(3) After modifying the NIC, view the virtual machine IP

(4) Restart the network service to see if it is normal

Summary: This method can actually replicate the machine, but there is a flaw, is the space is very large, then we continue to learn the second method, this method, occupies a small space, very convenient. We are also starting to configure our experimental environment.

1.2. Clone the virtual machine, modify the NIC (method two)

On the VM, follow these steps: Virtual machine--management--cloning
A copy of the virtual machine can be completed by pressing the operation.

2: Network card settings, IP settings

2.1 In order to prevent too many virtual opportunities to run too much burden on the physical machine, we first set the virtual machine to boot start command line, do not start the graphical interface, edit the following file, change 5 to 3


2.2 Network Card settings
Increase the NIC, as shown in the slice, and cancel the DHCP service

2.3 Configure the virtual machine as shown in after configuration is complete. (Four routers)


2.4 Setting up IP
Since we have canceled the DHCP service, we have to set the IP manually and configure the NIC. (This step has been introduced in the cloning of the virtual machine, no longer repeat, we just look at the file just fine)

Device=eth1
Type=ethernet
Onboot=yes
Nm_controlled=yes
Bootproto=static
ipaddr=1.1.1.251
netmask=255.0.0.0
hwaddr=00:0c:29:41:38:0b
Defroute=yes
Peerdns=yes
Peerroutes=yes
Ipv4_failure_fatal=yes
Ipv6init=no
Name= "System eth1"

In this way, our experimental environment is built.

Three: Drawing ideas

Four: Configure routing
#route1route add -net 3.0.0.0/8 gw 2.2.2.252route add -net 4.0.0.0/8 gw 2.2.2.252route add -net 5.0.0.0/8 gw 2.2.2.252vim /etc/sysctl.conf  #开启路由转发iptables -F#route2route add -net 1.0.0.0/8 gw 2.2.2.251route add -net 4.0.0.0/8 gw 3.3.3.253route add -net 5.0.0.0/8 gw 3.3.3.253vim /etc/sysctl.conf  #开启路由转发iptables -F#route3route add -net 1.0.0.0/8 gw 3.3.3.252route add -net 2.0.0.0/8 gw 3.3.3.252route add -net 5.0.0.0/8 gw 4.4.4.254vim /etc/sysctl.conf  #开启路由转发iptables -F#route4route add -net 1.0.0.0/8 gw 4.4.4.253route add -net 2.0.0.0/8 gw 4.4.4.253route add -net 3.0.0.0/8 gw 4.4.4.253vim /etc/sysctl.conf  #开启路由转发iptables -F#PC1route add default gw 1.1.1.251#PC2route add default gw 5.5.5.254

Results such as:



Five: Experimental results

Successfully connected to the network.

Connect to your network with VM VMS

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.