Debian 服务器偶尔丢失默认网关

And*_*ker 7 networking routing debian-squeeze

我不确定是什么导致了我的不稳定,但这是我所知道的:

服务器正在运行没有 GUI 的 Debian。

我有一个静态 IP,并且 /etc/network/interfaces 配置了一个“网关 xxx1”条目。

我的服务器会定期失去所有 Internet 连接,当我可以访问它时,路由表中缺少默认网关。

由于此错误会停止到我服务器的所有流量,因此我设置了一个 cronjob 来定期尝试“路由添加默认 gw xxx1”,这样我就不必一直物理返回到机器上。我想要一个更好的解决方案...

/etc/network/interfaces:

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet static
address 192.168.0.121
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
up route add default gw 192.168.0.1
dns-nameservers 192.168.0.1
dns-search domain.com
Run Code Online (Sandbox Code Playgroud)

为什么条目:up route add default gw xxx1 在 /etc/network/interfaces 中工作以将网关保留在路由表中?此外,'gateway xxx1' 条目不应该已经确保默认网关保留在路由表中吗?

另外,我应该查看哪些日志文件来追踪这个重复发生的错误?

附带问题:DoS 类型的攻击会导致 eth0 宕机吗?

Gre*_*SAT 6

ifconfig命令不用于设置接口本身以外的任何内容,因此不涉及网关。

当您运行 时ifconfig down,网关会被内核删除,因为它发现它不再有效。

当您运行 时ifconfig up,内核无法猜测网关的任何信息。

您应该up对界面使用发行版特定的命令(例如对于 Debian this is ifup eth0),或明确使用该route命令。