0

I have a raspberry pi with raspbian and on the eth0 port it is connected to my network and gets an ip address via dhcp.

But now I want to unplug the ethernet cable and just use a new one that connects my pc directly to the pi.

Now my question is: Is it possible that the pi tells my pc an ip address to work with like an dhcp Server? So I dont need to do stuff in the adapter settings on my pc. Both sides should now have an ip address to communicate. Would it be possible that if I undo everything and connect the pi back to my network that the pi acts as dhcp client again?

5
  • You need to setup a DHCP server on your PC for this to work. – Panki Jul 17 '19 at 11:25
  • Doesnt it work the other way around? So the pi acts as server and the pc gets an ip? – sirzento Jul 17 '19 at 11:28
  • Both are viable approaches. A server is by definition just a piece of software offering services. – Panki Jul 17 '19 at 12:21
  • My solution is now to let both the pi and the pc automaticly get a zeroconf ip and so they are in the same Network and can communicate. – sirzento Jul 18 '19 at 12:34
  • 1
    if you care to elaborate a little you can answer your own question! :) – Panki Jul 18 '19 at 12:56
0

After thinking that a dhcp server is a bit overkill for just to create a connection between two devices and also would couse problems if the Pi is connected again to a network witch already has a dhcp server I searched for other possibilities.

I found that, if a device cant reach a dhcp Server, the interface automaticly gets a zeroconf address after ~30 sek.

The zeroconf address has a range from 169.254.1.0/16 to 169.254.254.255/16.

So after connecting both devices and waiting a bit, both got an address and can now communicate.

Bonus: this also creates a kind of dns entry so I am able to ping my Pi (hostname raspberrypi) from my Windows pc with the address "raspberrypi.local".

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.