win10,虚拟机:virtual box,安装centos,设
2019-02-19 本文已影响1人
权艳霞
注:本篇一部分参考文章:http://www.cnblogs.com/jasmine-Jobs/p/5928218.html
1,win10,专业版,系统版本:

2,虚拟机:virtual box 5.2.26,下载地址:https://www.virtualbox.org/;
3,centos7,下载地址:https://www.centos.org/download/,选择dvd iso;
4,virtual box设置,网络,选择桥接网卡,使得宿主机和虚拟机在同一网段内工作:

5,ipconfig查看主机的ip,子网掩码,网关:

6,要给虚拟机设置一个同主机在同一网段的ip,则用ping 192.168.0.21 ping不通,则表示可用。
7,查看虚拟机ip地址,一般enp0s3下面的ip地址和主机ip地址不在一个网段里面,所以要修改虚拟机ip地址,现在虚拟机ip地址时192.168.0.21,是我修改后的ip地址。

8,根据物理主机的ip地址,设置linux虚拟机的ip地址:

114.114.114.114是国内移动、电信和联通通用的DNS,手机和电脑端都可以使用,干净无广告,解析成功率相对来说更高,国内用户使用的比较多,而且速度相对快、稳定,是国内用户上网常用的DNS;
8.8.8.8是GOOGLE公司提供的DNS,该地址是全球通用的,相对来说,更适合国外以及访问国外网站的用户使用
9,查看dns服务器,
cat /etc/resolv.conf

保存退出,重启服务器。
10,重启网络: service network restart

11,在网络配置文件 /etc/sysconfig/network 中添加网关地址,网关地址跟主机网关一样。

12,关掉虚拟机防火墙:
systemctl stop firewalld.service
systemctl disable firewalld.service
13,关掉主机防火墙:

14,虚拟机ping百度:

15,虚拟机ping主机地址:ping 192.168.0.39

16,主机ping虚拟机地址:
