我的 Ubuntu 服务器似乎有两个 IP 地址(192.168.0.108 和 192.168.0.109),但我无法摆脱一个。
设备和设置:
- TP-LINK AX1500 路由器(处理 dhcp,DNS 重定向到 pihole)。
- Ubuntu 服务器 20.04
- Pihole 作为 DNS 安装并运行,当前已禁用阻止。TP-LINK 不做主机名解析,所以我使用 Pihole 创建本地 DNS 记录,以便所有设备都可以使用域/主机名而不是服务器 ip。
我从中看到的ip addr show
3: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 70:85:c2:a3:f3:fc brd ff:ff:ff:ff:ff:ff
inet 192.168.0.109/24 brd 192.168.0.255 scope global dynamic eno1
valid_lft 7100sec preferred_lft 7100sec
inet 192.168.0.108/24 brd 192.168.0.255 scope global secondary noprefixroute eno1
valid_lft forever preferred_lft forever
inet6 fe80::7285:c2ff:fea3:f3fc/64 scope link
valid_lft forever preferred_lft forever
运行此命令时,它会暂时删除 109,但在重新启动后会立即恢复。我也无法再远程连接到服务器,因为其他设备仍然认为它是 109。
ip address del 192.168.0.109/24 dev eno1
我在 /etc/netplan/01-netcfg.conf 中看到的
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
eno1:
dhcp4: yes
我在 /etc/dhcpcd.conf 中看到的
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.
hostname
# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
duid
# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
我在 /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
我修改了 /etc/pihole/setupVars.conf ,它确实有 109 作为 IPV4_ADDRESS 并将其设置为 108 但重启后 109 仍然没有消失。
PIHOLE_INTERFACE=eno1
IPV4_ADDRESS=192.168.0.108/24
IPV6_ADDRESS=
此外,奇怪的是在 TP-LINK 路由器界面中似乎在 UI 的不同部分显示具有不同地址的服务器。在 Network Map -> Clients 列表中,服务器显示为 108。但是,在 Advanced -> Network -> DHCP Server -> DHCP Client List 中,服务器显示为 109。
我不知道下一步该做什么以及如何修复具有两个 IP 地址的服务器。