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或debian7.8下上面的方法好像不行。静态ip生效后只保留下面的重启才ok。(应该和路由设置有关系,原本可以上网的debian7.5后来也不行,本地连接也不用开启共享连接)

auto lo

iface lo inet loopback 
这样能住宿互通,住宿都能联网。

修改BIOS的默认设置来解决在虚拟环境下对64位系统的支持:
选择Security----System Security--- Virtualization Technology(VTx)和 Virtualization Technology Directed I/O(VTd)后的Disable改成Enable。

================================================================================================================

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

source /etc/network/interfaces.d/*

# The loopback network interface
# auto lo
# iface lo inet loopback

# The primary network interface
# auto enp0s3
# iface enp0s3 inet dhcp
##########################Ubuntu 16.04.4 LTS###################################

auto lo
iface lo inet loopback

auto enp0s3
iface enp0s3 inet static
address 192.168.120.246
netmask 255.255.255.0
gateway 192.168.120.1
重启网络即可sudo /etc/init.d/networking restart

转载于:https://www.cnblogs.com/xiao0913/p/3597126.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值