I need to connect a device to raspberry pi via ethernet cable, the said device has no wireless functionality. I understand that we have hostapd on raspberry pi that can setup wireless access point, which unfortunately is not feasible in my case. Hence, I need to connect the device to raspberry pi, and get an ip address assigned to the device by raspberry pi. There is no need to connect to the internet. It would seem like an enclosed network just between raspberry pi and the device.


Using systemd-networkd it is simple to achieve what you want. First use it with:

# disable classic networking
rpi ~$ sudo -Es
rpi ~# systemctl mask networking.service dhcpcd.service
rpi ~# mv /etc/network/interfaces /etc/network/interfaces~
rpi ~# sed -i '1i resolvconf=NO' /etc/resolvconf.conf

# enable systemd-networkd
rpi ~# systemctl enable systemd-networkd.service systemd-resolved.service
rpi ~# ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

Then create this file:

rpi ~# cat > /etc/systemd/network/04-eth0.network <<EOF

Reboot and it should do.

| improve this answer | |

You will need to disable dhcpcd (which implements the DHCP client) and set up a static IP address. You can refer to this answer if you're unsure how to do that.

Then you'll need to install (sudo apt-get install) and configure dhcpd (which implements the DHCP server). Essentially, you will need to define a subrange of dynamic IP addresses which can be assinged to clients on the same subnet on which you have configured the static IP. Assuming you have used as the static IP, you could go with

subnet netmask {
| improve this answer | |

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.