Page 1 of 1

Strange network problem on RPI 2

Posted: Sat Feb 27, 2016 12:30 am
by Chejo
My network works every second boot. So if I start the PI and the network doesn't work, i just reboot it and it works fine. But if I reboot it again the network stops working and so on. The network works on every second boot.
I have no idea what could be the cause of this.(A pc on the same network cable doesn't have any network issues.)

Re: Strange network problem on RPI 2

Posted: Sat Feb 27, 2016 1:47 pm
by davcefai
Some more info will help:
If you don't understand any of the terms just ask (or google)
1. Wireless or wired connection?
2. Static or DHCP?
3. When you reboot is it by power off/on or a software reboot?

Try running:

Code: Select all

 ifconfig
from a terminal window. Do this for both when the network connection works and when it doesn't. If wired network, post the eth0 inet address. If wireless post the wLan0 address. (The names may be a little different).

If you have BOTH try working with only one.

More when you reply.

cheers

Re: Strange network problem on RPI 2

Posted: Sat Feb 27, 2016 3:04 pm
by Chejo
davcefai wrote:Some more info will help:
If you don't understand any of the terms just ask (or google)
1. Wireless or wired connection?
2. Static or DHCP?
3. When you reboot is it by power off/on or a software reboot?

Try running:

Code: Select all

 ifconfig
from a terminal window. Do this for both when the network connection works and when it doesn't. If wired network, post the eth0 inet address. If wireless post the wLan0 address. (The names may be a little different).

If you have BOTH try working with only one.

More when you reply.

cheers
Wired connection. It doesn't matter if it is DHCP or static ( if it's DHPC it doesn't get an IP if the network doesn't work.). Same result.
It is a soft reboot (I assume. In the terminal I write reboot, and the pi reboots)

When it works:

Code: Select all

eth0      Link encap:Ethernet  HWaddr b8:27:eb:3d:2b:b0
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::492e:55ea:20c6:90ad/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:984 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1759 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:73244 (71.5 KiB)  TX bytes:2036410 (1.9 MiB)
When it doesn't:

Code: Select all

eth0      Link encap:Ethernet  HWaddr b8:27:eb:3d:2b:b0
          inet addr:169.254.129.128  Bcast:169.254.255.255  Mask:255.255.0.0
          inet6 addr: fe80::492e:55ea:20c6:90ad/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:10 dropped:5 overruns:0 frame:10
          TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:7907 (7.7 KiB)


Re: Strange network problem on RPI 2

Posted: Sat Feb 27, 2016 3:59 pm
by davcefai
I wonder if the router is not "noticing" that you have rebooted.

Two useful tests would be:

Code: Select all

shutdown now
, wait a minute or so and restart.

When the network doesn't work run

Code: Select all

sudo ifdown -a
, wait a moment and run

Code: Select all

sudo ifup -a
Then see if a network connection is established.

Re: Strange network problem on RPI 2

Posted: Sat Feb 27, 2016 6:13 pm
by Chejo
davcefai wrote:I wonder if the router is not "noticing" that you have rebooted.

Two useful tests would be:

Code: Select all

shutdown now
, wait a minute or so and restart.

When the network doesn't work run

Code: Select all

sudo ifdown -a
, wait a moment and run

Code: Select all

sudo ifup -a
Then see if a network connection is established.
The shutdown makes no difference.
And ifup/down doesn't work either.

ifdown: http://pastebin.com/HHwq0r4B
ifup: http://pastebin.com/JZ9fYFQ0

Re: Strange network problem on RPI 2

Posted: Sat Feb 27, 2016 7:40 pm
by davcefai
The output of ifup indicates that the router is not responding. The Pi is begging for an IP address but the router is ignoring it.

Assuming that the cable is OK (can you try swapping with another?) then I would look to the router. The Pi side of things seems to be Ok to me. I could be wrong and frequently am but the ifup output is what I usually get when I have router or cable problems.

Did you really mean that it works once in every two attempts regularly, ie not random failures?

Re: Strange network problem on RPI 2

Posted: Sat Feb 27, 2016 8:39 pm
by Chejo
davcefai wrote:The output of ifup indicates that the router is not responding. The Pi is begging for an IP address but the router is ignoring it.

Assuming that the cable is OK (can you try swapping with another?) then I would look to the router. The Pi side of things seems to be Ok to me. I could be wrong and frequently am but the ifup output is what I usually get when I have router or cable problems.

Did you really mean that it works once in every two attempts regularly, ie not random failures?
That is the thing that I find strange. It isn't random, every second boot.
Could the rpi be sensitive of the long cable? The cable is 25-30m long.

I tried an older router and it works fine with it every time (with a shorter cable). Is it possible that the rpi is incompatible with this one?
Because a computer works fine on the same cable that the rpi has problems with.

Re: Strange network problem on RPI 2

Posted: Sat Feb 27, 2016 9:03 pm
by DougieLawson
I'd start by looking at the leasetime setting on your non-functioning router. You may need a router firmware update to fix its broken DHCP server.

Re: Strange network problem on RPI 2

Posted: Sat Feb 27, 2016 9:16 pm
by davcefai
I can't think WHY this is happening. However you may be able to configure the old router as an access point and go via that to your existing router. This will split your "long" cable into 2 shorter ones. A thought has struck me: do you need the 25m or is it a coiled up cable? Coiled up cables cause no end of problems.

Set the old router NOT to be a DHCP server. I have done this and it works. 25m is not over long for a TCP/IP cable. The limit is 100 yards (90m although many people today set the limit as 100m and it usually is OK)). Is the cable wired correctly? The connections to the plugs MUST be as per the spec. I can't see how this would cause your reboot problem but if the twisted pairs are used incorrectly then problems will happen.

You might need to post this problem on a networking forum. I don't know if I can post links here but Linuxquestions has some very good people.