I created an access point on my Raspberry PI (Raspbian) following Setting up a Raspberry Pi as an access point - the easy way the systemd-networkd way. Now I have to connect to my AP via another RPI which I do with the help of nmcli with the following command:
sudo nmcli device wifi connect MYSSID password MYPASSWORD iface wlan0
I connect successfully but I also have to make a SSH connection and a pg_dump to my access point. And when I try the static IP I set it says it can't connect to host MYIP port 22: no route to host.
I know that means that it can't find the IP, so how can I connect to my access point with SSH.
How I configured my access point. General Configuration:
sudo -Es
systemctl mask networking.service dhcpcd.service
mv /etc/network/interfaces /etc/network/interfaces~
sed -i '1i resolvconf=NO' /etc/resolvconf.conf
systemctl enable systemd-networkd.service systemd-resolved.service
ln -sf /run/systemd/resolve/resolve.conf /etc/resolv.conf
wpa_supplicant
configuration
cat > etc/wpa_supplicant/wpa_supplicant-wlan0.conf <<EOF
country=SI
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="MYSSID"
mode=2
key_mgmt=WPA-PSK
proto=RSN WPA
psk="myPass"
frequency=2437
}
EOF
chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
systemctl disable wpa_supplicant.service
systemctl enable wpa_supplicant@wlan0.service
Access point configuration:
cat > /etc/systemd/network/08-wlan0.network <<EOF
[Match]
Name=wlan0
[Network]
Address=172.16.2.220
DHCPServer=yes
EOF
Access point configuration with eth0, no routing
cat > /etc/systemd/network/04-eth0.network <<EOF
[Match]
Name=eth0
[Network]
Address=172.16.2.219
EOF
sudo reboot
Other RPI configuration
sudo apt install network-manager network-manager-gnome \
openvpn openvpn-systemd-resolved network-manager-openvpn \
network-manager-openvpn-gnome
And I have deleted Wireless & Wired Network
from Panel Applets
. On this RPI I have the static IP (172.16.2.231)
configured with dhcpcd
.
Edit: added configuration for my access point RPI and my other RPI
NetworkManager
is not used by default on Raspbian;nmcli
isn't even installed (you don't say what OS you are using, so Raspbian will be presumed). If you've added that but are combining it with the adhcpcd
configuration, you may not get predictable results. Put another way, please edit all the details of what you've done to configure networking here (including the static IP). – goldilocks Aug 05 '19 at 13:37