Ubuntu Server 有两个 IP 地址,但 netplan 中只分配了一个

Ubuntu Server 有两个 IP 地址,但 netplan 中只分配了一个

在此处输入图片描述

我输入了静态地址 192.168.3.3,但服务器在同一网卡上获得了第二个地址。我不知道如何关闭它,我无法关闭 DHCP,因为其余的网卡都需要它。

/etc/netplan/50-cloud-init.yaml


network:
  version: 2
  ethernets:
    ens160:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.3.3/24]
      gateway4: 192.168.3.6
      nameservers:
        addresses: [192.168.3.9, 192.168.3.20]

#编辑

dawid@ubuntu-vm:/etc$  ls -al /etc/netplan
total 24
drwxr-xr-x   2 root root  4096 Feb  7 14:21 .
drwxr-xr-x 118 root root 12288 Feb  7 15:38 ..
-rw-r--r--   1 root root   512 Jan 29 09:30 50-cloud-init.yaml
-rw-r--r--   1 root root   512 Feb  5 22:41 50-cloud-init.yaml.save
dawid@ubuntu-vm:/etc$ cat /etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system.  See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
#    sudo apt install ifupdown
DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:56326): DEBUG: 15:42:32.660: Processing input file /etc/netplan/50-cloud-in                                                                               it.yaml..
** (generate:56326): DEBUG: 15:42:32.738: starting new processing pass
** (generate:56326): DEBUG: 15:42:32.739: We have some netdefs, pass them through a fina                                                                               l round of validation
** (generate:56326): DEBUG: 15:42:32.739: ens160: setting default backend to 1
** (generate:56326): DEBUG: 15:42:32.740: Configuration is valid
** (generate:56326): DEBUG: 15:42:32.740: Generating output files..
** (generate:56326): DEBUG: 15:42:32.741: openvswitch: definition ens160 is not for us (                                                                               backend 1)
** (generate:56326): DEBUG: 15:42:32.741: NetworkManager: definition ens160 is not for u                                                                               s (backend 1)
(generate:56326): GLib-DEBUG: 15:42:32.743: posix_spawn avoided (fd close requested)
(generate:56326): GLib-DEBUG: 15:42:32.747: posix_spawn avoided (fd close requested)

dawid@ubuntu-vm:/etc$ ls -al /etc/resolv*
lrwxrwxrwx 1 root root   39 Feb 14  2019 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

/etc/resolvconf:
total 20
drwxr-xr-x   3 root root  4096 Feb  2 10:55 .
drwxr-xr-x 118 root root 12288 Feb  7 15:38 ..
drwxr-xr-x   2 root root  4096 Feb  2 10:55 update-libc.d
dawid@ubuntu-vm:/etc$ cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0 trust-ad
search domain.local

相关内容