1. 虚拟机网络设置[1]
2. 发现Ubuntu里找不到网卡,eth0都没有
于是设置静态IP[1]
sudo vi /etc/network/interfaces
重启Ubuntu的网络:
sudo service networking restart
发现仍然找不到eth0
原因是Mac地址不对,删除文件 /etc/udev/rules.d/70-persistent-net.rules 后重启就可以了~[2]
references:
[1]http://blog.csdn.net/xxd851116/article/details/7038260
[2]https://forums.virtualbox.org/viewtopic.php?f=7&t=43090
just incase for myself (Installing Guest Additions in VirtualBox for an Ubuntu Server Guest):
###
最近又重新搞了下和上面的有些不同
Windows 7 Home Premium SP1 x64
VirtualBox 4.3.12 + Ubuntu 12.04.2 LTS alternative i386 / Ubuntu 14.04 LTS server i386
网络的选择方式依然是从默认NAT改为桥接网卡, 设完以后
sudo service networking restart --- 失败
sudo ifdown -a
sudo ifup -a --- 成功,此时已经可以上网,主机也可访问该虚拟机
sudo vi /etc/network/interfaces:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
这样的是动态IP,为了固定IP我改成了如下内容:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.102
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 202.101.172.35 202.101.172.47
然后重启networking依然会失败:
kenny@Kenny00:~$ sudo service networking restart
[sudo] password for kenny:
stop: Unknown instance:
networking stop/waiting
不知道为啥,只能继续用 ifdown -a 和 ifup -a 来重启网络 = =b
安装SSH服务:sudo apt-get install openssh-server