In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
0. Description
This blog post is one of a series of "in-depth understanding of the Internet mode of VMware virtual machines in practice": NAT mode.
For the significance of an in-depth understanding of the Internet mode of the VMware virtual machine, you can refer to the explanation section of another blog article in this series, "understanding the Internet mode of the VMware virtual machine in practice: the NAT model."
The writing way of this blog is still based on theory, combined with practical operation, in practice in-depth understanding of the various Internet access methods of the VMware virtual machine.
There are three ways for VMware virtual machine to surf the Internet: NAT, bridging and host-only mode. This article introduces the bridging mode.
1. Experimental environment
The blogger's experimental environment is as follows:
Host operating system: Windows 7
VMware Workstation version: 12.5.2 build-4638234
Virtual machine operating system: CentOS 6.5
Virtual machine operating system access to the Internet: bridge mode
Note: in order for the later test to be normal, be sure to turn off the firewall function of the operating system of the host and virtual machine. In fact, it doesn't matter which operating system the virtual machine uses. In order to facilitate testing and verification, you should use the operating system you are familiar with.
For the setting of the Internet mode, you can refer to the following illustration:
two。 Theoretical knowledge of bridging mode
When the Internet access mode of our virtual machine is set to bridge mode, the connection relationship among virtual machines, hosts and network cards can be shown in the following figure:
In fact, the above schematic can be equivalent to the following network topology diagram:
Therefore, when a virtual machine uses bridging mode to access the Internet, you can think of the virtual machine as a real host in the local area where the host is located, and it uses exactly the same network address information as the host.
It is important to note, however, that since we may have multiple network cards in our host, in VMware Workstation, we can set which network card our virtual machine is bridged to:
As shown in the figure, the blogger bridges the current virtual machine to the wireless network card of the host, so the network address information of the virtual machine should be in the same network segment as the network address information obtained by the host on the wireless network card, that is, they are located in the same local area network.
3. Deeply understand the network principle of bridging mode in practice
First check the network address information on our host machine:
You can see that the IP address range of the local area network where the host host is located is 192.168.1.0 IP 24. Because my host connects to wifi to access the Internet and uses DHCP to obtain the ip address, we can set the way to use dhcp on the virtual machine to obtain the IP address. The dhcp configuration of CentOS is as follows:
[root@leaf ~] # cat / etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0HWADDR=00:0c:29:3b:4c:6dTYPE=EthernetUUID=5ae16ecc-0149-487e-8dab-51afc75bd265ONBOOT=yesNM_CONTROLLED=yes#BOOTPROTO=staticBOOTPROTO=dhcpIPADDR=10.0.0.101NETMASK=255.255.255.0GATEWAY=10.0.0.2DNS1=202.96.128.86DNS2=202.96.128.166IPV6INIT=noUSERCTL=noPEERDNS=yes
Restart CentOS's network service:
[root@leaf ~] # / etc/init.d/network restartShutting down interface eth0: [OK] Shutting down loopback interface: [OK] Bringing up loopback interface: [OK] Bringing up interface eth0: Determining IP information for eth0... Done. [OK]
Check the IP address information again:
[root@leaf ~] # ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:3B:4C:6D inet addr:192.168.1.106 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe3b:4c6d/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:31386 errors:0 dropped:0 overruns:0 frame:0 TX packets:15738 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:14467018 (13.7MiB) TX bytes:1726371 (1.6MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: 1swap 128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets : 239 errors:0 dropped:0 overruns:0 frame:0 TX packets:239 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:23198 (22.6 KiB) TX bytes:23198 (22.6 KiB)
At this point, you can test the connectivity between the host and the virtual machine and ping the IP address of the virtual machine on the host:
Or ping the host on CentOS:
[root@leaf] # ping 192.168.1.100PING 192.168.1.100 (192.168.1.100) 56 (84) bytes of data.64 bytes from 192.168.1.100: icmp_seq=1 ttl=128 time=0.530 ms64 bytes from 192.168.1.100: icmp_seq=2 ttl=128 time=0.482 ms64 bytes from 192.168.1.100: icmp_seq=3 ttl=128 time=0.508 ms64 bytes from 192.168.1.100: icmp_seq=4 ttl=128 time=0.579 ms64 bytes from 192.168.1. Icmp_seq=5 ttl=128 time=0.447 ms64 bytes from 192.168.1.100: icmp_seq=6 ttl=128 time=0.448 ms64 bytes from 192.168.1.100: icmp_seq=7 ttl=128 time=0.552 ms64 bytes from 192.168.1.100: icmp_seq=8 ttl=128 time=0.220 Ms ^ C-192.168.1.100 ping statistics-8 packets transmitted 8 received, 0% packet loss, time 7352msrtt min/avg/max/mdev = 0.220, 0.470 ms, 0.579 ms
Because the virtual machine and the host are in the same local area network, under normal circumstances, they must be interoperable. When the communication is abnormal, you need to pay attention to whether the data is discarded because the firewall is turned on. Therefore, in these tests, it is recommended to turn off the firewall.
The above IP address information corresponds to the previous schematic, as follows:
If it is represented by a network topology diagram, it is equivalent to:
So it is clear to us that when the VMware virtual machine uses the bridging mode to surf the Internet, the network communication principle and details behind it are a complete process.
4. What should we do next?
Above, the virtual machine uses the address assigned by DHCP, and it is also possible to assign it manually. At this time, it can also communicate with the host on the network, and you can test it by yourself.
5. Application in practice
First of all, the first point is that when our virtual machine has network problems, we need to understand the topology of the network before troubleshooting, so the above content provides us with very good theoretical and practical knowledge.
In addition, if we can build various services and do all kinds of tests on the premise of understanding these network knowledge, we can achieve a state of confidence, instead of "looking at flowers in the fog and looking at the moon in the water." accordingly, in such continuous attempts, our comprehensive operation ability will certainly become stronger.
However, it is still necessary to note that the above illustration is still for reference, and many of the details need to know the details of VMware Workstation's network virtualization in order to really understand clearly, but in any case, the above content for network communications, or can bring us a lot of help, I sincerely hope to help you!
Due to the limited capacity and time, if you find any problems, please point them out in time.
Add:
For network troubleshooting, you can refer to a blog post previously written by the blogger: "explanation of Network debugging".
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.