A Raspberry Pi will by default connect to the network if the ethernet connector is plugged in to a router. It is also possible to configure networking on a Raspberry Pi to direct connect to a computer so no router is necessary.

Is it possible to detect which type of setup is present at boot, and make the proper configuration dynamically? I would like to do this to be able to have both a configuration mode (eth0 direct connect with local web server hosting config app) and a normal mode (eth0 internet connection).

I have thought about attempting to get a network DHCP lease on eth0, and if it fails, then running a local DHCP server with isc-dhcp-server to let the directly connected computer get an IP address from the Raspberry Pi.

Two problems with my solution:

  1. It is going to add a lot of delay before the admin page is available.
  2. If the Pi is connected to a network at boot, and the network's DHCP server is temporarily down, the Pi will boot into the wrong mode.

Is there any simpler, faster and more foolproof way of detecting this?

1 Answer 1


By default, this already happens with link-local addresses.

By simply not having a DHCP Server on the network, the Pi will give itself a 169.254.x.x IP address (assuming you're using Raspbian). Any other computer on the network will also have a 169.254.x.x IP address (if they're using a sensible OS).

Then the 2 devices can talk using their IP Addresses of 169.254.x.x

More information can be found in RFC3927

  • How would you figure out the assigned IP address of the Pi from the other computer? Commented Apr 3, 2014 at 4:21
  • Have a look on the Pi ? or do an IP scan from the other computer ? Alternatively if you wanted to get a bit fancier, you could use a little LCD display to show the Pi's current IP address.
    – Lawrence
    Commented Apr 4, 2014 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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