What you need is a simple router that routes traffic from the desktop computer to your WiFi internet router. This can simply be configured using systemd-networkd.
Just follow to Use systemd-networkd for general networking. You can use section "♦ Quick Step". Then come back here.
Now configure wpa_supplcant to connect to your internet router. Create this file with your settings for country
, ssid
and psk
:
pi@raspberrypi:~ $ sudo -Es # if not already done
rpi ~# cat > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf <<EOF
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=DE
network={
ssid="RPiNet"
psk="verySecretPassword"
}
EOF
rpi ~# chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
rpi ~# systemctl disable wpa_supplicant.service
rpi ~# systemctl enable [email protected]
rpi ~# rfkill unblock 0
Configure interfaces with these files. Be sure that you do not use the same subnet than from your internet router. In this example I use subnet 192.168.4.0/24 for the desktop computer. The subnet of your internet router must be different from this.
rpi ~# cat > /etc/systemd/network/04-eth0.network <<EOF
[Match]
Name=eth0
[Network]
Address=192.168.4.1/24
IPMasquerade=yes
DHCPServer=yes
[DHCPServer]
DNS=84.200.69.80 1.1.1.1
EOF
rpi ~# cat > /etc/systemd/network/08-wlan0.network <<EOF
[Match]
Name=wlan0
[Network]
DHCP=yes
EOF
Reboot, and it should do.