现在的位置: 首页 > 综合 > 正文

Ubuntu Virtualbox桥接 配置

2013年08月02日 ⁄ 综合 ⁄ 共 1002字 ⁄ 字号 评论关闭
Ubuntu Virtualbox桥接 配置
1.安装Virtualbox 软件,导入镜像包,看XP 能否起来
  $sudo apt-get install virtualbox

2.安装必要工具
$sudo apt-get install uml-utilities bridge-utils

3.设置文件/dev/net/tun的读写权限
chmod 0666 /dev/net/tun

4.设置Virtualbox启动
$sudo gpasswd -a 你的帐户名 uml-net
$sudo gpasswd -a 你的帐户名 vboxusers

5.修改/etc/network/interfaces

auto lo      //本地回还
iface lo inet loopback

auto eth0    //eth0网络
iface eth0 inet static
address 192.168.4.200
netmask 255.255.255.0
gateway 192.168.4.1
broadcast 192.168.4.255
network 192.168.4.0

auto tap0       //虚拟网卡tap0网络
iface tap0 inet manual
up ifconfig $IFACE 192.168.4.201 up
down ifconfig $IFACE down
tunctl_user 你的帐号名   //如ykz

auto br0
iface br0 inet dhcp   //网桥DHCP IP 地址
bridge_ports eth0 tap0  //将eth0,tap0 加入到网桥

6.重启网络
  $sudo /etc/init.d/networking restart

7.启动virtualbox,在主界面上选中要使用刚才建立的虚拟网络接口tap0的虚拟机,点“设置”,在弹出的窗口中选“网络”,
选中 其中一块网卡(通常为“网络适配器 0”),选中“启用网络适配器”,“连接到”后面选“Host Interface”,选中“接入网线”,
然后在“主机网络界面名称”中填入刚才建立的虚拟网络接口的名字“tap0”,确定。
  XP 如果自动获取IP 的话,就为201.
  当然也可以设定其它的IP

8.实用小指令
刪除 tap0
tunctl -d tap0

刪除 br0
ifconfig br0 down
brctl delbr br0

将tap0, eth0 移出bridge(br0)
brctl delif br0 tap0
brctl delif br0 eth0

抱歉!评论已关闭.