3

I followed the great tutorial by Ingo to to use my USB dongle as AP.

I just inverted the wlan0 and wlan1 to use the first one to connect as client to my router, and the second one (the dongle) to be my AP. That's the code I changed:

# /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={ ssid="FASTWEB-5YCW7H" psk="XXXXXXXXXXXXX" }

/etc/wpa_supplicant/wpa_supplicant-wlan1.conf

country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1

network={ ssid="ceccHome" mode=2 key_mgmt=WPA-PSK psk="XXXXXXXXXXXXX" frequency=2412 }

/etc/systemd/network/08-wlan0.network

[Match] Name=wlan0 [Network] DHCP=yes

/etc/systemd/network/12-wlan1.network

[Match] Name=wlan1 [Network] Address=192.168.4.1/24

IPMasquerade is doing NAT

IPMasquerade=yes IPForward=yes DHCPServer=yes [DHCPServer] DNS=84.200.69.80 1.1.1.1

Than I changed the permissions as in the tutorial. Now Im stucked in two issues:

  1. when I try to connect to the raspberrypi (zero w) using ssh pi@raspberrypi.local the host is not resolved (while works well with the IP)
  2. My raspberry don't reach internet. If I try to install something I obtain

E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/m/mosquitto/mosquitto-clients_1.5.7-1+deb10u1_armhf.deb Could not resolve 'raspbian.raspberrypi.org'

while if I connect my phone to the AP (ceccHome), I can surf the internet without problems.

This is my route -n

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.254   0.0.0.0         UG    1024   0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
192.168.1.254   0.0.0.0         255.255.255.255 UH    1024   0        0 wlan0
192.168.4.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan1

Here more info:

pi@raspberrypi:~ $ ip a; ip r
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:ab:8b:a7 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.227/24 brd 192.168.1.255 scope global dynamic wlan0
       valid_lft 86199sec preferred_lft 86199sec
    inet6 fe80::ba27:ebff:feab:8ba7/64 scope link
       valid_lft forever preferred_lft forever
3: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:24:01:9c:da:45 brd ff:ff:ff:ff:ff:ff
    inet 192.168.4.1/24 brd 192.168.4.255 scope global wlan1
       valid_lft forever preferred_lft forever
    inet6 fe80::224:1ff:fe9c:da45/64 scope link
       valid_lft forever preferred_lft forever
default via 192.168.1.254 dev wlan0 proto dhcp src 192.168.1.227 metric 1024
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.227
192.168.1.254 dev wlan0 proto dhcp scope link src 192.168.1.227 metric 1024
192.168.4.0/24 dev wlan1 proto kernel scope link src 192.168.4.1

Could somebody help me? Thank you so much

Fra Ore
  • 33
  • 4

1 Answers1

3

I have tested it with the same settings you show in your question. It works so far except name resolution you complained with the two points:

  1. when I try to connect to the raspberrypi (zero w) using ssh pi@raspberrypi.local the host is not resolved (while works well with the IP)

This is because Multicast DNS isn't enabled. Just add these three lines to /etc/systemd/network/08-wlan0.network and to /etc/systemd/network/12-wlan1.network at their [Network] sections:

LLMNR=no
MulticastDNS=yes
DNSSEC=no

I have updated the tutorial Access point as WiFi router/repeater with additional WiFi-dongle you have used with this information.

  1. My raspberry don't reach internet. If I try to install something I obtain
    E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/m/mosquitto/mosquitto-clients_1.5.7-1+deb10u1_armhf.deb Could not resolve 'raspbian.raspberrypi.org'

The RasPi needs a DNS server address to resolve the name raspbian.raspberrypi.org. Usually it will get it from the DHCP server on its uplink wlan0. Check if it get it. Here is the example of my setup:

~$ resolvectl status wlan0
Link 3 (wlan0)
      Current Scopes: DNS mDNS/IPv4 mDNS/IPv6
DefaultRoute setting: yes
       LLMNR setting: no
MulticastDNS setting: yes
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: yes
  Current DNS Server: 1.1.1.1
         DNS Servers: 1.1.1.1
                      fd00::3681:c4ff:fefc:71a9

If you do not get a DNS Server address from the DHCP server you can add it to the [Network] section at /etc/systemd/network/08-wlan0.network with this line:

DNS=1.1.1.1

There is also a known bug with DNSSEC in Debian Buster. In Debian Bullseye it is disabled by default. The line DNSSEC=no as shown above disables it.

Ingo
  • 42,961
  • 20
  • 87
  • 207