AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1305003
Accepted
Matthew Wright
Matthew Wright
Asked: 2021-01-05 08:40:52 +0800 CST2021-01-05 08:40:52 +0800 CST 2021-01-05 08:40:52 +0800 CST

Ubuntu服务器有两个IP地址不知道为什么

  • 772

我的 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 地址的服务器。

networking
  • 1 1 个回答
  • 1360 Views

1 个回答

  • Voted
  1. Best Answer
    Matthew Wright
    2021-01-06T18:37:51+08:002021-01-06T18:37:51+08:00

    这个答案解决了我的问题。我没有尝试删除 109,而是在禁用和停止 dhcpcd 后删除了 108(辅助)。

    update-rc.d dhcpcd disable
    service dhcpcd stop
    ip addr del 192.168.0.108/24 dev eno1
    

    https://raspberrypi.stackexchange.com/a/33910

    • 0

相关问题

  • 如何设置 VLAN 转发?

  • 如何将主机 Ubuntu 上的 VPN (tun0) 网络适配器映射到 VirtualBox 来宾 Windows?

  • 如何限制下载/上传带宽?

  • 如何通过 Windows 网络共享文件?

  • 面板小程序以文本形式显示当前网络流量?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve