Debian 随机更改 IP 地址

Debian 随机更改 IP 地址

我有 debian6,接口是手动设置的:

eth0      Link encap:Ethernet  HWaddr 40:61:86:7c:42:ed
          inet addr:192.168.3.238  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::4261:86ff:fe7c:42ed/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:25460712 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15936414 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:20505323410 (19.0 GiB)  TX bytes:3909617144 (3.6 GiB)
          Interrupt:25

该机器用作 DHCP 服务器(isc-dhcp-server)和 DNS 转发器(bind9)和 shorewall。

最近随机将 IP 地址更改为eth0192.168.0.1,甚至完全删除 IP 设置。我无法从该机器或本地网络上的任何其他机器连接互联网。

我该怎么做才能阻止这种行为?如何跟踪对此负责的服务?

接口内容

auto eth0
iface eth0 inet static
    address 192.168.3.238
    netmask 255.255.255.0
    gateway 192.168.3.1

auto eth1
iface eth1 inet static
    address 10.0.0.1
    netmask 255.0.0.0
    network 10.0.0.0
    broadcast 10.0.0.255

报告来自syslog

Mar 15 10:44:22 debian avahi-daemon[2189]: Withdrawing address record for 192.168.3.238 on eth0.
Mar 15 10:44:22 debian avahi-daemon[2189]: Leaving mDNS multicast group on interface eth0.IPv4 with address 192.168.3.238.
Mar 15 10:44:22 debian avahi-daemon[2189]: Interface eth0.IPv4 no longer relevant for mDNS.
Mar 15 10:44:22 debian dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
Mar 15 10:44:22 debian kernel: [1107087.393431] martian source 10.0.40.1 from 10.0.40.167, on dev eth0
Mar 15 10:44:22 debian kernel: [1107087.393439] ll header: ff:ff:ff:ff:ff:ff:00:4f:67:03:b0:1f:08:06
Mar 15 10:44:22 debian kernel: [1107087.901047] martian source 10.0.40.1 from 10.0.40.185, on dev eth0
Mar 15 10:44:22 debian kernel: [1107087.901056] ll header: ff:ff:ff:ff:ff:ff:00:1e:58:0d:08:df:08:06
Mar 15 10:44:23 debian dhclient: Internet Systems Consortium DHCP Client 4.1.1-P1
Mar 15 10:44:23 debian dhclient: Copyright 2004-2010 Internet Systems Consortium.
Mar 15 10:44:23 debian dhclient: All rights reserved.
Mar 15 10:44:23 debian dhclient: For info, please visit https://www.isc.org/software/dhcp/
Mar 15 10:44:23 debian dhclient:
Mar 15 10:44:23 debian dhclient: /etc/dhcp/dhclient.conf line 19: no option named domain-nameserver in space dhcp
Mar 15 10:44:23 debian dhclient: supersede domain-nameserver 10.
Mar 15 10:44:23 debian dhclient:            ^
Mar 15 10:44:23 debian dhclient: /etc/dhcp/dhclient.conf line 20: semicolon expected.
Mar 15 10:44:23 debian dhclient: prepend
Mar 15 10:44:23 debian dhclient:  ^
Mar 15 10:44:23 debian dhclient: Listening on LPF/eth0/40:61:86:7c:42:ed
Mar 15 10:44:23 debian dhclient: Sending on   LPF/eth0/40:61:86:7c:42:ed
Mar 15 10:44:23 debian dhclient: Sending on   Socket/fallback
Mar 15 10:44:23 debian dhclient: DHCPRELEASE on eth0 to 192.168.0.1 port 67
Mar 15 10:44:23 debian dhclient: send_packet: Network is unreachable
Mar 15 10:44:23 debian dhclient: send_packet: please consult README file regarding broadcast address.
Mar 15 10:44:23 debian avahi-daemon[2189]: Interface eth0.IPv6 no longer relevant for mDNS.
Mar 15 10:44:23 debian avahi-daemon[2189]: Leaving mDNS multicast group on interface eth0.IPv6 with address fe80::4261:86ff:fe7c:42ed.
Mar 15 10:44:23 debian avahi-daemon[2189]: Withdrawing address record for fe80::4261:86ff:fe7c:42ed on eth0.
Mar 15 10:44:23 debian kernel: [1107088.283819] r8169 0000:02:00.0: eth0: link down
Mar 15 10:44:23 debian kernel: [1107088.283839] r8169 0000:02:00.0: eth0: link down
Mar 15 10:44:23 debian kernel: [1107088.284456] ADDRCONF(NETDEV_UP): eth0: link is not ready
Mar 15 10:44:23 debian dhclient: Internet Systems Consortium DHCP Client 4.1.1-P1
Mar 15 10:44:23 debian dhclient: Copyright 2004-2010 Internet Systems Consortium.
Mar 15 10:44:23 debian dhclient: All rights reserved.
Mar 15 10:44:23 debian dhclient: For info, please visit https://www.isc.org/software/dhcp/
Mar 15 10:44:23 debian dhclient:
Mar 15 10:44:23 debian dhclient: /etc/dhcp/dhclient.conf line 19: no option named domain-nameserver in space dhcp
Mar 15 10:44:23 debian dhclient: supersede domain-nameserver 10.
Mar 15 10:44:23 debian dhclient:            ^
Mar 15 10:44:23 debian dhclient: /etc/dhcp/dhclient.conf line 20: semicolon expected.
Mar 15 10:44:23 debian dhclient: prepend
Mar 15 10:44:23 debian dhclient:  ^
Mar 15 10:44:23 debian dhclient: Listening on LPF/eth0/40:61:86:7c:42:ed
Mar 15 10:44:23 debian dhclient: Sending on   LPF/eth0/40:61:86:7c:42:ed
Mar 15 10:44:23 debian dhclient: Sending on   Socket/fallback
Mar 15 10:44:23 debian dhclient: DHCPRELEASE on eth0 to 192.168.0.1 port 67
Mar 15 10:44:23 debian dhclient: send_packet: Network is unreachable
Mar 15 10:44:23 debian dhclient: send_packet: please consult README file regarding broadcast address.
Mar 15 10:44:23 debian kernel: [1107088.401716] r8169 0000:02:00.0: eth0: link down
Mar 15 10:44:23 debian kernel: [1107088.402152] ADDRCONF(NETDEV_UP): eth0: link is not ready
Mar 15 10:44:24 debian dhclient: Internet Systems Consortium DHCP Client 4.1.1-P1
Mar 15 10:44:24 debian dhclient: Copyright 2004-2010 Internet Systems Consortium.
Mar 15 10:44:24 debian dhclient: All rights reserved.
Mar 15 10:44:24 debian dhclient: For info, please visit https://www.isc.org/software/dhcp/
Mar 15 10:44:24 debian dhclient:

答案1

您的 syslog / dmesg 说什么?IP 地址的更改应导致日志文件中出现条目。这可能会提示您导致更改的原因(即 IP 更改之前的几行)。

例如,如果你手动重启网络,dmesg/syslog 中会弹出类似这样的信息

[47460.471835] r8169 0000:09:00.0:eth0:链接断开
[47460.473570] r8169 0000:09:00.0:eth0:链接断开
[47460.475690] ADDRCONF(NETDEV_UP):eth0:链接未准备好
[47463.368498] r8169 0000:09:00.0:eth0:链接
[47463.370603] ADDRCONF(NETDEV_CHANGE):eth0:链接已准备就绪

答案2

系统日志提示您已运行 dhclient 和 avahi。对于具有静态配置的服务器,最佳做法是使用 apt-get 删除 avahi-daemon 和 network-manager。您可以配置 avahi 不干扰 eth0,但这样做不值得。

删除 avahi 和网络管理器后,重新启动并运行ps ax以验证dhclient*是否avahi*未运行。

相关内容