Author Topic: raspberry pi2 no more ipv4  (Read 1415 times)

woollypigs

  • Mr Peli
    • woollypigs
raspberry pi2 no more ipv4
« on: 07 November, 2015, 03:31:55 pm »
Running Raspbian Jessie, connected it up happily with both samba and ssh running headless.

Connected a up a USB drive and stared to rsync over ssh to it which worked fine. Then tried to get my media player to find the tunes on the shared USB drive, plus another rsync session. And then it fell over. Sadly don't have the error report other than it said Kernel Panic many times in the terminal where I run screen to IRSSI. And the USB drive clicking away.

Upon restart the pi2 looked like it booted up just fine, the blinking light blinked like it always did. But now could not ssh into it at all. Looked on my router settings to see if was connected. It was but only on ipv6 not ipv4.

So I can't connect to my pi2 or the pi2 can't connect to the world.

Do anyone know how to get it back to ipv4? Can't pop the SD card into my laptop and hack it from there, since the pi2 runs headless.
Current mood: AARRRGGGGHHHHH !!! #bollockstobrexit

Kim

  • Timelord
    • Fediverse
Re: raspberry pi2 no more ipv4
« Reply #1 on: 07 November, 2015, 04:39:59 pm »
Login over IPv6, plug in a screen and use the console, connect a serial terminal, or, erm, that's about it.

Otherwise mount the SD card on something and poke around the filesystem in the hope of finding what's broken.  I'd start with a good fscking.  Pis are good at corrupting SD cards, so it's worth having a backup image of the card.

woollypigs

  • Mr Peli
    • woollypigs
Re: raspberry pi2 no more ipv4
« Reply #2 on: 07 November, 2015, 04:48:41 pm »
Can only run it headless don't have spare kit.

Have a week old image, so it will be a good time to check if these images works :)

How to login over ipv6, I gave it a stap before leaving home but no joy. Prolly forgot a switch to the SSH.
Current mood: AARRRGGGGHHHHH !!! #bollockstobrexit

Kim

  • Timelord
    • Fediverse
Re: raspberry pi2 no more ipv4
« Reply #3 on: 07 November, 2015, 05:10:53 pm »
How to login over ipv6, I gave it a stap before leaving home but no joy. Prolly forgot a switch to the SSH.

If there's an AAAA record in DNS it Just Works™, and will normally use IPv6 preferentially to IPv4:

Code: [Select]
ssh penelope.ductilebiscuit.net

If not, just use the IPv6 address of the server:

Code: [Select]
ssh 2001:8b0:14f:0:92e6:baff:fe56:711f

If you only have a link-local (fe80::/64) IPv6 address, you'll probably need to specify the interface on the client machine that's connected to the relevant LAN, thus:

Code: [Select]
ssh fe80::92e6:baff:fe56:711f%eth0

Obviously you need IPv6 configured on the client machine, and your ssh client may vary.


ETA: Fairly sure the -6 flag is redundant when specifying an IPv6 address, but it certainly doesn't hurt.  It's useful for DNS names with both A and AAAA records.

Afasoas

Re: raspberry pi2 no more ipv4
« Reply #4 on: 07 November, 2015, 05:15:27 pm »
From a computer that itself has an IPv6 configuration:

Code: [Select]
$ ssh -6 <user>@<ipv6 address>
I'm assuming it's configured to use a dynamic IP address? You can confirm this with

Code: [Select]
afasoas@claud ~ $ cat /etc/network/interfaces
auto lo

iface lo inet loopback
iface eth0 inet dhcp

The last line is the key line. If instead of "inet dhcp" you have "inet static", then there's something wrong with your IPv4 settings.
If relying on DHCP, you can check your syslog for output from the dhcp client:

