zoukankan      html  css  js  c++  java
  • VMware 下的CentOS6.7 虚拟机与Windows7通信

                 在有网络的情况下,VMware 虚拟机使用桥接模式(Bridged) 和NAT方式,会自动通信,但是在没有网络的情况下怎么办呢?对,是的,使用host-only模式,如何设置呢?

                 注:将Windows上的虚拟网卡改成跟Linux上的网卡在同一网段, 一定要将widonws上的WMnet1的IP设置和你的虚拟机在同一网段,但是IP不能相同.


      第一步: 打开VMware  Workstation 软件,选择Edit--->Virtual NetWork Editor ,设置Subnet IP和Subnet mask,如下图:

                


      第二步:打开win7下的  控制面板 -->网络和 Internet -->网络连接,右键VMware Network Adapter VMnet1 ,设置host-only模式下与虚拟机通信的,该win7的静态ip地址.

               

               当然,要让虚拟机和WIN7互相通信,还需关闭各自系统的防火墙,win7防火墙关闭就不介绍了 ;除此之外,设置的静态IP 要在同一网段 .


       第三步: 虚拟机CentOS IP 、主机名 和防火墙配置.

                                1、首先我们的虚拟机使用host-only模式 ., 右键CenOS,选择settings,如下图:

                            


                         2、修改虚拟机CentOS IP 地址

                              进入虚拟机,打开终端命令行,输入 命令修改ip

    [root@itcast01 Desktop]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
    

                              


                            3、修改主机名                      

    root@itcast01 Desktop]# vim /etc/sysconfig/network

                 

                4、修改主机名和IP的映射关系            

    [root@itcast01 Desktop]# vim /etc/hosts
    


            5、关闭防火墙   

    [root@itcast01 Desktop]# service iptables stop  
    为了防止下次开机时,防火墙自动启动,执行如下命令

    [root@itcast01 Desktop]# chkconfig iptables off
    

    注:   查看防护墙状态                          service iptables status

    关闭                                            service iptables stop
    查看防火墙开机启动状态     chkconfig iptables --list

    关闭开机启动                      chkconfig iptables off


             

    5 、重启CenOS 虚拟机.


    6、查看下windows 和cenos虚拟机是否能够通信.

        1、windows cmd 下ping 虚拟机的IP. 

           

            windows访问虚拟机网路是通的.

           2、虚拟机访问windows是否能通。



    至此,windows和虚拟机的网络已经打通了.


    centos从7开始默认用的是firewalld,这个是基于iptables的,虽然有iptables的核心,但是iptables的服务是没安装的。所以你只要停止firewalld服务即可: 
    sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service

    如果你要改用iptables的话,需要安装iptables服务: 
    sudo yum install iptables-services 
    sudo systemctl enable iptables && sudo systemctl enable ip6tables 
    sudo systemctl start iptables && sudo systemctl start ip6tables



















              

  • 相关阅读:
    三剑客
    走近SQL Server的游标
    PostSharp的AOP设计在.NET Remoting中的应用
    总结在使用VB 6.0和C#编写ActiveX控件的实践 (一)
    动态为程序指定快捷键
    为Reporting Service部署自定义程序集可能遇到的问题
    如何更改服务器名称
    如何产生固定的随机数(VBA)
    使用HTTP发送消息(消息队列技术)
    使用TransactionScope做分布式事务协调
  • 原文地址:https://www.cnblogs.com/wuyida/p/6300307.html
Copyright © 2011-2022 走看看