It is a very simple process, but you need to know a few things.

first access via ethernet cable:

I have a 10-meter Ethernet cable that I made 20 years ago. You can buy it or have it made at an electronics store.

connect the cable from the router to the PC.

then in /etc/systemd/network you must create a configuration file.

the file is called priority-name.network

i.e. xx-name.network

In my case I called it 11-eth0.network

If you do not have an extension network the configuration is not loaded.

its content:

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

To edit the file you must give it permissions 777, then to use the service, permissions 644 otherwise it gives an error.

You must reset the service:

sudo systemctl restart systemd-networkd

to view the service status:

sudo systemctl status systemd-network

If it is disabled you enable it:

sudo systemctl enable systemd-networkd

That is, the command is:

sudo systemctl action systemd-networkd

action:

  • restart
  • status
  • enable

you must be sure of the network interface name.

in my case it is enp2s0

You can find out with the command:

ip link show

After resetting, you can check if you are connected to the internet

ping google.com

That will give you information every 1/2 second if you are connected to the internet.

You will see something like the following image, hide the IP addresses:

connect via wifi

We will leave the Internet via Ethernet in case some Internet is needed.

That is, if there is a problem connecting to the Internet via Wi-Fi, we solve it with Internet via Ethernet.

Here, I did these steps from another PC via ssh, to make it faster.

To access via ssh you must know the private IP

ip addr show

It is almost certainly the first IP that appears, next to the inet.

then from another pc on the console

ssh user@private_ip

and you will be asked for the password of that user.

In the /etc/wpa_supplicant directory you must create a file that is the wpa_supplicant configuration.

the file is called wpa_supplicant.conf

Its content is:

network={
ssid="wifi_network_name"
psk="password"
key_mgmt=WPA-PSK
}

with permissions 777.

you need to configure another file.

located in /etc/systemd/network.

I put 10-wlan.network

[Match] 
Name=wlx68b9d3103445

 [Link]
 RequiredForOnline=routable

 [Network] 
DHCP=yes 
IgnoreCarrierLoss=3s

To edit it I set permissions to 777 so that the systemd-networkd service can read it 644.

The file for systemd-networkd is the configuration for the wifi network interface, the wpa_supplicant is the authentication to the wifi network.

systemd-networkd you restart it

sudo systemctl restart systemd-networkd

wpa_supplicant runs in the background:

sudo wpa_supplicant -i wlx68b9d3103445 -c /etc/wpa_supplicant/wpa_supplicant.conf -B

The -B parameter indicates that wpa_supplicant should run in the background.

then you can unplug the ethernet cable and do a google ping to verify that you have wifi internet access.

If you restart the PC you will not have Wi-Fi internet, the wpa_supplicant configuration must be loaded at startup.

until you turn off the PC you will have wifi internet.