免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 855 | 回复: 0
打印 上一主题 下一主题

VirtualBox_set up a permanent host interface on a [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-12-14 14:49 |只看该作者 |倒序浏览
To set up a permanent host interface on a Debian or Ubuntu host, follow these steps:

1.
On modern Debian and Ubuntu based hosts, you must first install the
UserMode Linux utilities package (uml-utilities), which contains tools
to create TAP interfaces, as well as the bridge utilities
(bridge-utils). package. You can do this from the command line using

sudo apt-get install uml-utilities
sudo apt-get install bridge-utils

In
order for VirtualBox to be able to access the interface, the user who
will be running the virtual machine must be added to the group uml-net,
for example with the following command (replace vboxuser with your user
name):

sudo gpasswd -a vboxuser uml-net

You may have to log out and log in again for the change to take effect.

2.
To describe the TAP interface to your Debian or Ubuntu system, add an
entry to the file /etc/network/interfaces. This names the the interface
and must also specify the user who will be running the virtual machine
using the interface. The following sample entry creates the interface tap0 for the user vboxuser (again, replace with your user name):

auto tap0
iface tap0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
tunctl_user vboxuser

You
will probably want to change the entry based on your networking needs.
On the host, you will find more documentation in these files:
a) /usr/share/doc/uml-utilities/README.Debian and
b) /usr/share/doc/ifupdown/examples/network-interfaces.gz.

3. The first time it is used, activate the new interface and the bridge with these two commands:

sudo /sbin/ifup tap0
sudo /sbin/ifup br0

This
is only needed once, however; the next time the host is restarted, the
interface and the bridge should be activated automatically.

4.
Another entry must be added to the file /etc/network/interfaces to
describe the bridge. The following sample entry creates a bridge called
br0, adds to it all ethernet interfaces on the host as well as the TAP
interface created above and tells it to obtain an IP address using DHCP
so that the host remains able to access the network.

auto br0
iface br0 inet dhcp
bridge_ports all tap0

Again,
you will probably want to change this to suit your own networking
needs. In particular, you may want to assign a static IP address to the
bridge, or if you are using TAP interfaces created by VirtualBox (these
are described later), you will want to remove tap0 from the last line. On the host, you will find more documentation in the files

a) /usr/share/doc/bridge-utilities/README.Debian.gz and
b) /usr/share/doc/ifupdown/examples/network-interfaces.gz.

5.
To tell VirtualBox to use the interface, select the virtual machine
which is to use it in the main window of the VirtualBox application,
configure one of its network adaptors to use Host Interface Networking
(using "Settings", "Network",“Attached to”) and enter “tap0”
into the “Interface name” field. Alternatively, you can use the
VBoxManage command line tool (in this example we are attaching the
interface to the first network card of the virtual machine ("My VM"):

VBoxManage modifyvm "My VM" -hostifdev1 tap0
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/38576/showart_1719701.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP