LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1006|回复: 4

请使用过VBOX的朋友帮忙看看桥接问题

[复制链接]
发表于 2008-4-28 18:26:53 | 显示全部楼层 |阅读模式
我在debian4.0下安装了vbox,vbox上安装了客户机xp,需要让xp直接上网,按照手册安装了uml-utilities 和 bridge-utils这两个工具,然后将我的用户名liuyun添加到了uml-net用户组,随后修改了/etc/network/interfaces,内容如下:
auto lo
iface lo inet loopback

auto tap0
iface tap0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
tunct‎l_user liuyun

iface eth0 inet static
address 172.16.95.201
netmask 255.255.254.0
gateway 172.16.94.1

auto br0
iface br0 inet static
address 172.16.95.201
netmask 255.255.254.0
gateway 172.16.94.1
bridge_ports eth0 tap0

我的IP是静态的,只有一个IP,觉得这样好像是错误的,但也不太懂该怎么改,vbox里设置好使用tap0这个接口,但是虚拟机里好像没反应,收不到数据。

大家帮看看吧,谢了。
不太懂网络这方面的知识,大家能稍作解释更好,谢了
发表于 2008-4-28 21:02:58 | 显示全部楼层
如果用桥接模式:

    tunctl -t tap0 -u `whoami`
    brctl addbr br0
    ifconfig eth0 0.0.0.0 promisc
    brctl addif br0 eth0
    dhclient br0
    brctl addif br0 tap0
    ifconfig tap0 up

不用桥接(这里host的虚拟IP:10.0.0.1,guest的IP设为同一网段即可,自己改改吧):

    sudo chmod 777 /proc/sys/net/ipv4/ip_forward
    sudo echo 1 > /proc/sys/net/ipv4/ip_forward
    sudo iptables -t nat -A POSTROUTING -j MASQUERADE
    sudo chmod 0666 /dev/net/tun
    sudo tunctl -t tap0 -u `whoami`
    sudo ifconfig tap0 10.0.0.1 netmask 255.255.255.0 up
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-4-29 21:13:17 | 显示全部楼层
看不太 懂啊
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-4-29 23:02:20 | 显示全部楼层
大家难道不能用通俗点的语言说说吗?
我还是搞不定

我的情况其实是:用的debian4.0r3的stable(主要是学习的)版本,按照介绍装了uml-utilities 和 bridge-utils这两个工具,设置vbox使用tap0接口。我只有一个IP地址:172.16.95.201,屏蔽码:255.255.254.0,网关172.16.94.1,需要客户端认证,也就是说主机debian是上不去网的,这也是我虚拟xp的原因,不知道应该怎么设置/etc/network/interfaces,反正我设置好后就不能用。

好像觉得按照参考的方法是需要多个IP的?可我只有一个,实在不知道怎样设置,哎……
我现在用debian主要是编程用的,网络不了解,也没时间深究,help!
回复 支持 反对

使用道具 举报

发表于 2008-4-30 21:07:00 | 显示全部楼层
试试这个配置
  1. auto lo eth0 tap0 br0
  2. iface lo inet loopback
  3. iface eth0 inet manual
  4. iface br0 inet static
  5. address 172.16.95.201
  6. netmask 255.255.254.0
  7. gateway 172.16.94.1
  8. bridge_ports eth0 tap0
  9. bridge_maxwait 0
  10. bridge_fd 0
  11. iface tap0 inet manual
  12. pre-up tunctl -u liuyun -t tap0
  13. pre-up ifconfig tap0 up
  14. post-down tunctl -d tap0
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表