Virtualbox上CentOS虚拟机配置动态与静态IP方式实现与主机连通和上外网
动态IP方式
1)首先获得主机(WIN7)网络IP信息如下:
嘉定网站制作公司哪家好,找创新互联公司!从网页设计、网站建设、微信开发、APP开发、响应式网站设计等网站项目制作,到程序开发,运营维护。创新互联公司于2013年创立到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联公司。


2)需要把安装完Virtualbox后生成的虚拟网卡的IP修改成与主机的IP地址为同一网段的IP,我这是改成192.168.1.110

2)需要把安装完Virtualbox后生成的虚拟网卡的IP修改成与主机的IP地址为同一网段的IP,我是改成192.168.1.110


3)接着在Virtualbox5.2上新建虚拟机,采用“桥接”方式配置虚拟机网卡信息并记录MAC地址,如下图如示:

4)要虚拟机上安装CentOS7,过程略……
5)启动CentOS,用vim(vi)打开并编辑ifcfg-enp0s3(有些版本的系统不一定是这个名字)。


6)配置完了之后测试一下与主机是不是通的,能不能上外网
Ping主机是通的:

wget命令:


静态IP方式
(1)同上
(2)同上
(3)同上
(4)同上
(5)配置网卡配置文件,首先/etc/sysconfig/network文件如下:

注意:这个必须是主机的网关地址而不是虚拟网卡网关。
然后配置/etc/sysconfig/network-scripts/ ifcfg-enp0s3

以上两种方法都能实现与主机的互通以及上外网。
网页名称:Virtualbox上CentOS虚拟机配置动态与静态IP方式实现与主机连通和上外网
标题路径:http://pwwzsj.com/article/gsoges.html