13432878738 发表于 2015-4-17 08:55:51

vbox虚拟机网络设置

主机:win7-64Bit,虚拟机:visualBox debian64Bit
vbox连接方式:Bridged Adapter 桥接模式, 混杂模式:允许虚拟机
进入debian /etc/network/interfaces 设置静态分配
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
auto eth0
#iface eth0 inet dhcp
#auto eth0
iface eth0 inet static
address 192.168.16.246    (和主机同网段即可)
gateway 192.168.16.254    (和主机一致)
netmask 255.255.255.0
broadcast 192.168.16.255


然后进/etc/resolv.conf 设置dns
domain mshome.net
search mshome.net
nameserver 8.8.8.8 (和主机一致)


配置好后需要重启网卡,命令:(测试时好像用第二种可以)
第一种:使用ifconfig
例如要重启eth0
ifconfig eth0 stop
ifconfig eth0 start
第二种:ifdown和ifup
ifdown eth0
ifup eth0
第三种:service重启
service network restart/stop/start
另,查看某个网卡的数据流量的方法:
watch -n 1 "/sbin/ifconfig eth0 | grep bytes"


这样好像就能上网了。。。只是这个连接方式如果主机不能上网,两者是不能ping通的
对于自动获取ip和dns的主机,虚拟机就不知道怎么上网了。所以得自己设置。

安装好文件后记得释放光驱。  ===========================================================
  新版的mint下上面的方法好像不行。静态ip生效后只保留下面的重启才ok。
  auto lo

iface lo inet loopback
这样能住宿互通,住宿都能联网。
页: [1]
查看完整版本: vbox虚拟机网络设置