网络上的计算机不必要地运行 DHCP 服务器。
然而,Debian 似乎总是会用/etc/network/interfaces
从 DHCP 服务器获取的内容覆盖我输入的任何内容?
但是,如果我从网络中删除 DHCP 服务器,则 Debian 上的网络接口根本不会出现。
我想要的只是以太网接口上的静态地址。那可能吗?
/etc/网络/接口
# This file describes the network interfaces available on your system
# 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
# The primary network interface
#allow-hotplug enp2s0
auto enp2s0
iface enp2s0 inet static
address 192.168.1.51
netmask 255.255.255.0
gateway 192.168.1.1
但
# 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: enp2s0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:16:cb:9c:eb:ce brd ff:ff:ff:ff:ff:ff
inet 192.168.2.14/24 brd 192.168.2.255 scope global enp2s0
valid_lft forever preferred_lft forever
inet6 fe80::216:cbff:fe9c:ebce/64 scope link
valid_lft forever preferred_lft forever
如果我转到 Debian 机器,ifdown
然后执行此操作ifup
,那么界面就会恢复所需的静态地址和废话 DHCP 地址!
更新
root@imac51:~# systemctl status NetworkManager systemd-networkd
Unit NetworkManager.service could not be found.
● systemd-networkd.service - Network Service
Loaded: loaded (/lib/systemd/system/systemd-networkd.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:systemd-networkd.service(8)
root@imac51:~#