I have 2 Debian Stretch Machine, that lost connection if idle for period of times. To disable this behavior i take this command:
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
Source was at: https://wiki.debian.org/Suspend