“Ubuntu配置网络和hostname”的版本间的差异
跳到导航
跳到搜索
docker>Evan (→网络) |
(→网络) |
||
(未显示同一用户的1个中间版本) | |||
第40行: | 第40行: | ||
netplan apply#,可以立即生效 此处ip 为192.168.88.59 | netplan apply#,可以立即生效 此处ip 为192.168.88.59 | ||
+ | |||
+ | DNS | ||
+ | |||
+ | cat /etc/systemd/resolved.conf | ||
+ | [Resolve] | ||
+ | DNS=223.6.6.6 | ||
+ | #FallbackDNS= | ||
+ | #Domains= | ||
+ | LLMNR=no | ||
+ | |||
+ | |||
+ | systemctl restart systemd-resolved.service | ||
+ | |||
</pre> | </pre> | ||
+ | |||
+ | [https://blog.csdn.net/weixin_43640082/article/details/83859885 Ubuntu 18.04 永久修改DNS的方法] | ||
+ | |||
==ubuntu16.04== | ==ubuntu16.04== |
2019年10月29日 (二) 02:17的最新版本
18.04 server
sudo hostnamectl set-hostname "k8s-master" vi /etc/cloud/cloud.cfg preserve_hostname: false ---> 改成 true vi /etc/hostname reboot
ubuntu server 18.04版本netplan网络配置
网络
ubuntu18.04
cat /etc/netplan/50-cloud-init.yaml # This file is generated from information provided by # the datasource. Changes to it will not persist across an instance. # To disable cloud-init's network configuration capabilities, write a file # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following: # network: {config: disabled} network: ethernets: ens18: addresses: - 192.168.88.59/24 gateway4: 192.168.88.1 nameservers: addresses: [8.8.4.4] optional: true version: 2 netplan apply#,可以立即生效 此处ip 为192.168.88.59 DNS cat /etc/systemd/resolved.conf [Resolve] DNS=223.6.6.6 #FallbackDNS= #Domains= LLMNR=no systemctl restart systemd-resolved.service
ubuntu16.04
root@ubuntu16:~# cat /etc/network/interfaces source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto ens18 #iface ens18 inet dhcp iface ens18 inet static address 192.168.88.30 netmask 255.255.255.0 gateway 192.168.88.1 dns-nameserver 8.8.4.4