时间:2023-06-26 14:27:01 | 来源:网站运营
时间:2023-06-26 14:27:01 来源:网站运营
VMware网络模式的原理讲解以及使用ssh工具按照桥接模式访问VMware中的虚拟机:感慨啊~真的是好久没有接触这个东西,然后又因为我的计算机网络知识基础也太不牢固了叭,居然老是忘记配置centos的子网掩码和 网关,就用这篇文章好好的巩固一下吧。对了,欢迎访问我的个人网站(CheverJohn's Website)哈!悉心听取各位的意见
看是解决不了问题的,要实操! 韶光易逝,劝君惜取少年时! ——笔者(CheverJohn)疯狂寄语hhhh
1. Bridged 桥接模式2. NAT NAT模式3. Host-only
就先这么叫着,我这边介绍一种方法——Bridged 桥接模式(我认为很简单的方法)。桥接网络是指本地物理网卡和虚拟网卡通过VMnet0虚拟交换机进行桥接,物理网卡和虚拟网卡在拓扑图上处于同等地位,那么物理网卡和虚拟网卡就相当于处于同一个网段,虚拟交换机就相当于一台现实网络中的交换机,所以两个网卡的IP地址也要设置为同一网段。具体的原理见下面的详细讲解
所以当我们要在局域网使用虚拟机,对局域网其他pc提供服务时,例如提供ftp,提供ssh,提供http服务,那么就要选择桥接模式。
例如大学宿舍里有一个路由器,宿舍里四个人连接这个路由器,路由器的wanip就不理会了,这个ip是动态获取的,而lanip默认是192.168.1.1,子网掩码是255.255.255.0。而其他四个人是自动获取ip,假设四个人的ip是:
A:192.168.1.100/255.255.255.0, B:192.168.1.101/255.255.255.0, C:192.168.1.102/255.255.255.0, D:192.168.1.103/255.255.255.0
那么虚拟机的ip可以设置的ip地址是192.168.1.2-192.168.1.99,192.168.1.104-192.168.1.254(网络地址全0和全1的除外,再除去ABCD四个人的ip地址)
那么虚拟机的ip地址可以设置为192.168.1.98/255.255.255.0,设置了这个ip地址,ABCD这四个人就可以通过192.168.1.98访问虚拟机了,如果虚拟机需要上外网,那么还需要配置虚拟机的路由地址,就是192.168.1.1了,这样,虚拟机就可以上外网了,但是,上网我们一般是通过域名去访问外网的,所以我们还需要为虚拟机配置一个dns服务器,我们可以简单点,把dns服务器地址配置为google的dns服务器:8.8.8.8,到此,虚拟机就可以上网了。
来源自链接
# centos7systemctl restart network
192.168.2.228
,然后我的虚拟机里的IP地址是192.168.2.233
,前三个网段很明显,我设置的静态IP很明显。When you install Workstation Pro on a Windows or Linux host system, a bridged network (VMnet0) is set up for you. Bridged networking connects a virtual machine to a network by using the network adapter on the host system. If the host system is on a network, bridged networking is often the easiest way to give the virtual machine access to that network.看到大段英文不要怕哈,要么勇敢地读下去,要么直接转去百度翻译hhhh
With bridged networking, the virtual network adapter in the virtual machine connects to a physical network adapter in the host system. The host network adapter enables the virtual machine to connect to the LAN that the host system uses. Bridged networking works with both wired and wireless host network adapters.
Bridged networking configures the virtual machine as a unique identity on the network, separate from and unrelated to the host system. The virtual machine is a full participant in the network. It has access to other machines on the network, and other machines on the network can contact it as if it were a physical computer on the network.
You can view and change the settings for bridged networking on the host system, determine which network adapters to use for bridged networking, and map specific host network adapters to specific virtual switches.你也可以在主机系统上查看和更改桥接网络的设置,确定使用哪些网络适配器进行桥接网络,并将特定的主机网络适配器映射到特定的虚拟交换机。
A virtual machine must have its own identity on a bridged network. For example, on a TCPIP network, the virtual machine needs its own IP address. Your network administrator can tell you whether IP addresses are available for virtual machines and which networking settings to use in the guest operating system.虚拟机在桥接网络上必须有自己的标识。例如,在TCPIP网络中,虚拟机需要自己的IP地址。网络管理员可以告诉您虚拟机的IP地址是否可用,以及在客户操作系统中使用哪些网络设置。
When you install Workstation Pro on a Windows or Linux host system, a bridged network (VMnet0) is set up for you. If you install Workstation Pro on a host system that has multiple network adapters, you can configure multiple bridged networks.啊这这这这~总感觉这段是废话,有种那种说了半天还是废话的感觉。。。
You can configure bridged networking for an existing virtual machine.[了解更多内容]emmm,这个我该咋说呢?字面意思啊,你可以为一个已存在的虚拟机配置桥接,自己个点了解更多内容去看叭。
By default, VMnet0 is set to use auto-bridging mode and is configured to bridge to all active network adapters on the host system. You can use the virtual network editor to change VMnet0 to bridge to one specific host network adapter, or restrict the host network adapters that VMnet0 auto-bridges to. The changes you make affect all virtual machines that use bridged networking on the host system.[了解更多内容]我们还可以改变VMnet0的设置哦,去和自己想要的宿主机网卡适配器进行配置呢。详情请点击上方链接噻。
When you install Workstation Pro on a Windows or Linux host system, a NAT network (VMnet8) is set up for you. When you use the New Virtual Machine wizard to create a typical virtual machine, the wizard configures the virtual machine to use the default NAT network.这边开始要出现“真东西”咯,虚拟出一个DHCP server。
With NAT, a virtual machine does not have its own IP address on the external network. Instead, a separate private network is set up on the host system. In the default configuration, virtual machines get an address on this private network from the virtual DHCP server.
The virtual machine and the host system share a single network identity that is not visible on the external network. NAT works by translating the IP addresses of virtual machines in the private network to the IP address of the host system. When a virtual machine sends a request to access a network resource, it appears to the network resource as if the request is coming from the host system.虚拟机和主机系统共享一个在外部网络中不可见的网络标识。NAT的工作原理是将私有网络中的虚拟机的IP地址转换为主机系统的IP地址。当虚拟机发送访问网络资源的请求时,网络资源会认为这个请求来自主机系统。
The host system has a virtual network adapter on the NAT network. This adapter enables the host system and virtual machines to communicate with each other. The NAT device passes network data between one or more virtual machines and the external network, identifies incoming data packets intended for each virtual machine, and sends them to the correct destination.主机系统在NAT网络中存在一个虚拟网卡。这个适配器使主机系统和虚拟机能够相互通信。NAT设备负责在一台或多台虚拟机与外部网络之间传递网络数据,识别接收到每个虚拟机的数据包,并将这些数据包发送到正确的目的地。
NAT is useful when the number of IP addresses is limited or the host system is connected to the network through a non-Ethernet adapter.[了解更多内容]当IP地址数量有限或主机系统通过非以太网适配器连接到网络时,NAT很有用
You can change the gateway IP address, configure port forwarding, and configure advanced networking settings for NAT networks. [了解更多内容]您可以修改网关地址、配置端口转发、配置NAT网络的高级组网设置。
If you are an advanced user, you can edit the NAT configuration file to modify NAT settings. [了解更多内容]如果您是高级用户,您可以通过编辑NAT配置文件来修改NAT设置。
If you use NAT networking in a Windows virtual machine running on a Windows host system, you can use NetLogon to log in to a Windows domain from the virtual machine and access file shares that the WINS server knows.[了解更多内容]如果在Windows主机系统的Windows虚拟机上使用NAT组网,可以通过NetLogon在虚拟机上登录Windows域,访问WINS服务器知道的文件共享。
If a virtual machine that uses NAT attempts to connect to a server that requires the client to use a source port below 1024, the NAT device must forward the request from a port below 1024. For security reasons, some servers accept connections only from source ports below 1024.[了解更多内容]如果使用NAT的虚拟机尝试连接服务器,而服务器要求客户端使用1024以下的源端口,NAT设备必须转发1024以下的源端口请求。出于安全原因,一些服务器只接受来自源端口小于1024的连接。
When you install Workstation Pro on a Windows or Linux host system, a host-only network (VMnet1) is set up for you. Host-only networking is useful if you need to set up an isolated virtual network. In a host-only network, the virtual machine and the host virtual network adapter are connected to a private Ethernet network. The network is completely contained within the host system.当您在Windows或Linux主机系统上安装Workstation Pro时,会为您设置一个仅供主机使用的网络(VMnet1)。如果您需要设置一个隔离的虚拟网络,那么仅供主机使用的网络非常有用。在仅供主机使用的网络中,虚拟机和主机虚拟网卡连接到专用以太网网络。网络完全包含在主机系统中。
The network connection between the virtual machine and the host system is provided by a virtual network adapter that is visible on the host operating system. The virtual DHCP server provides IP addresses on the host-only network.虚拟机和主机系统之间的网络连接是由主机操作系统上可见的虚拟网络适配器提供的。虚拟DHCP服务器在主机专用网络中提供IP地址。
In the default configuration, a virtual machine in a host-only network cannot connect to the Internet. If you install the proper routing or proxy software on the host system, you can establish a connection between the host virtual network adapter and a physical network adapter on the host system to connect the virtual machine to a Token Ring or other non-Ethernet network.默认情况下,主机专用网络中的虚拟机不能连接到Internet。如果在主机系统上安装了合适的路由或代理软件,可以在主机虚拟网卡和主机系统的物理网卡之间建立连接,将虚拟机连接到令牌环或其他非以太网网络。
On a Windows host computer, you can use host-only networking in combination with the Internet Connection Sharing feature in Windows to allow a virtual machine to use the dial-up networking adapter or other connection to the Internet on the host system. See Microsoft documentation for information on configuring Internet Connection Sharing.在Windows主机计算机上,您可以结合使用Windows中的Internet连接共享特性,以允许虚拟机使用拨号网络适配器或其他连接到主机系统上的Internet。有关配置Internet连接共享的信息,请参阅Microsoft文档。
When you install Workstation Pro on a Windows or Linux host system, a host-only network (VMnet1) is set up for you. You might want to configure multiple host-only networks to manage network traffic between virtual machines in specific ways. [了解更多内容]配置多个Host-Only方式的虚拟机实现共通通讯。
You can configure host-only networking for an existing virtual machine. You can connect a virtual network adapter to the default host-only network (VMnet1) or to a custom host-only network. If a virtual machine has two virtual network adapters, you can connect it to two host-only networks. [了解更多内容]默认的或自定义的网络。一个虚拟机还可以同时连接至两个Host-Only模式的网络呢。新增玩法,GET!
If you are setting up a complex test network that uses virtual machines, you might want to have two independent host-only networks with a router between them. [了解更多内容]一种Host-Only的应用场景
Each host-only network should be confined to the host system on which it is set up. Packets that virtual machines send on this network should not leak out to a physical network attached to the host system. Packet leakage can occur only if a machine actively forwards packets.[了解更多内容]每个Host-Only网络应该被限制在它所建立的主机系统中。虚拟机在这个网络上发送的数据包不应该泄漏到连接到主机系统的物理网络上。只有当机器主动转发数据包时,才会发生数据包泄漏。
A host-only network has a network interface associated with it (vmnet1) that is marked up when the host operating system is booted. Routing server processes that operate on the host operating system automatically discover the host-only network and propagate information on how to reach the network, unless you explicitly configure them not to do so.[了解更多内容]仅供主机使用的网络有一个与之关联的网络接口(vmnet1),该接口在主机操作系统启动时被标记出来。在主机操作系统上运行的路由服务器进程会自动发现主机专用网络,并传播关于如何到达网络的信息,除非您显式地将它们配置为不这样做。
The virtual DHCP server in Workstation Pro cannot update a DNS server by using a Dynamic Domain Name Service (DDNS). For this reason, you should use DHCP to supply IP addresses as well as other information, such as the identity of a host running a name server and the nearest router or gateway. [了解更多内容]“工作站专业版”中的虚拟DHCP服务器无法通过DDNS (Dynamic Domain Name Service)更新DNS服务器。由于这个原因,您应该使用DHCP来提供IP地址以及其他信息,例如运行名称服务器的主机的标识以及最近的路由器或网关。
关键词:模式,访问,虚拟,按照,使用,原理,网络,讲解