• VM12中CentOS7以NAT方式连接网络的方法


    解决问题:centos网络连不上,连不上主机,ifconfig等命令不能用(配完有网了,安装上就好了)等问题


    前提:安装vm12,centos7(最小安装) 


    注意:以下以192开头的,你都要替换成自己的,可在vm中找到(192.168.181.66:我自己设的ip,192.168.181.2:网关)



    (1)配置eno16777736(/etc/sysconfig/network-scripts/ifcfg-eno16777736),
    #配置开始#
    TYPE=Ethernet
    BOOTPROTO=static
    DEFROUTE=yes
    PEERDNS=yes
    PEERROUTES=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_PEERDNS=yes
    IPV6_PEERROUTES=yes
    IPV6_FAILURE_FATAL=no
    NAME=eno16777736
    UUID=4ee0a1dd-fd55-4a2c-acb3-732bf9766e04
    DEVICE=eno16777736
    ONBOOT=yes
    IPADDR0=192.168.181.66
    PREFIX0=24
    GATEWAY0=192.168.181.2
    NETMASK=255.255.255.0
    DNS1=8.8.8.8
    DNS2=114.114.114.114
    #配置结束#

    (2)配置DNS步骤1(/etc/NetworkManager/NetworkManager.conf ),
    #配置开始#
    # Configuration file for NetworkManager.
    #
    # See "man 5 NetworkManager.conf" for details.
    #
    # The directory /etc/NetworkManager/conf.d/ can contain additional configuration
    # snippets. Those snippets override the settings from this main file.
    #
    # The files within conf.d/ directory are read in asciibetical order.
    #
    # If two files define the same key, the one that is read afterwards will overwrite
    # the previous one.
    [main]
    plugins=ifcfg-rh
    dns=none
    [logging]
    #level=DEBUG
    #domains=ALL
    #配置结束#

    (3)配置DNS步骤2(/etc/resolv.conf),
    #配置开始#
    nameserver 8.8.8.8
    nameserver 114.114.114.114
    #配置结束#

    (4)注意网络是以NAT模式而不是桥接模式,注意配置完重启(systemctl restart network)

    @Arya0624

  • 相关阅读:
    centos7+tomcat部署JavaWeb项目超详细步骤
    centos7查看系统版本,查看机器位数x86-64
    MyEclipse运行时自动保存
    日期选择控件-laydate
    MD5加密Java实现
    反人类的MyEclipse之-MyEclipse设置Console字体大小
    数组排序-冒泡排序-选择排序-插入排序-希尔排序-快速排序-Java实现
    霍夫曼树,霍夫曼编码
    线索二叉树的构建
    二叉树的JAVA实现-二叉树的增删改查CRUD
  • 原文地址:https://www.cnblogs.com/Arry10/p/7731745.html
Copyright © 2020-2023  润新知