For esoteric reasons I have a server which only has WiFi access to the network.
By copying the necessary dpkg files on a removable drive I've managed to install wpa_supplicant.
The thing that's bugging me is that on other distributions configuring it can be done by editing /etc/wpa_supplicant/wpa_supplicant.conf
. But this doesn't work on Ubuntu because the systemd service file starts up wpa_supplicant without specifying a configuration file. There is no -c
specified in its arguments.
Even the Ubuntu man page says the most common way to start it is by specifying a config file...
In most common cases, wpa_supplicant is started with:
wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0
Because this is a server there is no GUI installed and I'm not using network manager (AFAIK)
I have of course confirmed that shutting down the systemd service and manually starting the Daemon from the command line will work. And I can of course modify the .service file. But this feels like the wrong solution.
Can anyone tell me how I am supposed to configure wpa_supplicant on Ubuntu server?
Нет необходимости настраивать wpa_supplicant вручную.
Сетями в последних версиях сервера Ubuntu управляет netplan. Проверьте, чтобы увидеть имя вашего файла netplan:
ls /etc/netplan
Я предполагаю, что имя файла, который вы нашли, - 01-netcfg.yaml. Подставьте здесь свои данные, если не 01-netcfg.yaml.
Мы изменим файл, указав ваши данные:
sudo nano /etc/netplan/01-netcfg.yaml
Измените файл следующим образом:
network:
version: 2
renderer: networkd
wifis:
wlx-----:
dhcp4: yes
dhcp6: yes
access-points:
"network_ssid_name":
password: "**********"
Пожалуйста, замените здесь имя вашего беспроводного интерфейса вместо wlx --- -. Обратите внимание, что имя и пароль точки доступа заключены в кавычки ". Интервалы, отступы и т. Д. Имеют решающее значение, внимательно проверьте дважды.
Сохраните (Ctrl + o, затем Enter) и выйдите (Ctrl + x). текстовый редактор nano. Следуйте:
sudo netplan generate
sudo netplan apply
Если вместо этого вы предпочитаете статический IP-адрес для сервера, вы можете найти шаблон здесь:
cat /usr/share/doc/netplan/examples/wireless.yaml