PD configuration of virtual machines on Mac os, shared network access the public network

Pd (Paralles Desktop) is very easy to use Mac virtual machine software, very fast. pd reason why relatively fast because it uses paravirtualized mode,

We can see some clues from the card type at the following figure virtio, very strong on the right.

Virtualization

Disclaimer: The following description refers to the pd virtual machine installed in the virtual machine, such as the cent os and other linux distributions.
demand:

  1. To the virtual machine configuration statement ip, such as 192.168.6.10/24.
  2. Whether or mac connected to external networks, on the mac can be connected directly to the network address of the virtual machine.
  3. When mac is connected to the external network, the virtual machine may be connected to external networks.

Simple structure

After installation pd, mac increase in a virtual network adapter, the virtual machine is used to pd and host systems, such as network interface mac interconnected, corresponding to a switch between virtual machines and the host system, as shown below.

Figure I

You can also use the command line in a terminal to see.

Figure II

The vnic means vnic0 virtual net interface card, i.e., the virtual network interface, the latter corresponding to 0 # 0 is the upper left corner view of a virtual network adapter, i.e. the blue part, which denotes 0 pd card installed.

These two figures are just the same piece of card shows, so ip is 192.168.6.2. This is not my view of a configuration in the "ip address", which is configured in the pd.

It can open the preferences pd inside the relevant settings.

Figure III

In Figure III configuration is shared model that allows us to share virtual machines and mac outside the network, enable ipv4 dhcp red box is used to open the built-in dhcp service, the familiar pattern nat students know that this is to make the virtual machine nat mode by way of the Internet. Blue box below the other three start address input box is used to confirm dhcp address pool, i.e., the range of the virtual machine address ip dhcp manner automatically obtained.

如果用dhcp获取ip的话,虚拟机中的ip地址就不固定,也许下次开机时就换了个新的ip,那么每次都要去查看下新的ip才能连接到虚拟机。因此我需要把虚拟机设置为固定ip,即静态ip,所以没有勾选enable ipv4 dhcp,也就是说要手动配置ip,需要填写地址池,因为这是在借助nat的方式,虚拟机中所配置的ip地址必须要属于此ip地址范围,而且这不仅是为了配置虚拟机的ip范围,还要给pd在宿主机上的虚拟网卡vnic0分配地址。

之后,确认一下配置,如图四所示。

Figure IV

将网卡network1(我只配置了一块,具体以大家实际需求为准)的source源选择为Shared Network,也就是将虚拟机的网卡绑定到此Shared Network,Shared Network就是上面图四中的连接方式Shared,这样虚拟机便可与mac共享网络。

还没完,还需要配置虚拟机的ip。

启动虚拟机后,进入网卡文件的配置目录,用vim编辑网卡配置文件,我这里的网卡配置文件是ifcfg-eth0,具体以大家实际的为主。如图五所示。

使用的命令是

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Figure V

图中的bootproto采用的是static,表示静态,也可以写成none,大小写均可。接下来的是手动配置的ip,主要注意的是GATEWAY网关,这里配置的是192.168.6.1,并不是图一或图二中的192.168.6.2,因为我们并不是把mac当成Ip数据报文转发路由器(如同vmware中使用仅主机模式共享网络,然后虚拟机把网关指向vmware所共享的网卡ip),而是当成nat路由器,当采用nat方式为虚拟机提供网络服务时,pd会单独为虚拟机生成一个网关地址,这通常是地址池中的第1个ip,如图三中的起始地址,而图二中vnic0的地址是地址池中的第2个ip,即192.168.6.2。

编辑完文件后,重启网络,我的虚拟机是centOs6.3,执行的命令是

service network restart

Figure VI

如图六所显示,配置成功。

We have set up GATEWAY network card configuration file is 192.168.6.1, which is the key to a virtual machine access to the Internet, you can verify it with the command ip r routing table, shown in Figure 7.

Figure VII

If mac is through external network, the network can now be used under the virtual machine the ping command, shown in Figure 8, is through the network.

Figure VIII
ping may be your host mac, shown in Figure 9.

Figure IX

Then try to directly access the virtual machine on the MAC, is here connected with the virtual machine ssh ip address 192.168.6.10, shown in FIG ten, pass.

Figure X

Since then we realized the mac is connected virtual machines, virtual machines through the network and can pass public (outside) network.

Published 20 original articles · won praise 7 · views 5799

Guess you like

Origin blog.csdn.net/weixin_43491622/article/details/104415928