Linux losing network connection upon reboot sometimes

sup Sup Forums

I have my Linux server set to automatically reboot at 6:05am each morning to make sure it continues to keep itself online and not fuck anything up when I am away from home. Every 4 reboots it comes back up and continues chugging along but sometimes it just doesn't regain a network connection until I forcibly reboot the machine again.

I set a bash script to run every 5 mins via cron that pings my gateway and if not receiving a response it will

>sudo ifconfig up

it only seems to bring the network up if I have manually done

>sudo ifconfig down

that works. But when restarting the machine automatically, it doesn't bring it up at all and I need to force a full reboot again for it to start working. Anyone know what I've done wrong here?

the bashscript is:

#!/bin/bash


ping -c4 192.168.1.1 > /dev/null


if [ $? != 0 ]
then
logger "Network connection missing... restarting"
sudo ifconfig enp2s0 up
fi

and my dmesg looks like this:

dmesg |grep enp2s0
[ 3.004775] tg3 0000:02:00.0 enp2s0: renamed from eth0
[ 24.907703] IPv6: ADDRCONF(NETDEV_UP): enp2s0: link is not ready
[ 25.706788] IPv6: ADDRCONF(NETDEV_UP): enp2s0: link is not ready
[ 28.608742] tg3 0000:02:00.0 enp2s0: Link is up at 1000 Mbps, full duplex
[ 28.608747] tg3 0000:02:00.0 enp2s0: Flow control is off for TX and off for RX
[ 28.608769] IPv6: ADDRCONF(NETDEV_CHANGE): enp2s0: link becomes ready
nas@nas:~$ dmesg |grep ether
nas@nas:~$ dmesg |grep eth
[ 2.979952] tg3 0000:02:00.0 eth0: Tigon3 [partno(BCM95723) rev 5784100] (PCI Express) MAC address 00:9c:02:a0:3c:1c
[ 2.979956] tg3 0000:02:00.0 eth0: attached PHY is 5784 (10/100/1000Base-T Ethernet) (WireSpeed[1], EEE[0])
[ 2.979959] tg3 0000:02:00.0 eth0: RXcsums[1] LinkChgREG[0] MIirq[0] ASF[0] TSOcap[1]
[ 2.979962] tg3 0000:02:00.0 eth0: dma_rwctrl[76180000] dma_mask[64-bit]
[ 3.004775] tg3 0000:02:00.0 enp2s0: renamed from eth0


I guess it's the "link not ready" shit, but I don't understand how to fix it.

Other urls found in this thread:

centos.org/forums/viewtopic.php?t=44838
twitter.com/NSFWRedditVideo

What distro?
Are you up to date?

>enp2s0: renamed from eth0
Wired connection turning into a wireless connection? Check if the wireless card itself is faulty.

Static IP?

niggbuntu 16.04, everything is completely up to date. It's just used as a NAS and nothing else.

yeah my router has the mac address saved to give it the same static IP each and every time.

75% of the time it reboots and keeps chugging along but it's the remainder of the time it just simply doesn't come back up automatically at all with network access until I force another reboot

>Wired connection turning into a wireless connection? Check if the wireless card itself is faulty.


instead of eth0 the distros now use enps20 etc

its 'predictable interface names' now

Names incorporating Firmware/BIOS provided index numbers for on-board devices (example: eno1)
Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example: ens1)
Names incorporating physical/geographical location of the connector of the hardware (example: enp2s

It's a common problem with systemd.

I would have used FreeNAS on this machine but I don't have 8gb ram to spare just to run NAS software only.

I can stop it forcibly rebooting via cron at 6:05am each day but the whole purpose of that was so it keeps working and doesn't interrupt any of the media player clients in the house as they all pull the files off this machine (which also downloads from usenet and torrents new movies and tv and music)

I guess I can just leave it on and hope for the best. That's as good as it will get with Linux then, completely unreliable from one reboot to the next.

bit of a fucking joke really

go to stack exchange or some shit bitch

>yeah my router has the mac address saved to give it the same static IP each and every time.
Are you using dhclient on the server?

Welcome to Linux, where your time is deemed worthless

sudo dhclient
RTNETLINK answers: File exists


dunno what that means

Nah, networking is actually pretty solid on Linux. It's just really easy to screw things up when you set things up yourself.

You shouldn't use dhclient with a static IP.
"As your IP addresses are static, there should be no reason to have dhclient running at all. I would suggest editing your config files to have NM_CONTROLLED=no, then "yum remove dhclient NetworkManager" and "service network restart"."

You might have wake on lan enabled on your bios. It happened to me for awhile till I figured out how to turn it off in Windows (dual boot) and in bios.

centos.org/forums/viewtopic.php?t=44838
Forgot link.

thanks man I have nuked all of that bullshit - I'll see how this goes. I just don't wanna have to reinstall another distro and go through this whole fucking process again it's a huge pain in the ass to set everything up

hopefully this works. Otherwise I'll just run Windows 2012 server on it, which works fucking fine 100% of the time

Here comes the linux expert with all the free time in the world

New bait thread, good job Microsoft

hardly a bait thread, I posted a genuine problem and at least a couple of people told me what they might look at doing.

it's been driving me up the fucking wall for ages now. Problem is I wont know when it goes off the network unless I'm sitting right here. When I'm away from home the server is next to useless because who knows when its just gonna decide to not bother getting its network access back up

anyway thanks for all your advice goys, this thread can die off now. linux still sucks

...