{"id":319,"date":"2010-01-06T14:29:29","date_gmt":"2010-01-06T12:29:29","guid":{"rendered":"http:\/\/blog.sqawasmi.com\/?p=319"},"modified":"2010-01-13T03:31:16","modified_gmt":"2010-01-13T01:31:16","slug":"qemu-kvm-tap-networking","status":"publish","type":"post","link":"https:\/\/blog.sqawasmi.com\/index.php\/2010\/01\/06\/qemu-kvm-tap-networking\/","title":{"rendered":"qemu\/kvm tap networking"},"content":{"rendered":"<p>The following is the commands to create a virtual bridge and virtual interfaces so you can use it with kvm\/qemu tap networking, Actually i think you can do all of this using a GUI interface via Virtual Machine Manager (virt-manager), but i don&#8217;t know why i feel its difficult to use it, anyway.<\/p>\n<p>You will need a tun enabled kernel, also tunctl and bridge-utils packages are installed in your system, in Fedora 12 i used yum to install them:<\/p>\n<blockquote><p>yum install bridge-utils.`uname -m` tunctl.`uname -m` -y<\/p><\/blockquote>\n<p>For tun support in your kernel, you can modprobe tun and see the result, or checking the config file under \/boot\/ for CONFIG_TUN, for example in fedora:<\/p>\n<blockquote><p>[root@shaker-testing ~]# egrep &#8216;^CONFIG_TUN&#8217; \/boot\/config-2.6.31.9-174.fc12.x86_64<br \/>\nCONFIG_TUN=m<\/p><\/blockquote>\n<p>anyway you do it, just make sure exist and probed (lsmod | grep tun)<\/p>\n<p>Finally here is the commands to create the virtual interface and virtual switch:<\/p>\n<blockquote><p>[root@shaker-testing ~]# tunctl -b -u root -t tap0<br \/>\ntap0<br \/>\n[root@shaker-testing ~]# brctl addbr testing-br<br \/>\n[root@shaker-testing ~]# brctl addif testing-br tap0<br \/>\n[root@shaker-testing ~]# brctl addif testing-br eth0<br \/>\n[root@shaker-testing ~]# ifconfig tap0 0.0.0.0 promisc up<br \/>\n[root@shaker-testing ~]# ifconfig eth0 0.0.0.0 promisc up<br \/>\n[root@shaker-testing ~]# ifconfig testing-br 192.168.0.1 netmask 255.255.255.0<br \/>\n[root@shaker-testing ~]# brctl show<br \/>\nbridge name\u00a0\u00a0 \u00a0bridge id\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0STP enabled\u00a0\u00a0 \u00a0interfaces<br \/>\ntesting-br \u00a0 \u00a0\u00a0\u00a0\u00a0 8000.0019d13401c0\u00a0\u00a0 \u00a0no\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0eth0<br \/>\ntap0<\/p><\/blockquote>\n<p>thats all, btw, 192.168.0.1 was my eth0\u00a0 IP Address, you have to give it to your virtual bridge.<\/p>\n<p>now run your machine, i usually run it as followes:<\/p>\n<blockquote><p>qemu -hda \/storage\/testing1.img -m 256 -net nic,macaddr=00:1d:92:ab:3f:80 -net tap,ifname=tap0,script=no -alt-grab -vga std -name Testing1 -boot c -vnc :0<\/p><\/blockquote>\n<p>and then i login to it using vncviewer (i used -vnc :0 in the options) to configure its IP Address.. for example, if you are connecting\/using it in localhost then i use:<\/p>\n<blockquote><p>vncviewer localhost:5900<\/p><\/blockquote>\n<p>or you can delete &#8216;-vnc:0&#8217; so you don&#8217;t use vnc at all..<\/p>\n<h3>Related Images:<\/h3>","protected":false},"excerpt":{"rendered":"<p>The following is the commands to create a virtual bridge and virtual interfaces so you can use it with kvm\/qemu tap networking, Actually i think you can do all of this using a GUI interface via Virtual Machine Manager (virt-manager), but i don&#8217;t know why i feel its difficult to use it, anyway. You will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ngg_post_thumbnail":0,"footnotes":""},"categories":[22],"tags":[25,26],"class_list":["post-319","post","type-post","status-publish","format-standard","hentry","category-cli","tag-kvm","tag-qemu"],"_links":{"self":[{"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/posts\/319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/comments?post=319"}],"version-history":[{"count":5,"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/posts\/319\/revisions"}],"predecessor-version":[{"id":321,"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/posts\/319\/revisions\/321"}],"wp:attachment":[{"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/media?parent=319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/categories?post=319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/tags?post=319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}