Alpine linux настройка wifi

How to setup a wireless access point

This material is work-in-progress .

Do not follow instructions here until this notice is removed.
(Last edited by Bt129 on 25 Jul 2021.)

Install needed packages

apk add bridge hostapd wireless-tools wpa_supplicant

Check that the card is detected

Run cat /proc/net/dev to see which cards are detected. If no cards are available, check what driver the card uses and modprobe it. Check that the card is in master mode.

Setup Bridge

Setup the bridge by editing /etc/network/interfaces . Assuming you wish to bridge the access point to the ethernet device eth0 , you can add something like this:

auto br0 iface br0 inet dhcp hostname alpine bridge-ports eth0

Comment out any existing lines configuring eth0 as this should now be handled via the bridge configuration. It is not necessary to mention wlan0 here, as hostapd will take care of adding the device to the bridge later.

Please see Bridge for more information on network bridges.

Setup Encryption

Edit /etc/hostapd/hostapd.wpa_psk and insert the following, replacing PASSPHRASE with the WPA_PSK key you would like to use (remove keys that you don’t want to use):

Setup hostapd

Edit /etc/hostapd/hostapd.conf and make the necessary changes such as interface, bridge, driver, ssid, etc. Example file below:

interface=wlan0 bridge=br0 driver=hostap logger_syslog=-1 logger_syslog_level=2 logger_stdout=-1 logger_stdout_level=2 debug=0 dump_file=/tmp/hostapd.dump ctrl_interface=/var/run/hostapd ctrl_interface_group=0 ssid=SecureSSID #macaddr_acl=1 #accept_mac_file=/etc/hostapd/accept auth_algs=3 eapol_key_index_workaround=0 eap_server=0 wpa=3 wpa_psk_file=/etc/hostapd/hostapd.wpa_psk wpa_key_mgmt=WPA-PSK wpa_pairwise=CCMP

If you wish to use MAC address filtering, uncomment the lines starting with macaddr_acl and accept_mac_file, create /etc/hostapd/accept (with permissions set to 600) and add the allowed clients’ MAC address to the file.

Associate clients

Associate a few clients to test.

Читайте также:  Билайн тариф интернет вайфай

See also

Источник

Wi-Fi

This page describes how to set up a wireless network connection with WPA encryption.

Choose a wireless daemon between

Prerequisites

iwd

Iwd (iNet wireless daemon) is a wireless daemon written by Intel and aiming at replacing Alpine Linux 3.10.

To do anything with iwd, it has to be running:

If it was not running, running iwctl .. commands will print

The name net.connman.iwd was not provided by any .service files Failed to retrieve IWD dbus objects, quitting.

and running just iwctl will say it is waiting for IWD to start.

List your available wifi device(s) (you probably have wlan0):

If you don’t know the SSID of your network you can run a scan and retrieve a list of all the detected networks:

$ iwctl station wlan0 scan && iwctl station wlp8s0 get-networks

$ iwctl station wlan0 connect

Note: iwd automatically stores network passphrases in the /var/lib/iwd directory and uses them to auto-connect in the future. If you run diskless Alpine, make sure to include this directory to the apkovl and commit:

# lbu add /var/lib/iwd && lbu commit -d

Note: Since version 1.10, iwd supports IPv6, but it is disabled by default. To enable it, add the following to the configuration file:

Contents of /etc/iwd/main.conf

Add a entry for the desired interface (e.g. wlan0 ):

Contents of /etc/network/interfaces

Note: You could instead use the iwd’s built-in network configuration by setting EnableNetworkConfiguration=true in /etc/iwd/main.conf

Contents of /etc/iwd/main.conf

Manually restart networking:

# rc-service networking restart

Your wifi interface should now be up and have a dedicated IP adress:

Useful link: Archlinux wiki page if you need more specific configuration.

wpa_supplicant

To list your available network interfaces:

Note: if you don’t see any wireless interfaces (e.g. wlan0 ), you probably need to load and/or install drivers/firmware.

Bring up the desired interface:

Note: If this errors with ioctl 0x8914 failed: No error information , that’s busybox ip ‘s way of saying your wireless radio is rfkill’d. See the Rfkill section for information on how to unblock your wireless radio.

Use this command to add your Wi-Fi network to wpa_supplicant:

Читайте также:  Тенда настроить вай фай

# wpa_passphrase ‘ExampleWifiSSID’ ‘ExampleWifiPassword’ > /etc/wpa_supplicant/wpa_supplicant.conf

