vbox虚拟机网络设置
===========================================================
新版的mint或debian7.8下上面的方法好像不行。静态ip生效后只保留下面的重启才ok。(应该和路由设置有关系,原本可以上网的debian7.5后来也不行,本地连接也不用开启共享连接)
auto lo
修改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
=========================Ubuntu 18.04.4 LTS===========================
vbox网卡1设为 桥接网络 网卡2设为 网络地址转换NAT
xiao@ubuntu:~$ cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
addresses: [192.168.120.246/24]
#gateway4: 192.168.120.1
#nameservers:
# addresses: [192.168.40.190]
dhcp4: no
enp0s8:
dhcp4: yes
然后 netplan apply 不能加gateway4和nameservers 不明原因连不上外网
=============设置virtualbox共享文件夹==== http://download.virtualbox.org/virtualbox/
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom #将VBoxGuestAdditions.iso光驱挂接
cd /mnt/cdrom
./VBoxLinuxAdditions.run #确定没有failed
reboot
share是win下的共享文件夹 shared是linux下的
sudo mount -t vboxsf share /mnt/shared #挂载共享文件
sudo umount -f /mnt/shared #卸载共享文件