天天看點

使用虛拟機上網第一步

使用虛拟機上網第一步

我們使用nat模式。

配置nat的方式,參見以下url前3步:

http://www.cnblogs.com/liping13599168/archive/2011/04/08/2009177.html

也可以通過指令[1]

1)設定vmnet8's ip為192.168.8.2

2)配置虛拟機的網絡方式為nat(vmnet8)

3)設定ip,和gw

ifconfig eth0 192.168.8.22

ifconfig eth0 down

ifconfig eth0 up

route add default gw 192.168.8.2

vi /etc/resolve.conf添加

nameserver 192.168.8.2

經過以上配置後,虛拟機與實體間就可以通信了。

Notes:

有時候,網絡配置直接選擇nat不行,需要選擇custom,直接指定為vmnet8(nat)模式。

參考

[1]http://www.360doc.com/content/09/0314/14/88264_2805623.shtml