zoukankan      html  css  js  c++  java
  • VMware虚拟机与主机联通及配置上网

    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 localhost
    192.168.1.201   rhel201.com     rhel201
    [root@rhel201 firefox]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
    # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
    DEVICE=eth0
    BOOTPROTO=static
    DHCPCLASS=
    HWADDR=00:0C:29:C5:02:E2
    ONBOOT=yes
    IPADDR=192.168.1.201 
    NETMASK=255.255.255.0
    GATEWAY=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.com
    PING 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 ms
    64 bytes from 180.97.33.107: icmp_seq=3 ttl=54 time=76.6 ms
    64 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 7462ms
    rtt min/avg/max/mdev = 76.610/162.193/267.104/78.961 ms
    [root@rhel201 firefox]# ping www.taobao.com
    PING 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联通。

  • 相关阅读:
    EMIF接口的寻址问题
    C6000系类的内联函数
    C6000代码层面优化(一)
    RHCE学习笔记
    找出并关闭Ruby On Rails进程.
    Rails4添加bootstrap支持
    如何删除gnome3面板上的图标?
    出现 ruby cannot load such file -- zlib 问题的解决方法
    Debian安装软件时提示插入光盘
    Debian7桌面屏蔽图标和右键菜单的解决方法。
  • 原文地址:https://www.cnblogs.com/rusking/p/4262791.html
Copyright © 2011-2022 走看看