I’m noticing that my server, when it reboots, has no ethernet connection despite claiming that it does. If I manually stop and restart the connection, it’s fine. Without getting into the whys and wherefores (unless any of you know what’s happening) I thought I’d make a startup script to stop and restart the connection. Seems the following command ought to work:
$ sudo sleep 10 && service network restart
What I’m not clear on is how to execute a script that requires root privileges. What’s the best method? Thanks.
EDIT: Also, maybe it’s better to stop and restart the ethernet connection rather than network manager? Haven’t found how to do that yet…
EDIT: I just tried a crontab script as root. The script ran but restarting the network manager didn’t work. What I have to do is restart the ethernet connection itself. I’m having a hard time finding that online. All my hits are for restarting the network manager. Can’t find the right search terms…
Well… none of that worked. The only way to successfully “reset” the network connection is to go to gnome panel, choose Network—>Turn Off- and then Wired1 to restart. None of the command lines work. Not sure why or what the difference is?
That is not a satisfying reply. One does not say “none of the command lines work”. One always shows by copy/paste the prompt command line, the complete output and the new prompt line. It is the only way to show people here what you saw.
As an example. this is from one of my systems:
henk@boven:~> ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether ec:8e:b5:da:0d:0d brd ff:ff:ff:ff:ff:ff
altname enp1s0
inet 10.0.0.154/24 brd 10.0.0.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 2a02:a465:d34e:1:ee8e:b5ff:feda:d0d/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 6756sec preferred_lft 3156sec
inet6 fe80::ee8e:b5ff:feda:d0d/64 scope link
valid_lft forever preferred_lft forever
henk@boven:~>
Yeah, apologies. I did solve the problem though; after the right combination of search terms. Seems that, at some point, I had made my wired connection “available to other users”. Must have been me? I don’t remember doing so but how else did it happen? In Gnome, I deleted the Network “profile”, just to reset with a clean slate, and then made sure that “available to others” was unchecked and DHCP was set to automatic. This tip came from here:
(When issuing the command ip a, I noticed that my IP was set at 10.42.0.1.) It all works correctly now.