美文网首页
mac 通过ssh 连接VMvare 上的centos mini

mac 通过ssh 连接VMvare 上的centos mini

作者: yulekwok | 来源:发表于2021-03-25 21:42 被阅读0次

    mac 通过ssh 连接VMvare 上的centos mini 版本

    1. 打开自己的虚拟机设置相关的网络连接

    image-20210325212829180.png

    2. 编辑dhcpd.conf文件

    sudo vi /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf
    
    # Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet8.
    #
    # This file was automatically generated by the VMware configuration program.
    # See Instructions below if you want to modify it.
    #
    # We set domain-name-servers to make some DHCP clients happy
    # (dhclient as configured in SuSE, TurboLinux, etc.).
    # We also supply a domain name to make pump (Red Hat 6.x) happy.
    #
    
    
    ###### VMNET DHCP Configuration. Start of "DO NOT MODIFY SECTION" #####
    # Modification Instructions: This section of the configuration file contains
    # information generated by the configuration program. Do not modify this
    # section.
    # You are free to modify everything else. Also, this section must start 
    # on a new line 
    # This file will get backed up with a different name in the same directory 
    # if this section is edited and you try to configure DHCP again.
    
    # Written at: 03/25/2021 20:50:22
    allow unknown-clients;
    default-lease-time 1800;                # default is 30 minutes
    max-lease-time 7200;                    # default is 2 hours
    
    subnet 172.16.119.0 netmask 255.255.255.0 {
        range 172.16.119.128 172.16.119.254;  ⚠️注意一定要在这个范围之内
        option broadcast-address 172.16.119.255;
        option domain-name-servers 172.16.119.2;
        option domain-name localdomain;
        default-lease-time 1800;                # default is 30 minutes
        max-lease-time 7200;                    # default is 2 hours
        option netbios-name-servers 172.16.119.2;
        option routers 172.16.119.2;
    }
    host vmnet8 {
        hardware ethernet 00:50:56:C0:00:08;
        fixed-address 172.16.119.1;
        option domain-name-servers 0.0.0.0;
        option domain-name "";
        option routers 0.0.0.0;
    }
    ####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######
    
    # 在后面增加自己的
    # 名字随意写 我写的centos7
    host CentOS7 {     
                    #这里MAC地址和网络适配器保持一样的就行了
            hardware ethernet MAC地址;   
            #一定要在上面range范围内
            fixed-address 172.16.119.138; 
    }
    

    3. 重启自己的虚拟机软件和虚拟机

    4. 打开terminal 发现

    ssh root@172.16.119.138 
    # 呀!!!!! 怎么没有反应啊,此时的自己有点惆怅,其实本没有问题,原因是因为自己安装的centOS是mini版本没有一些命令
    

    5.登录服务器发现自己的ifconfig 不能使用

    6.mini版不能使用ifconfig问题

    6.1修改ifcfg-ens33

    vi /etc/sysconfig/network-scripts/ifcfg-ens33
    

    6.2修改 ONBOOT = yes

    TYPE=Ethernet
    PROXY_METHOD=none
    BROWSER_ONLY=no
    BOOTPROTO=dhcp
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    IPV6_ADDR_GEN_MODE=stable-privacy
    NAME=ens33
    UUID=57316d57-e3c3-4da0-b3a8-65a9df93db4f
    DEVICE=ens33
    ONBOOT=yes
    

    6.3重启网卡:service network restart

    6.4安装一些必要的命令工具

    yum install kernel-devel
    yum -y install vim  wget gcc cpp gcc-c++ make gdb  perl net-tools
    

    7.ssh登录自己的虚拟机服务器

    stevekwok@Steves-MBP ~ % ssh root@172.16.119.138
    The authenticity of host '172.16.119.138 (172.16.119.138)' can't be established.
    ECDSA key fingerprint is SHA256:zY1Ej34n4DY7j9aF+WPDY2I2LGqEzmjx/llZxgb881k.
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    Warning: Permanently added '172.16.119.138' (ECDSA) to the list of known hosts.
    root@172.16.119.138's password: 
    Last login: Fri Mar 26 04:50:48 2021
    

    相关文章

      网友评论

          本文标题:mac 通过ssh 连接VMvare 上的centos mini

          本文链接:https://www.haomeiwen.com/subject/cmzrhltx.html