+ -
当前位置:首页 → 问答吧 → vbox网桥设置

vbox网桥设置

时间:2007-08-20

来源:互联网

按照http://gentoo-wiki.com/HOWTO:_VirtualBox设置:
代码:
#vbox网桥设置
#http://zh.gentoo-wiki.com/index.php?title=HOWTO_VirtualBox&redirect=no
#the interface is really replaced by br0 for outgoing, so if you had dhcp here, you'll use dhcp in br0
config_eth0=( "null" )

#this specifies that interface vbox0 will be a tap interface and use the tunctl command to generate itself
tuntap_vbox0="tap"

#ALL interfaces part of a bridge should be null, otherwise oddities may occur.
config_vbox0=( "null")

# you can specify an owner of the interface if you want to run virtual box as a non root user
#tunctl_vbox0="-u adm"

#If you'd prefer a dynamic ip address for the machine, use
#config_br0=( "dhcp" )
config_br0=("192.168.2.10/24 brd 192.168.2.255" )
routes_br0=("default via 192.168.2.1")
#this specifies the briding information
bridge_br0="eth0 vbox0"
depend_br0() {
 need net.eth0
        need net.vbox0
}
brctl_br0=( "setfd 0")
net.eth0 net.vbox0启动都没有问题。
start net.br0时,错误:
代码:
 network interface br0 does not exist
 Please verify hardware or kernel module (driver)
当我把net.eth0的设置改为原来的
代码:
config_eth0=("192.168.2.2/24 brd 192.168.2.255" )
routes_eth0=("default via 192.168.2.1")
net.br0可以启动,但是主机无法访问网络。

作者: 食古不化   发布时间: 2007-08-20

当我正确启动一次net.br0之后就可以了。

另外,我的主机的IP如何设置?不用设置?已经设置?

对网桥的看来还是不明白的。

作者: 食古不化   发布时间: 2007-08-20

兄弟看过安装手册中的说明了吗?网桥需要内核的支持(802.1d),在网络设置中。
http://www.gentoo.org/doc/zh_cn/hand...ap=3#doc_chap7

作者: zhou3345   发布时间: 2007-08-20

内核已经设置了。
我又试验了,一下。

restart eth0 vbox0 br0就好了?似乎是模块没有加载?

作者: 食古不化   发布时间: 2007-08-20

哈哈,这篇是我译的,要在内核的network上设置记得在ipv6的设置附近,最好从新做一遍,删删掉。

作者: jjj311   发布时间: 2007-08-20

先用着,等下回再次重启的时候对比一下lsmod。

谢谢2位。
我正是找到了jjj311的译贴才又找原贴看的。

作者: 食古不化   发布时间: 2007-08-20

config_eth0=( "dhcp" )
dhcp_eth0="nodns nontp nonis"

config_eth1=("null")

config_tap11=("null")
tuntap_tap11="tap"
tunctl_tap11="-u william"

config_br0=( "192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255" )
bridge_br0="eth1 tap11"
brctl_br0=( "stp off" )

depend_br0() {
need net.eth1 net.tap11
}

我的配置:
eth0 外网
eth1 内网,做 bridge
tap11 是给 vbox 用的。
br0 就是 内网bridge 了。

作者: 晨想   发布时间: 2007-08-21

当我
代码:
# /etc/init.d/net.eth0 restart && /etc/init.d/net.vbox0 restart && /etc/init.d/net.br0 restart
多来几次就行了。

楼上:
我只有一个网卡呀。 你的内外网啥意思?你的内网的eth1也是虚拟的一块网卡?

作者: 食古不化   发布时间: 2007-08-21

我试验了,老晨说的不行呢
代码:
# /etc/init.d/net.eth2 restart && /etc/init.d/net.vbox0 restart && /etc/init.d/net.br0 restart
 * Service net.eth2 stopping
 * Service net.eth2 stopped
 * Service net.eth2 starting
 * Service net.eth2 started
 * Service net.vbox0 stopping
 * Service net.vbox0 stopped
 * Service net.vbox0 starting
 * Service net.vbox0 started
 * Service net.br0 starting
 network interface eth2 does not exist
 Please verify hardware or kernel module (driver) [ !! ]
 * ERROR: net.br0 failed to start

作者: 食古不化   发布时间: 2007-08-21

vbox虚拟机里的网络又歇菜了……
算了,还是NAT吧。

作者: 食古不化   发布时间: 2007-08-21

http://wangyuanzju.blog.163.com/blog...9200755199573/

还是这个来的简单,呵呵。原来在qemu就是这么搞的。用的huahua的配置。
真是学艺不精,换个马甲就不知道怎么办了。

作者: 食古不化   发布时间: 2007-08-21

引用:
作者: 食古不化
http://wangyuanzju.blog.163.com/blog...9200755199573/

还是这个来的简单,呵呵。原来在qemu就是这么搞的。用的huahua的配置。
真是学艺不精,换个马甲就不知道怎么办了。
用iptables好理解一些。网桥似乎是两块网卡做一块用的。
两种方法论坛里都曾讨论过的。看JackeyKing的:
http://www.linuxsir.org/bbs/showthre...=291517&page=4

作者: zhou3345   发布时间: 2007-08-21

谢谢老周!!

作者: 食古不化   发布时间: 2007-08-24

你都没有相应的网卡,当然不行了。。呵呵。

作者: 晨想   发布时间: 2007-08-25