Raspberry Pi as Access Point: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
{{Tipp|Note to self: Check collective for more details!}} | {{Tipp|Note to self: Check collective for more details!}} | ||
{{Tipp|If this interests you, maybe [[Raspberry Pi as Standalone Access Point]] does also?}} | {{Tipp|If this interests you, maybe [[Raspberry Pi as Standalone Access Point]] or [[T60 as Pi Ethernet-WiFi-Bridge]] does also?}} | ||
= About = | = About = |
Revision as of 17:42, 19 May 2024
💡 | Note to self: Check collective for more details! |
💡 | If this interests you, maybe Raspberry Pi as Standalone Access Point or T60 as Pi Ethernet-WiFi-Bridge does also? |
About
I was out of access points with external antennas, so I tried to use a Raspberry Pi 3 with an USB-Wifi-Stick as an access point.
Setup
- Download the latest OS for your Pi: https://www.raspberrypi.com/software/
- Insert your SD-Card while watching
dmesg -w
or usefdisk -l
to find your device. In my case it's/dev/sda
- Copy the image to the SD-card:
dd if=2024-03-15-raspios-bookworm-arm64-lite.img of=/dev/sda bs=1M
- Insert into the pi, power it up
- Complete basic setup: Choose keyboard layout, create user, enable sshd a.s.o. (
raspi-config
) apt-get update && apt-get upgrade
apt-get install hostapd dnsutils traceroute
Connecting WiFi-Stick
First try connecting the stick
dmesg -w
should show something like this:
[ 132.306961] usb 1-1.2: new high-speed USB device number 6 using dwc_otg [ 132.407915] usb 1-1.2: New USB device found, idVendor=0bda, idProduct=8812, bcdDevice= 0.00 [ 132.407939] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 132.407948] usb 1-1.2: Product: 802.11n NIC [ 132.407954] usb 1-1.2: Manufacturer: Realtek [ 132.407960] usb 1-1.2: SerialNumber: 123456
lsusb | grep WLAN
should show something like this:
Bus 001 Device 008: ID 0bda:8812 Realtek Semiconductor Corp. RTL8812AU 802.11a/b/g/n/ac 2T2R DB WLAN Adapter
You might want to check apt-get install firmware-realtek
(depends on device model)
Realtek 8812 model
I seem to have a Realtek 8812-knockoff, so they pointed me to https://github.com/aircrack-ng/rtl8812au
# apt-get install git dkms $ mkdir dev &6 cd dev $ git clone -b v5.6.4.2 https://github.com/aircrack-ng/rtl8812au.git $ cd rtl* # make dkms_install mkdir: created directory '/usr/src/8812au-5.6.4.2_35491.20191025' cp -r * /usr/src/8812au-5.6.4.2_35491.20191025 dkms add -m 8812au -v 5.6.4.2_35491.20191025 Creating symlink /var/lib/dkms/8812au/5.6.4.2_35491.20191025/source -> /usr/src/8812au-5.6.4.2_35491.20191025 dkms build -m 8812au -v 5.6.4.2_35491.20191025 Sign command: /lib/modules/6.6.20+rpt-rpi-v8/build/scripts/sign-file Signing key: /var/lib/dkms/mok.key Public certificate (MOK): /var/lib/dkms/mok.pub Certificate or key are missing, generating self signed certificate for MOK... Building module: Cleaning build area... 'make' -j4 KVER=6.6.20+rpt-rpi-v8 KSRC=/lib/modules/6.6.20+rpt-rpi-v8/build....................................................................................................................................................................................................................... Signing module /var/lib/dkms/8812au/5.6.4.2_35491.20191025/build/88XXau.ko Cleaning build area... dkms install -m 8812au -v 5.6.4.2_35491.20191025 88XXau.ko.xz: Running module version sanity check. - Original module - No original module exists within this kernel - Installation - Installing to /lib/modules/6.6.20+rpt-rpi-v8/updates/dkms/ depmod..... dkms status -m 8812au 8812au/5.6.4.2_35491.20191025, 6.6.20+rpt-rpi-v8, aarch64: installed
Connect the Stick (again)
[ 1239.507525] usb 1-1.2: new high-speed USB device number 6 using dwc_otg [ 1239.608748] usb 1-1.2: New USB device found, idVendor=0bda, idProduct=8812, bcdDevice= 0.00 [ 1239.608781] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 1239.608797] usb 1-1.2: Product: 802.11n NIC [ 1239.608809] usb 1-1.2: Manufacturer: Realtek [ 1239.608820] usb 1-1.2: SerialNumber: 123456 [ 1240.283354] 88XXau: loading out-of-tree module taints kernel. [ 1240.530118] usb 1-1.2: 88XXau 24:05:0f:f7:30:99 hw_info[d7] [ 1240.534494] usbcore: registered new interface driver rtl88XXau
The last three lines are new.
ip addr
is now showing the new interface:
4: wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2312 qdisc mq state DORMANT group default qlen 1000 link/ether 24:05:0f:f7:30:99 brd ff:ff:ff:ff:ff:ff
Enable and Configure Access Point
vi /etc/hostapd/hostapd.conf
and set something like this:
interface=wlan1 hw_mode=g channel=7 ieee80211n=1 wmm_enabled=1 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=3 wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP ssid=HMSCamdenLock wpa_passphrase=42_42_42_42 country_code=DE
Enable it
vi /etc/default/hostapd
…and comment this and set path:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
# systemctl unmask hostapd Removed "/etc/systemd/system/hostapd.service". # systemctl start hostapd