Network

DNS

/etc/network/interfaces.d/50-cloud-init

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  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}
auto lo
iface lo inet loopback
    #dns-nameservers 8.8.8.8 1.1.1.1
    dns-search example.com

auto eth0
iface eth0 inet static
    address x.x.x.x/24
    gateway x.x.x.1
    dns-nameservers 8.8.4.4 1.0.0.1

# control-alias eth0
iface eth0 inet6 static
    address ::/64
    gateway x:x:x:x::1

resolvconf

修改了 /etc/network/interfaces.d/50-cloud-init 后,执行以下命令:

1
2
3
4
reboot
# Wait for the system to reboot and come back online
resolvconf -l
cat /etc/resolv.conf
Licensed under CC BY-NC-SA 4.0