Glam Prestige Journal

Bright entertainment trends with youth appeal.

I have a Ubuntu PC at work and it is connected to the local network. Lately (possibly after some updates and the version upgrade, but not 100% sure) it started to lose its Internet connection while still being on. It's really inconvenient as I cannot ssh to it. When I come once a week to the office and replug the cable, the connection gets restored. So I assume that it triggers the system to initialise the connection again, or something. While I'm at the computer, it has no problems. But then when I leave, after some hours it goes offline again.

I suppose that something triggers the system to lose the connection. Apart from a fresh system install, is it possible to do anything to quickly fix this issue? Perhaps run some script that would force to renew the connection? Like once an hour turn off and then turn on the network?

3

1 Answer

I ended up running this script in the background, inspired by , which helped me to solve the problem. The connection still goes off from time to time, but importantly, it then gets restored thanks to the script.

#!/bin/bash
while :
do if ! ping -I eno1 -c 1 google.com; then echo $(date) "No network connection" >> network_out ifconfig eno1 down sleep 5 ifconfig eno1 up fi sleep 600
done

Here, eno1 is the name of my ethernet interface. In a loop, if it cannot ping google.com, then it shuts down the network connection, sleeps for 5 seconds, and then turns the connection on again.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy