VirtualBox 桥接拨号问题。(已解决)

Kvm、VMware、Virtualbox、Xen、Qemu 等
回复
头像
winxyhappy
帖子: 15
注册时间: 2007-12-04 18:32
联系:

VirtualBox 桥接拨号问题。(已解决)

#1

帖子 winxyhappy » 2009-04-27 11:14

首先申明:可以不回答,但不要说:你不是可以上网么,还要这个干什么。
系统及软件版本:Ubuntu 8.10 English,VirtualBox 2.2.0。
软件环境:Host环境Ubuntu 8.10 English+VirtualBox 2.2.0;Guest环境Windows 2003 CHS+SP2。
网络环境:我的上网途径有两种。主机在集线器后面,集线器连接在路由器后面,路由器关闭DHCP,所以所有主机均为固定IP,路由器通过电信ADSL拨号上网。此外,集线器还有一条线路连接铁通线路,所以主机还可以通过铁通拨号上网。(本来想做图示意,无赖技术太差)
所以上网条件:Host机器:Ubuntu固定IP电信ADSL或铁通DSL拨号上网;Guest机器:固定IP电信ADSL。
问题所在
通过如下方式设置VirtualBox桥接(Google来的):
1. 在Ubuntu 的系统上,安装含有建立虚拟网络设备 ( TAP interfaces ) 的工具 uml-utilities 和桥接工具 bridge-utils:
sudo apt-get install uml-utilities
sudo apt-get install bridge-utils
已将Ubuntu主机用户名(通常是你的ubuntu登录用户名)添加到uml-net用户组:
sudo gpasswd -a vboxuser uml-net
2.编辑 /etc/network/interfaces:
sudo gedit /etc/network/interfaces
将虚拟网络接口命名为 "tap0",指定该接口IP配置方法为手动,并指定使用该接口的用户(请用你的用户名替换其中的 "vboxuser"):
auto tap0
iface tap0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
tunctl_user vboxuser
3. 首次使用需要激活刚才建立的虚拟网络接口和网络桥:
sudo /sbin/ifup tap0
sudo /sbin/ifup br0
这个步骤只需要做一次,下次主机重新启动时,这个接口和桥将自动激活。
4. 在 /etc/network/interfaces 中加入如下内容,建立一个名叫 "br0" 的桥,使网络桥使用静态 IP:
auto br0
iface br0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
bridge_ports all tap0
5.让VirtualBox使用这个虚拟网络接口,启动VirtualBox,在主界面上选中要使用刚才建立的虚拟网络接口tap0的虚拟机,点“设置”,在弹出的窗口中选“网络”,选中其中一块网卡(通常为 “网络适配器 0”),选中“启用网络适配器”,“连接到”后面选 "Host Interface",选中“接入网线”,然后在“主机网络界面名称”中填入刚才建立的虚拟网络接口的名字 "tap0",确定。同样的你也可以使用 VBoxManage 的命令行工具(将 "My VM" 换成你的虚拟机名字 ):

问题来了,Guest机器(Windows 2003)可应通过电信ADSL路由器上网,铁通拨号上网;Host机器(Ubuntu)可以通过固定IP的电信ADSL路由器上网,却不能通过铁通拨号上网,貌似拨号没有拨上(将VirtualBox桥接模式去掉改为NAT模式时,电信ADSL和铁通DSL均可以上网)。

望高人解决一下。

附录桥接时interfaces文件:
auto lo
iface lo inet loopback

iface dsl-provider inet ppp
pre-up /sbin/ifconfig eth0 up # line maintained by pppoeconf
provider dsl-provider

auto eth0
iface eth0 inet static
address 192.168.1.220
netmask 255.255.255.0
gateway 192.168.1.1

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

auto br0
iface br0 inet static
address 192.168.1.225
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
bridge_ports all tap
上次由 winxyhappy 在 2009-04-28 14:42,总共编辑 1 次。
头像
marco.chan
帖子: 186
注册时间: 2007-10-29 20:41
来自: www.LinuxHobby.com
联系:

Re: VirtualBox 桥接拨号问题。

#2

帖子 marco.chan » 2009-04-28 7:09

现在版本的VBOX用桥接方式不用以前那么麻烦了,点点鼠标即可设置。
附件
screenshot_037.jpeg
我用我的风格发帖、跟帖,我说话很直接,千万不要说我在刻意发难你~
Linux爱好者http://www.LinuxHobby.com
RSS订阅我的网站
@LinuxHobby,Follow me~
Linux,是一种精神~
头像
winxyhappy
帖子: 15
注册时间: 2007-12-04 18:32
联系:

Re: VirtualBox 桥接拨号问题。

#3

帖子 winxyhappy » 2009-04-28 14:38

:em20 ,原来这么Easy,所有问题都解决了,上次试了这个怎么没成功??? :em06
:em38 THX
再问一个问题:呵呵呵,我安装的是VirtualBox 2.2.0如何压缩虚拟机文件(VDI)。貌似VBoxManage modifyhd xxxxxx.vdi compact不可用了,VDItool也不再提供下载了? :em06
头像
marco.chan
帖子: 186
注册时间: 2007-10-29 20:41
来自: www.LinuxHobby.com
联系:

Re: VirtualBox 桥接拨号问题。(已解决)

#4

帖子 marco.chan » 2009-04-29 0:20

8.15. VBoxManage modifyhd
With the modifyhd command, you can change the type of an existing image between the normal, immutable and write-through modes; see Section 5.3, “Configuring image write operations” for details.
Note
For compatibility with earlier versions of VirtualBox, the "modifyvdi" command is also supported and mapped internally to the "modifyhd" command.
For immutable (differencing) hard disks only, the modifyhd autoreset on|off command determines whether the disk is automatically reset on every VM startup (again, see Section 5.3, “Configuring image write operations”). The default is "on".
In addition, the modifyhd --compact command can be used to compact disk images, i.e. remove blocks that only contains zeroes. For this operation to be effective, it is required to zero out free space in the guest system using a suitable software tool. Microsoft provides the sdelete tool for Windows guests. Execute sdelete -c in the guest to zero the free disk space before compressing the virtual disk image. Compaction works both for base images and for diff images created as part of a snapshot. This feature is new in VirtualBox 2.2.2, and is experimental (i.e. create backups first).
我用我的风格发帖、跟帖,我说话很直接,千万不要说我在刻意发难你~
Linux爱好者http://www.LinuxHobby.com
RSS订阅我的网站
@LinuxHobby,Follow me~
Linux,是一种精神~
头像
winxyhappy
帖子: 15
注册时间: 2007-12-04 18:32
联系:

Re: VirtualBox 桥接拨号问题。(已解决)

#5

帖子 winxyhappy » 2009-04-29 10:19

:em38
THX,看来只有等到VB 2.2.2版本出来就好了。
sivaj
帖子: 541
注册时间: 2007-05-19 16:36

Re: VirtualBox 桥接拨号问题。(已解决)

#6

帖子 sivaj » 2009-05-20 18:59

我的8.10 卸载了 virtualbox-ose 之后安装了 virtualbox-2.2,但是菜单里没有启动项 命令行用virtualbox或者virtualbox-2.2也不行 /etc/rc2.d/下还是virtualbox-ose
求助
回复