Linux下网络加速软件netpas的使用(2)

  4.4 现在,你还不能启动 VirtualBox,因为你的当前用户还不属于 vboxusers 用户组。你可以使用下面的指令来将当前的用户(请使用你的用户名代替指令中的“youruser”)添加到 vboxusers 用户组中:

  sudo adduser youruser vboxusers

  4.5 在基于 Debian 和 Ubuntu 的系统上,首先要安装含有建立虚拟网络设备 ( TAP interfaces ) 的工具 uml-utilities 和桥接工具 bridge-utils:

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

  为了使你的虚拟机能够访问网络接口,你必须将运行虚拟主机的用户的用户名(通常是你的ubuntu登录用户名)添加到uml-net用户组(请用你的用户名替换其中的“vboxuser”):

  sudo gpasswd -a vboxuser uml-net

  注意:为了使改动生效,请重新启动你的电脑。

  4.6 向你的 Debian 或者 ubuntu 操作系统描述你要添加的虚拟网络设备,编辑 /etc/network/interfaces,下面给出我的:

  # This file describes the network interfaces available on your system
  # and how to activate them. For more information, see interfaces(5).

  # The loopback network interface
  auto lo
  iface lo inet loopback

  # The primary network interface
  allow-hotplug eth0
  iface eth0 inet manual
  up ifconfig eth0 0.0.0.0 promisc up

  auto eth0

  auto tap0
  iface tap0 inet manual
  up ifconfig $IFACE 0.0.0.0 up
  down ifconfig $IFACE down
  tunctl_user well(这个改成你的用户名)

  auto br0
  iface br0 inet static
  address 你的ip
  netmask 255.255.255.0
  network 你的ip,最后一组改为0
  broadcast 你的ip,最后一组改为255
  gateway 你的网关的ip
  (如果你用的dhcp,上面6行请改为 iface br0 inet dhcp )
  bridge_ports all tap0

  4.7 首次使用需要激活刚才建立的虚拟网络接口和网络桥:
  sudo /sbin/ifup tap0
  sudo /sbin/ifup br0

  这个步骤只需要做一次,下次主机重新启动时,这个接口和桥将自动激活

  5,让 virtualbox 使用这个虚拟网络接口。启动 virtualbox,在主界面上选中要使用刚才建立的虚拟网络接口tap0的虚拟机,点“设置”,在弹出的窗口中选“网络”,选中其中一块网卡(通常为 “网络适配器 0”),选中“启用网络适配器”,“连接到”后面选 "Host Interface",选中“接入网线”,然后在“主机网络界面名称”中填入刚才建立的虚拟网络接口的名字 "tap0",确定。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwydzf.html