1

I have attempted to set-up a Wifi repeater on a Raspberry pi zero W using this very good tutorial : Access point as WiFi repeater, optional with bridge

Meanwhile i have 2 problems :

  1. No IP address received from the wifi router.. I solved it by removing the line "country_code=DE" in file /etc/hostapd/hostapd.conf.

  2. No DNS server address provided by DHCPserver to Wifi AP clients. If i ping an ip address (ex : 8.8.8.8), i get the answers. If i use a name (ex: ping google.com), that dont work. This is also the case if i put a fixed DNS address in /etc/systemd/network/12-ap0.network. If i force a DNS address (8.8.8.8) inside the client, i get the full internet access (tested on my iphone) but this is not a solution

I have searched in the systemd.network man page in section dedicated to DHCPserver and more specifically the EmitDNS item. They speak about the propagation of the uplink DNS address. This should be the solution. But i dont find where this uplink data is taken from as they say this is not from /etc/resolv.conf. May be a problem linked to the fact the ap0 is on the same internal wifi adapter than wlan0 ?

Do you have an idea on how to fix this DNS problem ?

Best regards JeanMarc

7
  • Hi JeanMarc78, I have tested the DNS nameserver settings with bridge setup and on the ethernet interface and it seems to work. But now I'm just looking at the simple AP setup and I also don't get the DNS server settings. Just a moment please. I'm looking what's going wrong.
    – Ingo
    Commented Nov 9, 2018 at 13:44
  • First step to a solution: after looking what could be wrong without success, I followed your guess that there could be a problem with the virtual interface ap0. I setup an AP with wpa_supplicant on interface wlan0 according to Setting up a Raspberry Pi as an access point - the easy way. With this, getting a DNS server in /etc/resolv.conf works. Maybe we need different mac addresses on ap0 and wlan0? Next step: verify AP with hostpad on interface wlan0.
    – Ingo
    Commented Nov 9, 2018 at 22:31
  • hostapd on interface wlan0 without ap0 does not work, means I do not get a DNS server in /etc/resolv.conf. Seems hostapd is the problem. Will see ...
    – Ingo
    Commented Nov 9, 2018 at 23:32
  • Thank you Ingo for your answers. With the settings,from yourtutorial, i also got a DNS address in /etc/resolv.conf but as indicated in the systemd-network man page, they dont use it. Yes it seems hosptapd is the problem or a problem setting ap0 before wlan0 as it is not very clear in the doc of hospapd EmitDNS which lease must be set before hostapd needs it
    – JeanMarc78
    Commented Nov 10, 2018 at 10:36
  • Little error in my previous answer, EmitDNS is part of systemd-network man page, not hostapd one. This is DHCP server which should provide the DNS server address not hostapd.
    – JeanMarc78
    Commented Nov 10, 2018 at 11:32

3 Answers 3

2

I was redirected here from the excellent thread of Ingo because I'm trying to make my RPi3 to act as WiFi extender. Like you, I followed every steps and I noticed that a device connected to the extended WiFi network couldn't get any DNS address from the primary Wireless router.

Something draws my attention on Troubleshooting section. @Ingo explains that hacker should modify the /etc/systemd/network/08-wlan0.network file. But I think Ingo may have mixed the 08-wlan0.network and 12-ap0.network file.

Indeed, we should do :

rpi ~# cat > /etc/systemd/network/12-ap0.network <<EOF
[Match]
Name=ap0
[Network]
Address=192.168.4.1/24
DHCPServer=yes
[DHCPServer]
DNS=8.8.8.8 1.1.1.1
EOF

Once modified and rebooted, everything seems to work fine, no need to install and set up isc-dhcp-server package.

I would like to edit a comment or a reply on the original post, but my profile is too new for it. So, I use this one. Hope it helps ...

0

I just made a test by removing the hostapd internal DHCPserver (DHCPserver=no in place of yes in /etc/systemd/network/12-ap0.network) and by installing the isc-dhcp-server package. And that is OK when i configure static DNS addresses in /etc/dhcp/dhcpd.conf. The wifi client connected to the ap0 AP now gets an IP address and the DNS server address. I still need to find how to set the dhcp.conf to propagate the DNS server address received on router side

