In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
There are two ways to configure the network of KVM virtual machines:
... User network (User Networking): an easy way for a virtual machine to access resources on a host, Internet, or local network, but not from a network or other client, and requires significant performance adjustments. NAT mode.
... Virtual bridge (Virtual Bridge): this approach is a little more complex than the user network, but after setting up the client and the Internet, the communication between the client and the host is very easy. Bridge mode.
The principle of Bridge mode:
Bridge mode is the network connection mode of virtual bridge, which enables clients and machines in the subnet to communicate with each other. You can make a virtual machine a host with a separate IP in the network.
A bridged network (also known as physical device sharing) is used to copy a physical device to a virtual machine. Bridges are often used for advanced settings, especially if the host has multiple network interfaces.
As shown in the figure above, the basic principle of the bridge is to create a bridge interface br0 to transfer data between the physical network card and the virtual network interface.
Bridge configuration:
Create a bridged network using iface-bridge.
[root@localhost Desktop] # virsh iface-bridge eth0 br0
Br0 profile:
Eth0 profile:
Verify the bridging interface:
[root@localhost Desktop] # brctl showbridge name bridge id STP enabled interfacesbr0 8000.000c295f6e15 yes eth0 vnet0virbr0 8000.525400359c0c yes virbr0-nic
Br0 defines a network bridge interface for the user.
Virbr0 is the system default.
[root@localhost Desktop] # virsh net-destroy default Network default deleted [root@localhost Desktop] # virsh net-undefine default Network default has been undefined [root@localhost Desktop] # service libvirtd restart is shutting down the libvirtd daemon: [OK] start the libvirtd daemon: [OK] [root@localhost Desktop] # brctl showbridge name bridge id STP enabled interfacesbr0 8000.000c295f6e15 yes eth0 vnet0
The principle of NAT mode:
NAT mode is the default mode after kvm installation. It not only supports the exchange of visits between hosts and virtual machines, but also supports virtual machines to access the Internet, but does not support external access to virtual machines.
Check the current network settings:
[root@localhost Desktop] # virsh net-list name status automatically starts Persistent
Note: generally there is a default default, which has just been deleted by me.
Create:
[root@localhost Desktop] # virsh net-define / usr/share/libvirt/networks/default.xml defines the network / usr/share/libvirt/networks/default.xml from default
Start and set to start automatically:
[root@localhost Desktop] # virsh net-list-- all name status automatically starts Persistent---default inactive no yes [root@localhost Desktop] # virsh net-start default Network Default has started [root@localhost Desktop] # virsh net-autostart default Network default marked to automatically launch [root@localhost Desktop] # brctl showbridge name bridge id STP enabled interfacesbr0 8000.000c295f6e15 yes eth0 vnet0virbr0 8000.52540047188f yes virbr0-nic
Modify the default network profile:
[root@localhost Desktop] # virsh net-edit default default 7a3c8113-5e79-e7fe-2d8c-9fb7e2b84d92
Note: finally, pay attention to iptables forwarding and sysctl.conf forwarding.
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.