![无法在 Debian 11 上禁用 DHCP](https://linux22.com/image/777694/%E6%97%A0%E6%B3%95%E5%9C%A8%20Debian%2011%20%E4%B8%8A%E7%A6%81%E7%94%A8%20DHCP.png)
我在刀片服务器上安装了 IBM BladeCenter E 和 Debian 11,我正在尝试设置具有两个接口(每个刀片服务器上都提供)的网络:一个用于 NFS 的本地网络,另一个用于偶尔使用静态地址进行互联网访问。NFS 可以工作,有时静态地址也可以工作……直到我安装了 LXDE 及其附带的所有内容。
一开始,我只是在 USB 上安装了 Debian 11 netinst 发行版附带的程序,因为我无法在安装时设置网络。然后我不知怎么地能够通过 /etc/network/interfaces 静态配置网络,并安装了 NFS 客户端和 LXDE 以及一些其他东西,如 GCC、vim 和 numpy。
但是,在我重新启动它以查看 NFS 是否正常工作(它确实正常工作)后,我无法再连接到 Internet。它现在不断向所有接口添加动态地址,范围为 169.254.xx,据我现在了解,这意味着它无法连接到 DHCP 服务器(因为没有任何服务器)。没有安装 NetworkManager 或 netplan,并且 systemd-networkd 被禁用。我也尝试添加系统配置(如下所述:https://forums.debian.net/viewtopic.php?f=5&t=142839&sid=ca6b09a442b04ebec06fbcb6c64f0f9e),但这并没有帮助。
有人能告诉我解决这个问题的可能方法吗?提前谢谢!
ip a
输出:
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: enp16s0f0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e4:1f:13:18:9c:50 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.32/24 brd 192.168.2.255 scope global enp16s0f0
valid_lft forever preferred_lft forever
inet 169.254.15.226/16 brd 169.254.255.255 scope global enp16s0f0
valid_lft forever preferred_lft forever
inet6 fe80::e61f:13ff:fe18:9c50/64 scope link
valid_lft forever preferred_lft forever
3: enp16s0f1: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e4:1f:13:18:9c:52 brd ff:ff:ff:ff:ff:ff
inet 169.254.23.223/16 brd 169.254.255.255 scope global enp16s0f1
valid_lft forever preferred_lft forever
inet6 2001:67c:2198:44:e61f:13ff:fe18:9c52/64 scope global dynamic mngtmpaddr
valid_lft 2591997sec preferred_lft 604797sec
inet6 fe80::e61f:13ff:fe18:9c52/64 scope link
valid_lft forever preferred_lft forever
4: enxe61f13199c53: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
link/ether e6:1f:13:19:9c:53 brd ff:ff:ff:ff:ff:ff
inet 169.254.130.234/16 brd 169.254.255.255 scope global enxe61f13199c53
valid_lft forever preferred_lft forever
inet6 fe80::e41f:13ff:fe19:9c53/64 scope link
valid_lft forever preferred_lft forever
/etc/network/interfaces 的内容如下:
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto enp16s0f0
iface enp16s0f0 inet static
address 192.168.2.32
netmask 255.255.255.0
# The primary network interface
allow-hotplug enp16s0f1
auto enp16s0f1
iface enp16s0f1 inet static
address A-PERFECTLY-VALID-IP-ADDREESS
netmask 255.255.255.0
gateway A-WORKING-GATEWAY-ADDRESS
## dns-* options are implemented by the resolvconf package, if installed
#dns-nameservers WORKING-DNS-SERVER-ADDRESS1 WORKING-DNS-SERVER-ADDRESs2 8.8.8.8
还:
root@lomc32:/home/igors# systemctl status networking.service
● networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Active: active (exited) since Sat 2022-06-04 16:57:47 EEST; 5min ago
Docs: man:interfaces(5)
Process: 593 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=0/SUCCESS)
Main PID: 593 (code=exited, status=0/SUCCESS)
CPU: 48ms
Jun 04 16:57:47 lomc32 systemd[1]: Starting Raise network interfaces...
Jun 04 16:57:47 lomc32 systemd[1]: Finished Raise network interfaces.
root@lomc32:/home/igors# systemctl status networkd.service
Unit networkd.service could not be found.
我还尝试添加上述链接中描述的 systemd-networkd 配置,其信息与 /etc/network/interfaces 中的信息相同(/etc/systemd/networkd.conf 中的所有行均被注释掉),但这没有帮助。
另外,我尝试删除一些与 DHCP 相关的软件:
apt remove dhcpcd5 isc-dhcp-client isc-dhcp-common
其中 dhcpcd5 无论如何都没有安装,但这也没有帮助。