{"id":522,"date":"2011-01-28T00:30:38","date_gmt":"2011-12-12T21:51:50","guid":{"rendered":"http:\/\/kraftek.com\/blog\/create-a-bridge-interface-in-the-host-to-use-it-in-virtualbox\/"},"modified":"2011-01-28T00:30:38","modified_gmt":"2011-12-12T21:51:50","slug":"create-a-bridge-interface-in-the-host-to-use-it-in-virtualbox","status":"publish","type":"post","link":"\/blog\/index.php\/create-a-bridge-interface-in-the-host-to-use-it-in-virtualbox\/","title":{"rendered":"Create a bridge interface in the host to use it in VirtualBox"},"content":{"rendered":"<p>To have a host ip inside your VirtualBox guest OS, you must create it a tap interface in the HOST OS, i wrote two scripts<br \/>\nto create the needed interface, and to remove it (tapstart.ksh\/tapstop.ksh)<br \/>\nThese scripts are made for Slackware 12(the host os), since it has no config files for tap\/tun\/bridge interfaces<br \/>\nin \/etc afaik.<br \/>\nTAPSTART.KSH:<br \/>\n#!\/bin\/ksh<br \/>\n## The real interface, this should already have an ip, in this case it is<br \/>\n## a static ip<br \/>\nREAL=eth1<br \/>\nREALIP=172.16.1.88<br \/>\nNETMASK=255.255.0.0<br \/>\nGATEWAY=172.16.0.1<br \/>\n## The bridge interface, this will have the REALIP once all is setup<br \/>\nBRIDGE=br0<br \/>\n## The tap interface, we&#8217;ll use this device inside VirtualBox<br \/>\nTAP=tap0<br \/>\nmkdir \/dev\/net<br \/>\nmknod \/dev\/net\/tun c 10 200<br \/>\ngroupadd umlnetwork<br \/>\nchgrp umlnetwork \/dev\/net\/tun<br \/>\nchmod g+rw \/dev\/net\/tun<br \/>\nmodprobe tun<br \/>\nbrctl addbr $BRIDGE<br \/>\nifconfig $REAL 0.0.0.0 promisc up<br \/>\nbrctl addif $BRIDGE $REAL<br \/>\ntunctl -t $TAP -u root<br \/>\nbrctl addif $BRIDGE $TAP<br \/>\nifconfig $TAP up<br \/>\nifconfig $BRIDGE inet $REALIP netmask $NETMASK<br \/>\nroute add default gw $GATEWAY $BRIDGE<br \/>\nchmod 0666 \/dev\/net\/tun<br \/>\nTAPSTOP.KSH:<br \/>\n#!\/bin\/ksh<br \/>\n## the tap,bridge and real interface as configured in tapstart.ksh<br \/>\nTAP=tap0<br \/>\nBRIDGE=br0<br \/>\nREAL=eth1<br \/>\nREALIP=172.16.1.88<br \/>\nNETMASK=255.255.0.0<br \/>\nifconfig $TAP down<br \/>\n101\/433<br \/>\ntunctl -d $TAP<br \/>\nifconfig $BRIDGE down<br \/>\nbrctl delbr $BRIDGE<br \/>\nifconfig eth1 inet $REALIP netmask $NETMASK up<br \/>\nNow all we have to do in virtual box is select &#8220;host&#8221; networking, use &#8220;tap0&#8243; as the interface and use<br \/>\n&#8216;tapstart.ksh&#8221; and &#8220;tapstop.ksh&#8221; as the networking start\/stop scripts.<br \/>\nYour Guest OS&#8217;s nic can be configured to use dhcp, for instance, and will get an address from your LAN&#8217;s<br \/>\ndhcp server.<br \/>\n102\/433<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To have a host ip inside your VirtualBox guest OS, you must create it a tap interface in the HOST OS, i wrote two scripts to create the needed interface, and to remove it (tapstart.ksh\/tapstop.ksh) These scripts are made for Slackware 12(the host os), since it has no config files for tap\/tun\/bridge interfaces in \/etc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-522","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/522","targetHints":{"allow":["GET"]}}],"collection":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=522"}],"version-history":[{"count":0,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/522\/revisions"}],"wp:attachment":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=522"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=522"},{"taxonomy":"post_tag","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}