zoukankan      html  css  js  c++  java
  • ubuntu 18.04修改静态ip地址

    1. 确认网卡名称

    ip a  #有ens开头的网卡,比如我的是ens160
    

    2. DHCP的方式获取动态ip

    vim /etc/netplan/00-installer-config.yaml
    
    network:
      ethernets:
          ens160:
              dhcp4: yes
              addresses: []
    
      version: 2
    

    3. 设置静态ip

    vim /etc/netplan/00-installer-config.yaml
    network:
      ethernets:
          ens160:
              dhcp4: no
              addresses: [172.16.200.6/24]
              optional: true
              gateway4: 172.16.200.254
              nameservers:
                  addresses: [202.96.128.86,202.96.128.166]
    
    
      version: 2
    

    4. 应用新的网卡配置信息

    netplan apply
    

    5. 测试网络连通性

    ping www.baidu.com

    PING www.a.shifen.com (14.215.177.39) 56(84) bytes of data.
    64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=1 ttl=55 time=6.39 ms
    64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=2 ttl=55 time=6.53 ms
    64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=3 ttl=55 time=6.66 ms
    64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=4 ttl=55 time=6.41 ms
    64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=5 ttl=55 time=6.43 ms
    64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=6 ttl=55 time=6.52 ms
    64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=7 ttl=55 time=6.39 ms
    64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=8 ttl=55 time=6.56 ms
    64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=9 ttl=55 time=6.54 ms

  • 相关阅读:
    GLSL 变量属性
    php读取大文件的方法
    php 3种常见设计模式
    php类自动装载、链式操作、魔术方法
    统计文件中关键词出现的次数
    python先序、中序、后序排序
    Nginx缓存、压缩配置
    Ninx虚拟主机的配置
    python爬虫代码
    Nginx在安装过程经常出现的问题
  • 原文地址:https://www.cnblogs.com/Jack1023/p/14813606.html
Copyright © 2011-2022 走看看