mac ubuntu ip相关设置

2019-01-04  本文已影响0人  旭娃

设置例子:https://gist.github.com/wacko/5577187

On Mac OS (host):

Shutdown your VM and do:

VirtualBox > Settings > Network > Add (you will get vboxnet0)

On a terminal ifconfig will show you new interface vboxnet0

VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0

On Ubuntu (guest):

Install OpenSSH Server

Edit /etc/network/interfaces file to append the following lines:

auto eth1

iface eth1 inet static

address 192.168.56.10

netmask 255.255.255.0

Run sudo ifup eth1 from the Ubuntu command line. SSH server should be up and running. Switch to your host terminal and enter ssh 192.168.56.10

sudo ifup eth1 命令可能会出错,说device eth1找不到,这时可以选一个未用的设备的名称替换eth1,如enp0s8,然后启动就可以主机与虚拟机互访了.

sources:

http://superuser.com/questions/424083/virtualbox-host-ssh-to-guest

https://forums.virtualbox.org/viewtopic.php?f=8&t=40076

上一篇 下一篇

猜你喜欢

热点阅读