4

I'm using my Raspberry Pi to set up a simple Apache Web Server using these instructions. The problem I am having is that the Web Server will come up for a little while but then seem to just stop working. I have connected my Raspberry Pi to the internet via an ethernet cable hooked up to my router.

I have sorted out forwarding of ports so that I can navigate to pi.mywebsite.com and it works fine. However, it works fine for about a minute after booting, then it just stops; ifconfig.me doesn't work and even accessing the Raspberry Pi over SSH doesn't work.

More information: When the Raspberry Pi stops being able to connect to the internet the Pi still works fine. I can hook it up to a monitor and keyboard and fiddle about with commands and stuff. It doesn't even seem that hot (it has been a lot warmer and not crashed before).

Even more information: My Raspberry Pi is overclocked at the Modest setting and the GPU was given 128Mb.

When it cuts out and I run curl ifconfig.me the following is outputted:

curl (6) couldn't resolve host 'ifconfig.me'

Here is the output when I run ifconfig. Sorry about the quality. It's legible.

enter image description here

Why is this? And is there anything I can do to stop this error from happening?

  • can you post your ifconfig output after the internet is gone? also, network related entries from /var/log/messages and /var/log/dmesg would be nice to see (not the whole files, just network-related things). – lenik Jun 11 '13 at 10:16
  • Well this is so odd. It's been about 15 minutes and no crash. Hmmm... I'll leave it another 10-15 minutes. – Kezz101 Jun 11 '13 at 10:31
  • @lenik I've added the ifconfig output. Logs coming soon... – Kezz101 Jun 11 '13 at 10:45
  • How do I determine what logs are network related? Or should I just upload them somewhere and let you look through them? – Kezz101 Jun 11 '13 at 11:03
  • please, run the command at the prompt: ifconfig (no curl, no nothing else) – lenik Jun 11 '13 at 13:27
1

Firstly try and update to the latest firmware.

sudo apt-get install rpi-update
sudo rpi-update
#once complete reboot the Pi

After reboot just to make sure do repo update

apt-get update  

Try and put the over-clock mode into normal position and set the GPU RAM to 32MB on Model B and on Model A put it to 8MB. If it is going to run headless you don't need GPU RAM.

Try and use some networking patches. in /etc/sysctl.conf

vm.min_free_kbytes = 8192

if the problem still continues try

smsc95xx.turbo_mode=N

Sometimes USB devices clash with the Network (Because network is connected via USB) Try and disconnect all USB devices.

A massive pain in the neck are SD cards. They might seem fine to write and read but sometimes they just do not want to work. Try and get a recommended SD card - I have experienced issues with SD, MMC and even normal USB drives acting as Operating System drives on various hardware and using hand full of different OS's. Just get a few different ones.

Try and use a completely different power supply. Just because it says 1A does not mean it can really handle it. Some el cheap'os are a pain in the but and after a few hours start to loose power because of poor design. The best power supply is a switching power supply for about 5~15 bucks delivered. They are also more power efficient.

I doubt Apache is the root of the problem but lets tickle our fancy; Try go and install the base version of nginx (engine-x) Make sure you stop a-patch-me first to free port 80. (Its is allot faster than a-patch-me anyway and you can compile allot of cool things into it)

apt-get install nginx
1

So it seems that the Raspberry Pi (or the Raspbian distro) cuts out the internet after a period of inactivity.

This is easily fixed with the following cron job:

* * * * * ping -c 1 www.google.com
  • thats wierd. It does not do that on mine- running for 3 weeks now and never dropped the connection? – Piotr Kula Jun 17 '13 at 9:24
  • Hmm... Might just be a bug with my router or something... Who knows eh! – Kezz101 Jun 17 '13 at 15:11
0

I set up networking in a hurry following this wiki on how to setup the /etc/network/interfaces that I got from here which confused the bejayshus out of me even though i've been setting up networks for years.

This problem is caused by incorrect configuration of the /etc/network/interfaces. Assuming that you have a wired connection,

Try using a configuration like:

auto lo

iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

auto eth0
iface eth0 inet static
address 192.168.1.4
netmask 255.255.255.0
gateway 192.168.1.1
up route add default gw 192.168.1.1
down route del default gw 192.168.1.1

This I found worked for me as a starting network configuration template. You will need to alter the ip addresses appropriately for your network. If you use DHCP, try:

auto lo

iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

auto eth0
iface eth0 inet dhcp

I hope that is enough to get you started. After changing these settings and rebooting the raspberry pi, the problem disappeared.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.