我不认为我最近做了任何更改,所以认为可能是某个地方的 apt 更新起了作用。登录时,我的 WAN IP曾是唯一按预期显示的。最近,我们遇到了随机 WAN 丢失,现在显示 3 个 IPS。欢迎消息中显示的 1 是一个不再存在的旧 IPS。在 enp4s0f0 中,第一个 inet 是当前/准确的,但第二个 inet 我不认识,也不是过去列出的项目。它现在还显示 2 个 IPv6 地址,但我只有 1 组。
Welcome to Ubuntu 22.04 LTS (GNU/Linux 5.15.0-37-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Mon May 23 01:16:22 PM UTC 2022
System load: 0.28955078125
Usage of /: 4.5% of 915.81GB
Memory usage: 27%
Swap usage: 0%
Processes: 179
Users logged in: 0
IPv4 address for enp4s0f0: 75.128.204.107
IPv6 address for enp4s0f0: 2600:6c44:7025:200:8d37:f89a:4b4f:557a
IPv4 address for enp4s0f1: 192.168.0.1
* Super-optimized for small spaces - read how we shrank the memory
footprint of MicroK8s to make it the smallest full K8s around.
https://ubuntu.com/blog/microk8s-memory-optimisation
0 updates can be applied immediately.
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
Last login: Sun Jun 12 08:00:00 2022 from 192.168.0.51
triple_nothing@hzi:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever 2: enp4s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:30:48:64:b7:4e brd ff:ff:ff:ff:ff:ff
inet 47.34.32.179/23 brd 255.255.255.255 scope global dynamic enp4s0f0
valid_lft 56926sec preferred_lft 56926sec
inet 68.114.243.105/21 metric 100 brd 68.114.247.255 scope global dynamic enp4s0f0
valid_lft 27616sec preferred_lft 27616sec
inet6 2600:6c44:7025:200:8d37:f89a:4b4f:557a/128 scope global dynamic noprefixroute
valid_lft 315086sec preferred_lft 315086sec
inet6 fe80::230:48ff:fe64:b74e/64 scope link
valid_lft forever preferred_lft forever 3: enp4s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:30:48:64:b7:4f brd ff:ff:ff:ff:ff:ff
inet 192.168.0.1/24 brd 192.168.0.255 scope global enp4s0f1
valid_lft forever preferred_lft forever
inet6 fe80::230:48ff:fe64:b74f/64 scope link
valid_lft forever preferred_lft forever
triple_nothing@hzi:~$
这是我的 netplan 基本设置。我有 2 个物理端口。enp4s0f0 连接到我的 Internet 调制解调器,enp4s0f1 连接到我的交换机/路由器的 WAN。
network:
ethernets:
enp4s0f0:
dhcp4: true
optional: true
enp4s0f1:
addresses:
- 192.168.0.1/24
nameservers:
addresses:
- 192.168.0.1
- 8.8.8.8
search: []
optional: true
version: 2
我继续运行 sudo dhclient -r enp4s0f0 和 sudo dhclient enp4s0f0 来释放/更新。这确实删除了 v4 inet,但未删除 v6,但重启后第二个 inet 确实会重新出现。
triple_nothing@hzi:/etc/netplan$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp4s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:30:48:64:b7:4e brd ff:ff:ff:ff:ff:ff
inet 47.34.36.224/23 brd 255.255.255.255 scope global dynamic enp4s0f0
valid_lft 3591sec preferred_lft 3591sec
inet6 2600:6c44:7025:200:8d37:f89a:4b4f:557a/128 scope global dynamic noprefixroute
valid_lft 313463sec preferred_lft 313463sec
inet6 fe80::230:48ff:fe64:b74e/64 scope link
valid_lft forever preferred_lft forever
3: enp4s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:30:48:64:b7:4f brd ff:ff:ff:ff:ff:ff
inet 192.168.0.1/24 brd 192.168.0.255 scope global enp4s0f1
valid_lft forever preferred_lft forever
inet6 fe80::230:48ff:fe64:b74f/64 scope link
valid_lft forever preferred_lft forever
triple_nothing@hzi:/etc/netplan$
经过这样的更新,当退出并重新登录时,欢迎消息仍然会显示过去的 IP。