1

I'm trying to achieve the following GOAL

But cannot get to reach my web app via the additional router the same way I can from the raspi onboard WIFI chip Access point.

Raspbian Stretch 9.4

dnsmasq -v
Version de Dnsmasq 2.76  Copyright (c) 2000-2016 Simon Kelley
Options à la compilation IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify

/etc/dnsmasq.conf

#########################################################
# DNS
#########################################################
interface=wlan0
interface=eth0
listen-address=127.0.0.1
listen-address=192.168.42.1
listen-address=192.168.1.100

bind-dynamic
#server=8.8.8.8

# Set this (and domain: see below) if you want to have a domain
# automatically added to simple names in a hosts-file.
expand-hosts
domain=local

# Add local-only domains here, queries in these domains are answered
# from /etc/hosts or DHCP only.
local=/local/

# Never forward plain names (without a dot or domain part)
#domain-needed

# Never forward addresses in the non-routed address spaces.
bogus-priv

#########################################################
# DHCP
#########################################################
# DO NOT PROVIDE DHCP ON ETHERNET, AS PI IP IS DHCP ASSIGNED BY AND RESERVED ON ADDITIONAL ROUTER (192.168.1.100)
# ADDITIONAL ROUTER IS IN CHARGE OF DHCP ASSIGNING IPs TO CLIENTS, ONLY DNS SHOULD BE PROVIDED WHEN REQUESTED ON ETH0
no-dhcp-interface=eth0

#Allow more IP than needed to allow max MAC address on WIFI board chip (32 on raspi 3B)
dhcp-range=192.168.42.2,192.168.42.50,255.255.255.0,6h

# GATEWAY
# Override the default route supplied by dnsmasq, which assumes the
# router is the same machine as the one running dnsmasq.
dhcp-option=3,192.168.42.1

#dns server address delivered to clients
dhcp-option=6,192.168.42.1

/etc/hosts

127.0.0.1       myHost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
127.0.1.1       myHost
192.168.42.1    myHost
192.168.42.1    myHost.local
192.168.42.1    box
192.168.42.1    box.local
192.168.42.1    box.myHost.com
192.168.42.1    myHost.com
192.168.42.1    www.myHost.com

/etc/dhcpcd.conf

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

nohook wpa_supplicant
interface wlan0
static ip_address=192.168.42.1/24
static routers=192.168.42.1
static domain_name_servers=192.168.42.1

# protect resolv.conf
nohook resolv.conf

1 Answer 1

0

OK, so I was missing an obvious point: DNS provides resolution for the raspi OWN wifi network, i.e. 192.168.42.1... which is not reachable from the outer network ! So, adding the same information in the /etc/hosts file with the reserved 192.168.1.100 address with the same hostnames, I could get it to work...

Nevertheless, I'm pretty sure this is not correct / academic, but IRL it does the job. If any DNS / Network admin / expert is passing by, please feel free to correct me.

Cheers

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.