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:
- What's setting the static ip address for eth0 if it's not /etc/network/interfaces or /etc/dhcp/dhcpd.conf?
- 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
DHCP
server? What is providing your network interface? Does this also have aDHCP
server?