一、说明
centos7安装完成后,默认是一个网卡,且连接方式为:网络地址转换(NAT)。
此时进入系统,打开有线链接,是可以访问网络的。
我们实现的方式是:不动当前的网卡,再新增一个网卡,选择连接方式:仅主机(Host-Only)网络。
目前我们配置如下:
网卡 | 连接方式 | 用途 |
---|---|---|
网卡1 | 网络地址转换(NAT) | 虚拟机联网 |
网卡2 | 仅主机(Host-Only)网络 | 主机与虚拟机网络相通,固定IP |
使用的虚拟机是VirtualBox,使用的系统是Centos7。
二、网路检测
进入系统,执行ping网络请求
ping www.baidu.com
显示如下:
PING www.baidu.com (183.232.231.174) 56(84) bytes of data.
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=1 ttl=54 time=11.6 ms
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=2 ttl=54 time=11.5 ms
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=3 ttl=54 time=12.3 ms
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=4 ttl=54