Code: [Select]
afasoas@claud ~ $ grep -i dhcp /var/log/syslog
Apr 29 08:35:04 claud dhclient: DHCPREQUEST on eth0 to 172.16.1.51 port 67
Apr 29 08:35:04 claud dhclient: DHCPACK from 172.16.1.51
Apr 29 12:17:23 claud dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
Apr 29 12:17:23 claud ifplugd(eth0)[1563]: client: DHCPREQUEST on eth0 to 255.255.255.255 port 67
Apr 29 12:17:31 claud dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
Apr 29 12:17:31 claud ifplugd(eth0)[1563]: client: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
Apr 29 12:17:32 claud dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
Apr 29 12:17:32 claud ifplugd(eth0)[1563]: client: DHCPREQUEST on eth0 to 255.255.255.255 port 67
Apr 29 12:17:32 claud dhclient: DHCPOFFER from 172.16.1.51
Apr 29 12:17:32 claud ifplugd(eth0)[1563]: client: DHCPOFFER from 172.16.1.51
Apr 29 12:17:32 claud dhclient: DHCPACK from 172.16.1.51
Apr 29 12:17:32 claud ifplugd(eth0)[1563]: client: DHCPACK from 172.16.1.51

Obviously I need to configure my Pi to use a reliable NTP source.

Finally, you can check the dhclient.leases file:

Code: [Select]
afasoas@claud ~ $ cat /var/lib/dhcp/dhclient.eth0.leases
lease {
  interface "eth0";
  fixed-address 172.16.3.51;
  option subnet-mask 255.255.248.0;
  option routers 172.16.1.1;
  option dhcp-lease-time 43200;
  option dhcp-message-type 5;
  option domain-name-servers 172.16.1.51,208.67.222.222,208.67.220.220;
  option dhcp-server-identifier 172.16.1.51;
  option domain-search "bikeshed.internal.";
  option ntp-servers 172.16.2.51;
  option broadcast-address 172.16.7.255;
  option netbios-name-servers 172.16.2.51;
  option domain-name "bikeshed.internal";
  renew 3 2015/04/29 16:52:49;
  rebind 3 2015/04/29 21:47:32;
  expire 3 2015/04/29 23:17:32;
}

Good Luck.

On Edit: Cross-post with Kim.

woollypigs

  • Mr Peli
    • woollypigs
Re: raspberry pi2 no more ipv4
« Reply #5 on: 07 November, 2015, 05:29:49 pm »
Thanks, that will give me something to work on. Not set it up for ipv6 and just default DHCP. Didn't use the -6 when I tried SSH on ipv6, but that might not work since I haven't set up ipv6
Current mood: AARRRGGGGHHHHH !!! #bollockstobrexit

Kim

  • Timelord
    • Fediverse
Re: raspberry pi2 no more ipv4
« Reply #6 on: 07 November, 2015, 05:33:28 pm »
There isn't really anything to configure IPv6-wise in Debian/Raspbian[1], unless you want a static address or something.  By default it Just Works, configuring the link-local addresses according to MAC, and listening for RAs and configuring addresses accordingly.


[1] The elephant in the room is a sane way of configuring DNS servers etc.  That needs something DHCPish, and is frustratingly absent from basic IPv6 auto-configuration.  But it shouldn't need working DNS resolution to accept an SSH connection, unless you've done something deliberate and DNS-requiring to secure it.

woollypigs

  • Mr Peli
    • woollypigs
Re: raspberry pi2 no more ipv4
« Reply #7 on: 07 November, 2015, 10:43:52 pm »
Well dd'd the .img I had from ten days ago and I'm back up and running. Though I have no clue what have done since the last .img I last made :) I got a funny feeling that I have to do the openvpn setup again and I know the web server.

I will have a go at the ipv6 some time next week so at least it is running for next time it falls over.
Current mood: AARRRGGGGHHHHH !!! #bollockstobrexit

woollypigs

  • Mr Peli
    • woollypigs
Re: raspberry pi2 no more ipv4
« Reply #8 on: 08 November, 2015, 12:09:23 am »
Good news the DB, webserver and openvpn was backed up so everything is running like before. Though I'm sure I installed something in the last few days, but what?

Sadly it looks like the USB drive died, clicks three times while trying to spin up and then stops. So that is about 300Gb of music I need to find again. Unless I can get it to spin up, might need a Y cable or what ever they are called to give it more power Cap't.
Current mood: AARRRGGGGHHHHH !!! #bollockstobrexit