3

This is more for curiosity than anything.

By following the steps in this awesome guide. I managed to get remote connection working with the Pi and my MBP so that I could SSH into my Pi using the MBP's ethernet port, and live Pi-monitor free.

It's working pretty reliability. What's befuddling is why the IP address on the ethernet (eth0) of the Pi always stays static at 169.254.149.192?

This is with DHCP on my MBP's Ethernet (via Thunderbolt).

As expected, the DHCP assigns a new IP address to my MBP every time the Pi boots up (169.254.X.Y, changing X and Y every time) - one example is below:

enter image description here

But the Pi somehow retains the same address every time. I don't have a static IP as far as I can see:

  • /boot/cmdline.txt has no IP address specified
  • contents of /etc/network/interfaces below - everything seem to be on auto address assignment:

    auto eth0
    allow-hotplug eth0
    iface eth0 inet manual  
    
    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf  
    
    auto wlan1
    allow-hotplug wlan1
    iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    

Not that I'm complaining about having the convenience of a static IP address to keep SSH / iTerm2 settings consistent. But it bugs me that the MBP address assignment works as I expect, but the Pi works in mysterious ways ;)

Appreciate any info.

  • 2
    "I don't have a static IP as far as I can see" -> You don't have a dynamic one either (inet manual). Seems to me this is as likely to do with the "mysterious ways" of the software on the laptop: Yes, it gets a DHCP address, but this is not evidence of the fact that it assigns that to the attached pi. It may in fact keep it consistent based on MAC address, which would be a feature. Of course you'd have to do some research on OSX to find that out...see Ask Different. – goldilocks Aug 5 '15 at 13:20
  • 1
    Dynamic IP addresses are generally quite sticky. If there's no reason to change they will stay the same. I couldn't work out which device is acting as the DHCP server for your Pi? – joan Aug 5 '15 at 14:09
  • 2
    Are you actually running a dhcp server anywhere? Your MBP is configured to use dhcp, but has a self-assigned 169.254.0.0/16 address (see the message in your Thunderbolt Ethernet settings). By using iface eth0 inet manual on the RPi in /etc/network/interfaces, you are directing it not to use dhcp. – bobstro Aug 5 '15 at 14:11
  • I use "dhcp reservations" in my router to reserve IPs per MAC address, that way the pi (and every other normally connecting device) always gets the same IP. it's my option the dhcp server (usually the router) be responsible for assinging IPs, avoid configuring a static IP on any device. Upvote for @bobstro observation re: 'iface eth0 inet manual' – Tyson Aug 5 '15 at 19:19
  • @goldilocks & @bobstro: Good pick up on the inet manual. So it's definitely not using DHCP. So where would the static IP address come from? – snowbound Aug 11 '15 at 10:48
3

I'm dubious as to whether you actually have dhcp configured and running properly based on the information you've provided, but since your actual question was regarding the assignment of the link-local 169.254.0.0/16 address, I suggest you read through RFC 3927 Section 1.5 which describes how the address can be selected using the interface MAC address of the interface as a seed for a pseudo-random generator to select an address in the appropriate range. It describes how these can be re-used as you describe:

Hosts that are equipped with persistent storage MAY, for each interface, record the IPv4 address they have selected. On booting, hosts with a previously recorded address SHOULD use that address as their first candidate when probing.

As to how the RPi is doing this or why in your specific case, I can't say. So long as it doesn't identify a conflict, it does look like it's storing the address for future use as described in the RFC.

If you have something like avahi-autoipd installed, that could be the origin of the address on your particular RPi.

  • +1 for referencing the RFC 3927 @bobstro. I did a dpkg -l | grep avahi and a dpkg -l | grep autoipd. Couldn't see an entry in there. Also, I may be wrong, but doesn't zeroconf generally use different IP addresses? Since the domain/name/type tuple the only thing that stays static during discovery? – snowbound Aug 11 '15 at 10:56
2

For the answer just check the Raspberry Pi Remote Connections – Without A Network guide again. Just under the topic Making a network connection work it says:

Other computers will often give themselves a default address (in the address range 169.254.0.0 – 169.254.255.255) but the Raspberry Pi doesn’t do this (yet). Besides even if the Raspberry Pi did, we would still need to know what address it had picked to be able to connect to it!

The address range 169.254.0.0 – 169.254.255.255 is default.

Also check these links for further info(and also some links inside them and the answers will be useful): https://serverfault.com/questions/427018/what-is-this-ip-address-169-254-169-254 http://www.techrepublic.com/forums/questions/where-did-ip-16925451183-come-from/

Hope it helps.

0

As said by the others, IP addresses in the range 169.254.0.0/16 are link local only. It is undefined what will be the behaviour of a system if you try to use it by setting those as static IP addresses. Most likely it discard it, and try to configure a link-local connection, so it is reassigning a new IP from this range and its algorithm always make it peak the same one.

Try to use an IP address in the 192.168.31.0/24 defined statically on both the Mac and the RPi. You should be able to get a direct connection.

Or if you want DHCP, then either on the Mac or on the RPi you need to install a DHCP server. If you fail to do so, they probably both fallback to link-local IPs.

These link-local IPs are usually set-up by zeroconf/avahi/bonjour or possible being implemented by your favourite network manager (using the same kind of protocol).

  • Is "/16" and "/24" a notation for a class B and class C network, respectively? – Peter Mortensen May 7 '16 at 16:59
-3

The IP addres comes from the dhcp daemon, so simply disable it if You do not use DHCP

sudo systemctl disable dhcpcd

And it is gone

  • 1
    Welcome to the site! While this appears to be an attempt at answering the question, it's so short that it's triggered the automatic Low Quality Answer flag and now stands a good chance of being auto-deleted by the system. Please consider expanding it to include more details on what this does, and how it addresses the question. – goobering Mar 8 '17 at 8:58

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.