Linux bridge-utils tunctl, bridge-utilstunctl

Source: Internet
Author: User

Linux bridge-utils tunctl, bridge-utilstunctl

The Network brctl is used in Linux to manage Ethernet bridges. In the kernel, the STP-Spanning Tree Protocol (Spanning Tree Protocol) command is used to establish, maintain, and check the bridge configuration, enable 'eth0' in dhcp mode to prevent broadcast storms in L2 Networks. TUN and TAP are virtual network devices in the operating system kernel. Different from devices implemented by hardware network boards, all these virtual network devices are implemented by software, it also provides the software running on the operating system with the same functions as the hardware network device. A tap is equivalent to an Ethernet device that operates Layer 2 data packets, such as Ethernet data frames. TUN simulates network-layer devices and operates layer-3 data packets, such as IP data packets. #1. create a kvm bridge network mode. install bridge-utils tunctlyum install bridge-utils tunctl to add a br0 bridge (bridge type) brctl addbr br0ifconfig br0 up # the step-by-step network will be disconnected -------------------- br0 and eth0 will be bound together brctl addif br0 eth0 set br0 to enable STP protocol brctl stp br0 on Will eth0 IP ifconfig eth0 0 use dhcp to allocate IPdhclient br0 ------------------------- # The best way (change the IP address to your own IP address) brctl addif br0 eth0 & brctl stp br0 on & ifconfig eth0 0.0.0.0 & ifconfig br0 192.168.52.20 1 netmask 255.255.255.0 & route add default gw 192.168.52.1 # create the tunctl-B-t vnet0ifconfig vnet0 upbrctl addif br0 vnet0brctl show # create a VM and associate the NIC/usr/libexec/ qemu-kvm-m 4096-smp 1-boot order = cd-hda/cloud/Centos. img-net nic-net tap, ifname = vnet0, script = no, downscript = no # create a VM and associate it with the NIC and add the mac address/usr/libexec/qemu-kvm-m 2048-smp 1-boot order = cd-hda/cloud/Centos. img-net nic, macaddr = 52: 54: 00: 12:34:57-net tap, ifname = vnet0, script = no, downscript = no # Set the disk to a semi-virtualized virtio <disk type = "file" device = "disk"> <driver name = "qemu" type = "qcow2"/> <source file = "/cloud/centos. img "/> <target dev = 'vda' bus = 'virtio '/> </disk> lib1_libvirt is a free and open-source C function library that supports mainstream virtualization tools in Linux, it is designed to provide a set of convenient and reliable programming interfaces for various virtualization tools, including Xen, and supports binding with various mainstream development languages such as C, C ++, Ruby, Python, and JAVA. Currently, the default virtualization management tools virt-manager (graphical) and virt-install (command line mode) on mainstream Linux platforms are developed based on libvirt. The Libvirt library is a Linux API that implements Linux virtualization. It supports various virtual machine monitoring programs, including Xen and KVM, as well as QEMU and some virtual products used for other operating systems # install libpolicyum install libvirt # start lib1_service lib1_d start # One More virbr0 bridge will be added after the start, this bridge is a NAT virsh (a good virtualization command line management tool in two modes: Switch Mode and non-switch mode) define Virtual Machine virsh define/cloud/centos-base.xmlvirsh to manage Virtual Machine virsh # list -- all # Show all virtual machines -- all show all start virtual machine # virsh start centos close virtual machine # virsh shutdown centos Force shutdown # virsh destroy centos remove virtual machine # virsh undefine centos display vnc port # virsh vncdisplay centos dynamic query kvm resources # top-d 1 | grep kvm query kvm process ps-aux | grep kvm boot automatically virtual Machine # virsh autostart centos export the hardware configuration of the Virtual Machine centos as/cloud/centos. bak. xml # virsh dumpxml centos>/cloud/centos. bak. xml edit virtual machine configuration # virsh edit centos

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.