页面“Redis备份与恢复”与“Ubuntu配置网络和hostname”之间的差异
(页面间的差异)
跳到导航
跳到搜索
(→网络) |
|||
第1行: | 第1行: | ||
− | = | + | =18.04 server= |
+ | <pre> | ||
+ | sudo hostnamectl set-hostname "k8s-master" | ||
− | + | vi /etc/cloud/cloud.cfg | |
+ | preserve_hostname: false ---> 改成 true | ||
− | + | vi /etc/hostname | |
− | |||
− | + | reboot | |
− | + | </pre> | |
− | + | [https://www.howtoing.com/configure-network-static-ip-address-in-ubuntu 如何在Ubuntu 18.04中配置网络静态IP地址] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | [https://www.cnblogs.com/jianxuanbing/p/10042892.html Ubuntu 18.04 Server 设置静态IP] | ||
+ | [https://www.jianshu.com/p/7b19961ff425 ubuntu server 18.04版本netplan网络配置] | ||
− | + | =网络= | |
− | = | + | ==ubuntu18.04== |
<pre> | <pre> | ||
+ | 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 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> | ||
− | + | [https://blog.csdn.net/weixin_43640082/article/details/83859885 Ubuntu 18.04 永久修改DNS的方法] | |
− | |||
− | |||
− | |||
− | + | ==ubuntu16.04== | |
+ | <pre> | ||
+ | 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 | ||
+ | </pre> | ||
− | [https:// | + | =Ubuntu 18.04 Server安装过程详解 = |
+ | [https://blog.csdn.net/zhengchaooo/article/details/80145744 Ubuntu 18.04 Server 版安装过程图文详解] | ||
− | [[category: | + | [https://blog.csdn.net/y472360651/article/details/80875056 Ubuntu 18.04-安装图文教程] |
+ | [[category:ops]] [[category:linux]] |
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