码迷,mamicode.com
首页 > 系统相关 > 详细

ubuntu18.04网络配置

时间:2019-08-17 16:27:00      阅读:409      评论:0      收藏:0      [点我收藏+]

标签:tls   自动获取   etc   multicast   version   support   net   ica   sse   

ubuntu18.04网络配置

YAML文件格式:常量值,对象,数组

YAML学习

dhcp自动获取:

root@ubuntu:~# grep -Ev "^$|#" /etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    ens33:
      dhcp4: yes
root@ubuntu:~# netplan apply   #应用

静态IP(单个IP):

root@ubuntu:~# grep -Ev "^$|#" /etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    ens33:
      dhcp4: no
      addresses: [192.168.38.130/24]
      gateway4: 192.168.38.2
      nameservers:
              addresses: [8.8.8.8]
root@ubuntu:~# netplan apply

静态IP(多个IP),采用数组格式

root@ubuntu:~# grep -Ev "^$|#" /etc/netplan/01-netcfg.yaml 
network:
  version: 2
  renderer: networkd
  ethernets:
    ens33:
      dhcp4: no
      addresses:
        - 192.168.38.130/24
        - 192.168.38.103/24
      gateway4: 192.168.38.2
      nameservers:
              addresses:
                - 192.168.38.2
                - 8.8.8.8
root@ubuntu:~# netplan apply

DNS查看

root@ubuntu:~# ll /etc/resolv.conf 
lrwxrwxrwx 1 root root 39 Jul 18 01:36 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

root@ubuntu:~# systemd-resolve --status 
Global
       LLMNR setting: no
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa
                      29.172.in-addr.arpa
                      30.172.in-addr.arpa
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 3 (docker0)
      Current Scopes: none
DefaultRoute setting: no
       LLMNR setting: yes
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

Link 2 (ens33)
      Current Scopes: DNS
DefaultRoute setting: yes
       LLMNR setting: yes
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 192.168.38.2
                      8.8.8.8

ubuntu18.04网络配置

标签:tls   自动获取   etc   multicast   version   support   net   ica   sse   

原文地址:https://blog.51cto.com/14012942/2430357

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!