Windows / Linux: VMware virtual machines and external communication via IP network

First two cases: one is already on your computer and additional network IP address in an environment within a network, and another just want to give yourself a virtual machine on a computer distribution network to IP communications.

① IP network is available

To find a free IP address (192.168.21.110 here for an example) to ping the IP ping if not General on behalf of no one use, you can use

VMware bridging mode select bit

Windows:

---- Open Network Sharing Center Change adapter settings in the virtual machine

Ethernet Properties ---- TCP / IPV4 attributes (DNS does not know how to fill it 0.0. 0.0) ---- finalized

 

Linux:

Here CentOS 7, for example to set a static IP

  First note that the route must be set at the gateway can be configured to use a static IP or MAC binding can specify IP configuration, otherwise configuration fails.

  Network configuration profile in the / etc / sysconfig / network-scripts /, file name prefix is the name behind ifcfg- with the card, use ifconfig to view, usually eth0 / enth33 below are an example to eth0. You can also use the command:  LS / etc / sysconfig / Network-scripts / ifcfg- * List all device profiles

# Edit the configuration file

#vim /etc/sysconfig/network-scripts/ifcfg-eth0

修改 ONBOOT=yes,BOOTPROTO=static

Increase IPADDR, NETMASK and GATEWAY, DNS1 can not

 

DEVICE=eth0
HWADDR = 00 : 0C: 29 : 75: 73: AB
TYPE=Ethernet
UUID=8f49ebc2-5b1b-4135-863b-6acb0c84453f
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.21.110
NETMASK=255.255.255.0
GATEWAY=192.168.21.1
DNS1=192.168.21.2 

#重新启动网络服务

#service network restart 

 

②无可用的内网IP

首先配置WMware的网络设置,选中自定义NAT模式。

 

打开 Vmware 的编辑里虚拟网络编辑器,找到Net8的子网IP一般是192.168.11.0,这个非常重要就是你选的IP一定要在这个IP段内。

 

然后就是在主机里的适配器选项里设置TCP / IPV4,这里注意是选虚拟机适配器Net8的属性

 

 

Windows:

  和上面的Windows的基本步骤差不多,不过这里的IP地址可以随意一点,但是要保证在192.168.11 段内。

然后就是这个网关你要注意,接下来会用到。

这里网关 192. 168.11.1 要和虚拟机里的网关对应

 

Linux:

  和上面Linux相同步骤,地址随意但要在192.168.11 IP段内:#vim /etc/sysconfig/network-scripts/ifcfg-eth0 ,#service network restart 

 

最后

  互相测试 ping 一下能不能 ping 的通

如果

  连接超时,连接超时,连接超时的话;记得把防火墙关闭,

而且

  两边,两边,两边的防火墙都要关,要不然会出现只有一边能 ping 通的现象。

Guess you like

Origin www.cnblogs.com/yddsblog/p/12095251.html