Score:0

Debian Server loses network connection

il flag

Problem

My debian server seems to lose network connection after a random amount of time (sometime after an hour, sometimes after a week, sometimes something in between). The server is hosted at a datacenter, so I do not have console access, except I order a KVM. When I restart the server remotely and boot in a rescue system, the server regains network connectivity.

At first I was not sure, whether the server froze or the network connection got lost. I ran a script which pinged 1.1.1.1 every minute and logged that to a file. I just checked that file and can now confirm, that the script was still running but could not reach 1.1.1.1 before I restarted the server.

Troubleshooting workflow

  1. Restart server via remote reboot (feature of the datacenter)
  2. Reboot into rescue system (virtual KVM)
  3. Check logs in /var/logs

Question

What can I do to determine the cause of this problem?

A.B avatar
cl flag
A.B
Among the myriad of imaginable tests, you could keep running `ip -ts monitor` redirected to a file. Maybe it will give more information about what happens when the connectivity is lost. Anyway, having a remote console available to remotely do interactive actions while the server is still without network connectivity would be way better.
Marco Frost avatar
il flag
@A.B I'll give ip monitor a shot. Also I will try to get a remote console when the next outage strikes. What would be a good workflow to determine the cause then?
A.B avatar
cl flag
A.B
Really, if I knew, I'd have written an answer.
awado avatar
us flag
Do you get an IP via DHCP or is it a static one? Recently I was experiencing a similar issue with this cause. Also with debian.
Marco Frost avatar
il flag
@awado It's a static ip.
in flag
Write a script that gathers all available information about the current network state (IP, link state, routes, iptables etc.) and write it in a file. Call that script via cron. Analyze the file after the next disconnect.
A.B avatar
cl flag
A.B
@GeraldSchneider fwiw, that's the role of `ip -ts monitor` all of its own in realtime, except for iptables . (with iptables-nft) `nft monitor ruleset | ts` would also track rule changes in the same way.
A.B avatar
cl flag
A.B
`stdbuf -oL xtables-monitor -e | ts` is more useful (displays process name/pid too). There's also `tc monitor` `ethtool --monitor` and probably a few others to complement this.
awado avatar
us flag
@A.B: Thanks for this hint. BTW: `ts` must be installed manually and is part of `moreutils` in debian.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.