1

I've configured an rpi to be a wifi hotspot. It provides external, WIFI access to a network of ethernet connected rpi computers.

One of those rpi's has internet access. The other rpis use it as a gateway to the internet via it's wlan0 port

Everything worked fine from all rpis before I started using hostapd and a dhcp server for the hotspot. Now, I have to manually add a route to the gateway for the hotspot rpi. When I do that, everything works fine.

I could do that, but I'd like to figure out what's wrong and why entries in /etc/dhcp/dhcpd.conf don't seem to do anything on eth0.

I have this at the bottom of /etc/dhcp/dhcpd.conf:

interface eth0
static ip_address=192.168.173.22/24
# 192.168.173.21 is the rpi that should be the gateway.    
static routers=192.168.173.21
static domain_name_servers=8.8.8.8 8.8.4.4

My /etc/network/interfaces file:

interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0

iface wlan0 inet static
        address 192.168.42.22
        netmask 255.255.255.0
        post-up iw dev $IFACE set power_save off

up iptables-restore < /etc/iptables.ipv4.nat

Probably related--I AM getting a static eth0 ip, even when nothing is added to /etc/dhcp/dhcp.conf OR /etc/network/interfaces. It's what I want (192.168.173.22), but I can't figure out what's setting that up.

When I try using a different static eth0 address in dhcpd.conf, it has no effect.

Also, I notice many tutorials and posts reference /etc/dhcpd.conf, not /etc/dhcp/dhcpd.conf. According to the comment in /etc/default/isc-dhcp-server:

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
DHCPD_CONF=/etc/dhcp/dhcpd.conf

So, /etc/dhcp/dhcpd.conf is the default. Regardless, it's explicitly set in my /etc/default/isc-dhcp-server directory.

Summarizing, two questions:

  1. What's setting the static ip address for eth0 if it's not /etc/network/interfaces or /etc/dhcp/dhcpd.conf?
  2. Why can't I configure a default router using either /etc/network/interface or /etc/dhcp/dhcpd.conf?

(I realize I'd need to disable dhcp to use /etc/network/interfaces, but I need it running to provide wlan0 clients ip addresses on connect)

Thanks

1
  • Your question is confused. You have several Pi in a configuration, but the exact configuration is unclear. You listed a number of files, but again it is unclear which Pi they are on. Why do you WANT to establish a DHCP server? What is providing your network interface? Does this also have a DHCP server?
    – Milliways
    Feb 6, 2017 at 2:00

2 Answers 2

0

DHCP server is on the hotspot pi. It provides ip addresses to clients that connect.

The network interface is provided by one of the rpis, specificaly 192.168.173.21 in the network. NOT the rpi that's the hotpsot.

All the files I referenced are on the hotspot rpi.

But, I think I understand my issue--I was confusing /etc/dhcpdcd.conf versus /etc/dhcp/dhcpd.conf.

I'll move the lines from the latter to the former--it will probably solve my problem.

Net

dhcpcd != dhcpd

0

Yes, I confirmed that was my problem. I was adding the lines to configure a static eth0 ip and gateway to the /etc/dhcp/dhcpd.conf file instead of /etc/dhcpcd.conf file.

Previously, I'd just used /etc/network/interfaces (Wheezy) and never appreciated the difference between the dhcp client versus dhcp server configuration files.

Everything works fine now.

Thanks!

1
  • Please accept your answer with a click on the tick on its left side. Only this will finish the question and does not pop up again year for year.
    – Ingo
    Dec 7, 2019 at 16:56

Your Answer

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

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