Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Network Foundation of KVM Virtualization

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

KVM virtualization uses a technology called virtual switching to realize the network interconnection of virtual machines. Virtual switching is a software structure running on the host host, and the virtual host communicates with the outside world through direct connection with the virtual exchange. When we deploy the virtualized environment, the libvirt process automatically creates a default virtual switching virbr0 on the host host, and we can view the details of the virtual switching device through the ifconfig command.

[root@centos7 ~] # ifconfig virbr0

Virbr0 Link encap:Ethernet HWaddr 52:54:00:55:7F:D9

Inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:4926 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:0

RX bytes:0 (0.0b) TX bytes:974652 (951.8 KiB)

Virtual switching can be run in NAT patterns, routing patterns, and stand-alone modes. The features and functions of these patterns are described in Table 7-1. The virtual switching structure is shown in figure-1. By default, the libvirtd process uses NAT as the working mode of virtual exchange.

Table-1

Pattern

Function

NAT mode

NAT mode uses IP spoofing technology (masquerade), which enables virtual hosts to communicate with external hosts using the IP address of the host host. At this time, virtual hosts can communicate with each other, whether they are the same network segment or different network segments. However, computer devices located outside the host host by default cannot communicate with virtual machines connected to the virtual switching device. In other words, virtual hosts cannot connect to other hosts outside the real machine.

Pattern

Function

Route pattern

Route pattern virtual switching will be connected to the physical network of real devices to realize the outbound and inbound of data packets. The host will assume the role of routing

Independent mode

The independent mode makes each virtual switching device an independent network and independent of the host host. Virtual hosts connected to the same virtual switching device can communicate

Figure-1

The easiest way to set up the virtual switching network is to use the virt-manager tool, open the virtual machine manager through the virt-manager command, open the Host Details window through the Connection Details submenu under the Edit menu, and select the Virtual Networks tab, as shown in figure-2.

Figure-2

The default libvirtd has created a default virtual machine exchange based on NAT mode in the KVM virtualized environment, the device name is virbr0, the state is active, and the virtual switching network is 192.168.0.122.0DHCP address pool is 192.168.122.2-192.168.122.254 the IP address of the default virbr0 device defaults to 192.168.122.1. We can use the add button in figure-2 to create a new virtual switched network.

Using the add button (+) shown in figure 7-2, the create virtual network dialog box shown in figure-3 appears, indicating that you need to fill in the name, IP address and subnet mask, DHCP address pool, and operation mode to create a virtual switched network. Figure-4 prompts you to enter the virtual network name as mynetwork, figure-5 modifies the network address field to 192.168.200.0Comp24, the default 192.168.200.1 is the gateway device, figure-6 sets the DHCP address pool to 192.168.200.128-192.168.200.254, figure-7 selects the working mode of the virtual switched network, and you can choose stand-alone mode, NAT mode or Routed mode. Figure-8 is the confirmation dialog box. Continue to click the "Finish" button to complete a completely new virtual network setup.

Figure-3

Figure-4

Figure-5

Figure-6

Figure-7

Figure-8

After the virtual switch is created, all virtual hosts can add virtual network card interface to connect the virtual switching device. After opening the virtual host, the hardware list is displayed through the hardware management icon shown in figure-9. Under the hardware list, use the Add Hardware button to add the virtual network interface. The screen will display the add new hardware dialog box shown in figure-10, and select the Network network device. On the right, fill in the virtual switching device of the host host to which the network interface needs to connect, and here we choose the virtual switching device named mynetwork that we just created. In addition, you also need to fill in the MAC address of the virtual host and the device driver.

Figure-9

Figure-10

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report