1
  • To propagate DNS server you have to set option domain-name-servers ip-address [, ip-address... ]; in /etc/dhcp/dhcpd.conf not in dhcp.conf.
    – Ingo
    Commented Nov 25, 2018 at 11:39
0

You removed the country code from the configuration file /etc/hostapd/hostapd.conf to get an ip address from your wifi router. I mean it is better to use your country code. As you see the router checks the country code and without it you may have a minimal common setup. It is possible that your router gives you better and more specific settings for your country.

The other issue that the DHCP server does not send you the ip address from your custom DNS server is a real problem. I haven't seen it so far but I can confirm this bug.

In man systemd.network section [DHCPServer] you found the settings to configure it in a /etc/systemd/network/*.network file. Setting only EmitDNS= will get the option for the DNS server from the "uplink". For my understanding it means: for the RasPi itself you get an ip address and options (e.g. DNS server ip address) from your wifi router. That is what they mean with "uplink". This settings are taken and sent by the access point to the stations. With an additional entry DNS= this ip address is sent.

I have made some extensive tests to find what's going wrong. First I setup a simple stand alone access point with wpa_supplicant using the interface wlan0 as shown in Setting up a Raspberry Pi as an access point - the easy way. For /etc/systemd/network/12-ap.network I use:

[Match]
Name=wlan0
[Network]
Address=192.168.4.1/24
DHCPServer=yes
[DHCPServer]
EmitDNS=yes
DNS=192.168.10.254

This works, means the station gets the DNS ip address 192.168.10.254 into /etc/resolv.conf from the DHCP server, if we have a Debian like station. Next I setup a stand alone access point with hostapd also using only interface wlan0. I have taken a modified setup from Access point as WiFi repeater, optional with bridge. This also works by getting the right entry in /etc/resolv.conf. Next I setup the access point with interface ap0 and the wifi client connection with interface wlan0 as described. It does not work. The local resolver does not modify resolv.conf for the right DNS server ip address. So the problem is the virtual interface ap0, as you already guessed.

wlan0 and ap0 have both the same mac address by default. I tried to give ap0 its own mac address and set the interface to promiscuous mode, for example:

rpi ~$ sudo ip link set ap0 address b8:27:eb:06:e8:8c
rpi ~$ sudo ip link set ap0 promisc on

It does not help.

Another idea was to use interface wlan0 for the access point and the virtual interface for the client connection to the wifi router. For this we have to set wlan0 to type ap and then add the virtual interface with type managed:

rpi ~$ sudo iw dev wlan0 set type __ap
rpi ~$ sudo iw dev wlan0 interface add sta0 type managed
command failed: Operation not supported (-95)
rpi ~$

Does not work.

To workaround this with dnsmasq look at Access point as WiFi repeater, optional with bridge, section Troubleshooting.

Raspbian Stretch comes with systemd version 232. I will use a test environment with the latest stable version but at least version 239. If it also does not work I file a bug report to systemd.

I will report next.

4
  • Many thanks for all your tests. On my side i have had a look at changes list of newer releases of hostapd and did not found any related to DNS.
    – JeanMarc78
    Commented Nov 12, 2018 at 10:59
  • The raspbian stretch release is 2.2.4 and the last one is 2.6. The changelog link : w1.fi/cgit/hostap/plain/hostapd/ChangeLog
    – JeanMarc78
    Commented Nov 12, 2018 at 11:10
  • I already made a test with my own "country_code=FR" without success. Only removing the line fixes the problem.of not getting lease data on wlan (router) side
    – JeanMarc78
    Commented Nov 15, 2018 at 10:19
  • @JeanMarc78 I have described a workaround with dnsmasq in section Troubleshooting from Access point as WiFi repeater, optional with bridge.
    – Ingo
    Commented Nov 27, 2018 at 0:03

Your Answer

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

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