(Access point not broadcasting its SSID requires additional line scan_ssid=1 in the file wpa_supplicant.conf )

Note: the Wi-Fi SSID and password are case sensitive and the single quote before and after the SSID and password need to be there

Start wpa_supplicant in the foreground to make sure the connection succeeds.

# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

If all is well, run it as a daemon in the background by setting the -B option.

# wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

Configure the interface with an IP address.

Sanity check: the interface should have a inet address.

Automatic Configuration on System Boot

Add a entry for the desired interface (e.g. wlan0 ):

Contents of /etc/network/interfaces

Sanity check: Make sure /etc/wpa_supplicant/wpa_supplicant.conf is the correct configuration for the wireless access point you want to connect to.

Manually restart (or start) networking.

# /etc/init.d/networking —quiet restart &

If all is well (feel free to confirm with the sanity checks),

Configure wpa_supplicant to start automatically on boot:

# rc-update add wpa_supplicant boot

Also make sure networking is set to automatically start on boot:

# rc-update add networking boot

Optional security precaution:

this is not necessary and on it.

Launching udhcpc through wpa_cli actions

With the above configuration, udhcpc will only run once at boot. If the Wifi isn’t available then, or the network changes in between, it needs to be notified. This is done through the wpa_cli action script in /etc/wpa_supplicant/wpa_cli.sh

Automatic Reconnection when WIFI signal is lost

To enable automatic reconnection when wifi signal is lost add these to config:

Contents of /etc/wpa_supplicant/wpa_supplicant.conf

# rc-update add wpa_cli boot

Troubleshooting

Broadcom Wi-Fi Chipset Users

The Broadcom chipset is quite popular among older computers. The b43 driver is included in the linux-lts or linux-edge kernel packages. However, you might need to compile the firmware manually for this chipset as it is not included in linux-firmware for some cargs.

You can check if you have a Broadcom chipset by using lspci:

Now we have everything to download the proprietary driver and extract the firmware from it:

Читайте также:  Mp 495 wi fi

# export FIRMWARE_INSTALL_DIR=»/lib/firmware» $ wget http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2 $ tar xjf broadcom-wl-5.100.138.tar.bz2 # b43-fwcutter -w «$FIRMWARE_INSTALL_DIR» broadcom-wl-5.100.138/linux/wl_apsta.o

More information can be found here.

Now you need to use modprobe so the device will show up:

Now continue with the normal instructions.

Rfkill

Many laptops have a hardware button (or switch) to turn off wireless card, however, the card can also be blocked by kernel. This can be changed using rfkill. To show the current of your Wi-Fi:

~ $ rfkill list 0: phy0: wlan Soft blocked: no Hard blocked: no

If the card is hard-blocked, use the hardware button or switch to unblock it. If the card is not hard-blocked but soft-blocked, use the following command:

Источник

NetworkManager

NetworkManager is a program that provides automatic detection and configuration for systems to connect to networks.

Installation

Then set it to autostart the service on boot:

# rc-update add networkmanager default

Also your user needs to be in the plugdev group:

Wireless networks

wpa_supplicant backend

Todo: (KDE Plasma Desktop) find out if it is possible to prevent requesting the password for KDE Wallet on login

[main] dhcp=internal plugins=ifupdown,keyfile [ifupdown] managed=true [device] wifi.scan-rand-mac-address=yes wifi.backend=wpa_supplicant

Now you need to stop conflicting services:

# rc-service networking stop

# rc-service wpa_supplicant stop

Now restart NetworkManager:

# rc-service networkmanager restart

Now connect to a network using one of the interfaces mentioned in Installation

If that connects and stays connected with no issues enable the networkmanager service and disable the networking and wpa_supplicant boot services:

# rc-update add networkmanager

# rc-update del networking boot

# rc-update del wpa_supplicant boot

iwd backend

NetworkManager supports wireless networks through existing issues before using it. After installation, enable the server and restart NetworkManager:

rc-service iwd start rc-service networkmanager restart

VPN support

Since version 1.16, NetworkManager has support for Wireguard[1].

Support for other VPN types is provided by plugins. They are provided in the following packages:

not authorized to control networking

You can enable all users to edit connections without adding polkit. First, make the conf.d directory for networkmanager: # mkdir -p /etc/NetworkManager/conf.d Then, add following content to /etc/NetworkManager/conf.d/any-user.conf :

Источник

Оцените статью
Adblock
detector