我有以下配置:
root@pihole:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback
allow-hotplug enp0s4
iface enp0s4 inet static
address 192.168.2.225
netmask 255.255.255.0
gateway 192.168.2.1
IP 不知为何被分配给了 192.168.2.110,但它应该是 .225:
root@pihole:~# systemctl restart networking.service
root@pihole:~# ifconfig
enp0s4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.110 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::2a0:98ff:fe2a:67fe prefixlen 64 scopeid 0x20<link>
ether 00:a0:98:2a:67:0e txqueuelen 1000 (Ethernet)
RX packets 5322438 bytes 1348940213 (1.2 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 333698 bytes 66021804 (62.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
有什么建议可以解释为什么会这样吗?此配置原本可以正常工作...但几天后它变为 .110。
编辑:添加“ip a”命令的输出,因为这表明IP被设置为“次要”:
2: enp0s4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:a0:98:2a:67:0e brd ff:ff:ff:ff:ff:ff
inet 192.168.2.110/24 brd 192.168.2.255 scope global enp0s4
valid_lft forever preferred_lft forever
inet 192.168.2.225/24 brd 192.168.2.255 scope global secondary enp0s4
valid_lft forever preferred_lft forever
inet6 fe80::2a0:98ff:fe2a:670e/64 scope link
valid_lft forever preferred_lft forever