Linux bridge-utils Tunctl Use

Source: Internet
Author: User

The network brctl is used under Linux to manage the Ethernet bridge. The command to establish, maintain, and check the configuration of the bridge in the kernel stp-spanning the tree Protocol (Spanning Tree protocol) logically disconnects the loop. Prevent broadcast storms from two-layer networks with DHCP mode enabled ' Eth0 ' in computer networks, Tun and tap are virtual network devices in the operating system kernel.

Different from the Common Hardware Network Board card implementation of the device. These virtual network devices are implemented with practical software. The same functionality as the hardware's network device is provided to the software that executes on the operating system. Tap equates to an Ethernet device that operates on a second layer of packets such as an Ethernet data frame.

The Tun simulates a network-layer device and operates a third-tier packet, such as an IP data packet. #1. To create a KVM bridging network mode, to install Bridge-utils Tunctlyum installed bridge-utils tunctl join a br0 Bridge (bridge type) brctl ADDBR br0ifconfig br0 up# Stepping the network disconnects the------------------------bind br0 with eth0 brctl addif br0 eth0 set BR0 to enable STP protocol Brctl STP BR0 On set eth0 IP to 0ifconfig eth0 0 use DHCP to assign Ipdhclient br0-------------------------to the br0 #最佳方式 (note change to your own IP) brctl addif br0 Eth0 && brctl stp br0 on && ifconfig eth0 0.0.0.0 && ifconfig br0 192.168.52.201 netmask 255.255.2 55.0 && route Add default GW 192.168.52.1# Create TAP type virtual network card device Tunctl-b-T vnet0ifconfig vnet0 upbrctl addif br0 VNET0BRC TL show# Create a virtual machine and associate a network card/usr/libexec/qemu-kvm-m 4096-smp 1-boot order=cd-hda/cloud/centos.img-net nic-net tap,ifname=vnet 0,script=no,downscript=no# Create a virtual machine and associate the network card with 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 semi-virtualized virtio<disk type= " File "device=" Disk "><driver name=" Qemu "type="Qcow2 "/><source file="/cloud/centos.img "/> <target dev= ' vda ' bus= ' virtio '/></disk> Libvirtlibvirt is a free, open-source C library of mainstream virtualization tools for Linux, designed to provide a convenient and reliable programming interface for a variety of virtualization tools, including Xen. Supports binding to a variety of mainstream development languages such as C,c++,ruby,python,java.

The default virtualization management Tools Virt-manager (graphical) on the current mainstream Linux platform, Virt-install (command line mode) are based on libvirt development.

The Libvirt library is a Linux API that implements Linux virtualization functionality. It supports a variety of hypervisor programs, including Xen and KVM, and some virtual products for QEMU and other operating systems # installation Libvirtyum install libvirt# boot libvirtservice libvirtd start# There will be one more Virbr0 bridge after startup, which is a NAT type Virsh (Good virtualization command-line management tool, two modes: Swap mode and non-switching mode) to define the virtual machine Virsh Define/cloud/centos-base.xmlvirsh Manage virtual machines virsh# List--all # Show all virtual machines--all Show all boot VMS #virsh start CentOS shutdown virtual machine #virsh shutdown CentOS forced shutdown #virsh destroy CentOS Remove virtual machine #virsh undefine centos display vncport#virsh vncdisplay centos Dynamic Query KVM Usage Resources #top-d 1 | grep KVM Query KVM Process Ps-aux | grep KVM boot itself proactively launches virtual machine #virsh autostart CentOS export virtual machine CentOS hardware configuration information for/cloud/centos.bak.xml#virsh dumpxml CentOS >/cloud/ Centos.bak.xml editing a virtual machine configuration #virsh Edit CentOS


Linux bridge-utils Tunctl Use

Related Article

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.