博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
VMware虚拟机与主机联通及配置上网
阅读量:7011 次
发布时间:2019-06-28

本文共 1975 字,大约阅读时间需要 6 分钟。

vmware版本:10.0.0 build-1295980,安装redhat enterprise linux 5.8

一、物理机与虚拟机联通,但不联网

1、虚拟网络VMnet1设置:

 

此时,物理主机会自动添加一块虚拟的网卡VMnet1:

 

2、修改相应的虚拟网卡VMnet1的属性(网关与虚拟机里所安装系统的网关一致,IP设为同一网段)

3、虚拟机设置---->网络连接,修改如下:

 4、测试连接:

物理主机windows: ping VMnet1的IP通。ping 192.168.1.2

虚拟机系统linux: ping VMnet1的IP通。ping 192.168.1.2

物理主机windows和虚拟机linux 两者互ping也能联通。

这个方法是在主机上虚拟出一块网卡VMnet1,物理机与vmware通过这个虚拟网卡进行通信。

linux系统IP配置如下:

[root@rhel201 firefox]# cat /etc/hosts# Do not remove the following line, or various programs# that require network functionality will fail.127.0.0.1               localhost.localdomain localhost192.168.1.201   rhel201.com     rhel201[root@rhel201 firefox]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)DEVICE=eth0BOOTPROTO=staticDHCPCLASS=HWADDR=00:0C:29:C5:02:E2ONBOOT=yesIPADDR=192.168.1.201 NETMASK=255.255.255.0GATEWAY=192.168.1.1

二、配置linux系统能上网

使用桥接的方式使用虚拟机连接到物理主机的网络适配器(使用桥接方式时,虚拟网卡VM将不需要,会被自动卸载,一般配置Vmware里安装的操作系统与物理主机通信时使用该方式,这样虚拟机也能上网)如下,我的连接到无线网卡。

 

2、配置linux系统DNS,修改如下文件:

[root@rhel201 firefox]# cat /etc/resolv.conf

#search localdomain
nameserver 222.172.200.68
nameserver 61.166.150.123

3、测试上网连接正常

[root@rhel201 firefox]# ping www.baidu.comPING www.a.shifen.com (180.97.33.107) 56(84) bytes of data.64 bytes from 180.97.33.107: icmp_seq=1 ttl=54 time=142 ms64 bytes from 180.97.33.107: icmp_seq=3 ttl=54 time=76.6 ms64 bytes from 180.97.33.107: icmp_seq=4 ttl=54 time=267 ms--- www.a.shifen.com ping statistics ---4 packets transmitted, 3 received, 25% packet loss, time 7462msrtt min/avg/max/mdev = 76.610/162.193/267.104/78.961 ms[root@rhel201 firefox]# ping www.taobao.comPING www.gslb.taobao.com.danuoyi.tbcache.com (116.55.241.241) 56(84) bytes of data.64 bytes from 241.241.55.116.broad.km.yn.dynamic.163data.com.cn (116.55.241.241): icmp_seq=1 ttl=48 time=242 ms

 三、vmware server版本的虚拟机与主机通信

vi /etc/sysconfig/network

加入GATEWAY=192.168.1.1

测试虚拟和主机互ping联通。

转载于:https://www.cnblogs.com/rusking/p/4262791.html

你可能感兴趣的文章
webapp字号大小跟随系统字号大小缩放
查看>>
[LeetCode] 430. Flatten a Multilevel Doubly Linked List
查看>>
常用布局
查看>>
交互式数据可视化-D3.js(四)形状生成器
查看>>
浅谈easy-mock 最好的备胎没有之一
查看>>
ES学习笔记(6)--数字操作
查看>>
数据上报分析一
查看>>
Vue.js 3.0 新特性预览
查看>>
什么是Jython?
查看>>
实现前后端分离的心得
查看>>
LeetCode 144 ——二叉树的前序遍历
查看>>
Windows上的Redis
查看>>
nginx系列2----从源码安装nginx和echo-nginx-module模块
查看>>
简洁易用的基于Promise的jsonp库easy-jsonp,了解下
查看>>
PHP-FPM设置max_chindren、max_requests
查看>>
[LintCode/LeetCode] Count Univalue Subtrees
查看>>
JS -- offsetXY、clientXY、pageXY、screenXY的区别
查看>>
每日一题 / 在yii2的restful中,如何复写action?
查看>>
使用MDK5新建STM32开发环境
查看>>
java时区理解
查看>>