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:
- 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)
- 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
ip a; ip r
show. – Milliways Jun 22 '21 at 01:00ip a; ip r
which would be the first thing most of us would check. – Milliways Jun 22 '21 at 11:47