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

  • 相关阅读:
    循序渐进做项目系列(3):迷你QQ篇(1)——实现客户端互相聊天
    清明时节欲断魂——未知死焉知生?——向死而生!
    curl基本使用
    some tools
    redis源码学习
    设计模式
    object-c基础
    python库
    awk命令
    gcc编译
  • 原文地址:https://www.cnblogs.com/Jack1023/p/14813606.html
Copyright © 2011-2022 走看看