ok so i'm not very good at linux so treat me like an idiot if you have any help
so i installed crunchbang on on my old computer to act as a headless server mainly as a web server for a pet project personal website (will receive very little traffic) and also as a kind of storage,backup and download manager. i'd used crunchbang before and liked it so thought it would be good for this.
problem is within every 12 hours it drops connection to the router and is no longer listed as an attached device. As it's a headless server this means i cant ssh/vnc into it to do anything remotely and If it's rebooted manually it reestablishes the connection and works again for another 10-12 hours. The router is netgearWGR614v9 and is the DHCP server and both my main computer and the server have reserved IP addresses. my main computer seems to work fine past this point and i left it up for over 2 days now and it still is attached to the router or has renewed the connection automatically. There is another computer and 2 wireless smart phones on non reserved addresses.
to try and test it i set up a cron job to do a single ping with a time stamp every 3 mins. I had hoped that this might also keep the connection alive and stop it dropping the connection or renewing connection and attaching the device, but it didn't, it does at least show me when it's active.
the active time till the first ping fails is
Thu Oct 18 10:24:02 -> Thu Oct 18 21:51:01
Thu Oct 18 22:45:01 -> Fri Oct 19 08:18:01
Fri Oct 19 11:12:01 -> Fri Oct 19 22:54:01
Fri Oct 19 23:21:02 -> Sat Oct 20 11:06:01
Then i tried to restart the networking interface 1 per hour - again hoping this would be a workaround to reestablishing the connection - i'm out of my depth here but found various googled stuff about it. So i tried a root crontab with /etc/init.d/networking stop; /etc/init.d/networking start
and it said Deconfiguring network interfaces...done.
Configuring network interfaces...done.
but when it dropped from the router this didnt' reattach it
i read this was depreciated and tried what i seen on a site
# ifdown eth0 && ifup eth0
but i get
ifdown: interface eth0 not configured
Ignoring unknown interface eth0=eth0.
eth0 Link encap:Ethernet HWaddr
inet addr:192.168.1.14 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::217:31ff:fe2f:ae52/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1910 errors:0 dropped:0 overruns:0 frame:0
TX packets:1239 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:602180 (588.0 KiB) TX bytes:917378 (895.8 KiB)
Interrupt:21 Base address:0xe000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:2390 (2.3 KiB) TX bytes:2390 (2.3 KiB)
so does anyone have any ideas why this is happening? or how to force the connection to be active or at least how to automatically restore the connection without having to reboot ?
cheers for any help
Last edited by Connoro (2012-10-29 14:08:23)
first thing I'd suggest is to set a static IP address, rather than using DHCP.
If that doesn't help, for the cron job, instead of 'ifdown' try:
# ip link set eth0 down && ip link set eth0 up
Let us know how you get on!
thanks for your help
# ip link set eth0 down && ip link set eth0 up
didn't work (probably due to the actual problem or me doing it wrong) but i think it's helped me as once i ran it, it dropped the ability to communicate with the internet but was still attached to the router and i could still vnc into it and try more stuff.
reading Setting up your IP address from http://www.debian-administration.org/ar … king_setup
my /etc/network/interfaces just had
# The loopback network interface auto lo iface lo inet loopback
# The primary network interface - use DHCP to find our address auto eth0 iface eth0 inet dhcp
then when i ran
# /etc/init.d/networking stop && /etc/init.d/networking start
Deconfiguring network interfaces...done.
Configuring network interfaces...Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0/00:17:31:2f:ae:52
Sending on LPF/eth0/00:17:31:2f:ae:52
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
DHCPOFFER from 192.168.1.1
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.14 -- renewal in 39873 seconds.
previously it had just said reconfiguring is done - the bit in red is also approx 11 hours which is how long it took for me to drop connection. Hopefully now it will auto renew it's DCHP connection and if not i'll test out your first suggestion of setting up a static ip
Glad I was of some use
Ok well adding that line in /etc/network/interfaces did change it but when the lease expired it still didn't renew it but now with the crontab /etc/init.d/networking stop; /etc/init.d/networking start it actually works and it gets a new lease and it's been running happily for the last few days solid