0

I'm trying to get a DHCP server working on two interfaces so that I can use my Raspberry Pi as a standalone server to perform various tasks. So far I've installed hostapd to set up a wireless access point, and also dnsmasq to sort out the DHCP server aspect.

This seems to work fine with the wlan1 interface, but for some reason it won't provide DHCP when I'm connected via ethernet (eth0).

According to the documentation, adding another interface is as simple as duplicating the interface= line, but it doesn't seem to be working for me here. Any ideas why?

interface=wlan1
interface=eth0
dhcp-range=192.168.4.2,192.168.4.99,24h

listen-address=::1,127.0.0.1,192.168.4.1

server=8.8.8.8
server=8.8.4.4

The ethernet post does seem to have an IP of its own: enter image description here

2
  • Try without any interface lines - this should default to all interfaces. Also how does eth0 get its IP address - did you define both as static addresses? You also only have one listen address - wlan and eth should have different ip addresses. Also check interface names with sudo ifconfig – user130616 Mar 5 at 20:21
  • That was part of it. I'd forgotten to define the IP in dhcpcd.conf. I changed it now so it also has different subnets for each interface with their own listen address. Not sure if it's necessary, but it works. – Kureigu Mar 7 at 18:25
0

Silly configuration error. I'd forgotten to configure eth0 in dhcpcd.conf.

I also updated dnsmasq.conf to have different subnets and configs for each interface and it works as expected;

interface=wlan1
dhcp-range=wlan1,192.168.4.2,192.168.4.99,24h

interface=eth0
dhcp-range=eth0,192.168.5.1,192.168.5.99,24h

listen-address=::1,127.0.0.1,192.168.5.1,192.168.4.1

server=8.8.8.8
server=8.8.4.4

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.