自动获取ip配置
ip配置模板
osadmin@osadmin:~$ cat /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
version: 2
renderer: networkd
ethernets:
ens36:
dhcp4: true
osadmin@osadmin:~$ sudo netplan apply
## dns查看
osadmin@osadmin:~$ resolvectl status
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Link 2 (ens36)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
DNS Servers: 192.168.1.1
DNS Domain: localdomain
静态ip配置
静态ip配置文件修改
osadmin@osadmin:~$ cat /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
version: 2
renderer: networkd
ethernets:
ens36:
addresses: [192.168.1.202/24]
gateway4: 192.168.1.1
nameservers:
addresses: [114.114.114.114]
osadmin@osadmin:~$ sudo netplan apply
## dns查看
osadmin@osadmin:~$ resolvectl status
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Link 2 (ens36)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 114.114.114.114
DNS Servers: 114.114.114.114
全局dns配置
# 修改配置文件
osadmin@osadmin:~$ egrep -v "^#|^$" /etc/systemd/resolved.conf
[Resolve]
DNS=8.8.8.8
#重启服务
osadmin@osadmin:~$ sudo systemctl restart systemd-resolved.service
#查看dns配置
osadmin@osadmin:~$ resolvectl status
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
DNS Servers: 8.8.8.8
Link 2 (ens36)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
DNS Servers: 114.114.114.114
标签:DNSOverTLS,DNSSEC,ip,server,osadmin,DNS,Ubuntu,114.114
From: https://www.cnblogs.com/maituzideluobei/p/16977316.html