DEV Community

RAHUL DHOLE
RAHUL DHOLE

Posted on

2

Proxmox WiFi Connection Story

I bought usb wifi adapter Realtek Semiconductor Corp. USB3.0 802.11ac 1200M Adapter
but I didn't know how to connect it on Proxmox.

Via bypass to VM

Bypass USB

lsusb | grep Realtek
# Bus 001 Device 003: ID 0bda:b812 Realtek Semiconductor Corp. RTL88x2bu [AC1200 Techkey]
qm set [REPLACE_VMID] -usb0 host=[REPLACE_ID]
qm set 998 -usb0 host=0bda:b812
# Restart VM
Enter fullscreen mode Exit fullscreen mode

Bypass in LXC

Via official docs (Worked but not so well tried installing many drivers don't remember all) (Note: restart server multiple times don't worry)
Articles:

Add wpa_supplicant

# Command to generate passphrase psk
su -l -c "wpa_passphrase Livebox-6130_5GHz real_password > /etc/wpa_supplicant.conf"
Enter fullscreen mode Exit fullscreen mode
# nano /etc/wpa_supplicant/wpa_supplicant-wlx90de806f0ac9.conf
trl_interface=/run/wpa_supplicant

network={
        ssid="Livebox-6130_5GHz"
        #psk="real_password"
        psk=578647825626be5ee793b531dfd9dd525530cc2ce8fa8e06096e8d67bff0a3ca
}
Enter fullscreen mode Exit fullscreen mode
# ip link up
sudo ip link set wlx90de806f0ac9 up
ip link

# connect wifi
sudo wpa_supplicant -B -i wlx90de806f0ac9 -c /etc/wpa_supplicant/wpa_supplicant-wlx90de806f0ac9.conf

# get IP
dhclient wlx90de806f0ac9
# or reload it by > dhclient wlx90de806f0ac9 -r
Enter fullscreen mode Exit fullscreen mode
# wlx90de806f0ac9 is wifi adapter interface name `iwconfig`
# nano /etc/network/interfaces
auto wlx90de806f0ac9
iface wlx90de806f0ac9 inet dhcp
        wpa-driver wext
        wpa-conf /etc/wpa_supplicant/wpa_supplicant-wlx90de806f0ac9.conf
        wireless-rate 54M

## Apply (WORKED)
# before make sure it can connect via `sudo wpa_supplicant -B -i wlx90de806f0ac9 -c /etc/wpa_supplicant/wpa_supplicant-wlx90de806f0ac9.conf`
sudo pkill -f "wpa_supplicant|dhclient|iwp|iwe|iwconfig|ifconfig|iwlist"
sudo systemctl restart networking
Enter fullscreen mode Exit fullscreen mode
Trying to create a bridge other ways (worked but still need somem tests)
# /etc/network/interfaces
allow-hotplug wlx90de806f0ac9
iface wlx90de806f0ac9 inet dhcp
        wpa-driver wext
        wpa-conf /etc/wpa_supplicant/wpa_supplicant-wlx90de806f0ac9.conf
        wireless-rate 54M

auto vmbr2
iface vmbr2 inet static
    address 192.168.200.1/24
    #gateway 192.168.1.1
    bridge-ports none 
    bridge-stp off
    bridge-fd 0
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    post-up iptables -t nat -A POSTROUTING -s '192.168.200.0/24' -o wlx90de806f0ac9 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '192.168.200.0/24' -o wlx90de806f0ac9 -j MASQUERADE
    post-up   iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
    post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
Enter fullscreen mode Exit fullscreen mode

Bypass is a simple solution but what if I want it on the proxmox itself?

Via Network Manager (Works Well Tested)

lsusb
# 0bda:b812 Realtek Semiconductor Corp. RTL88x2bu [AC1200 Techkey]
apt update
apt install wireless-tools # I installed it for iwconfig specially
iwconfig
apt upgrade
apt install pve-headers-$(uname -r)
apt install pve-firmware
reboot
iwconfig
Enter fullscreen mode Exit fullscreen mode

To connect a wifi (https://www.makeuseof.com/connect-to-wifi-with-nmcli/)

apt install network-manager
nmcli device wifi list # dev or device both are same
nmcli dev status # similar to iwconfig to find wifi interface name like wlx90de806f0ac9
nmcli connection up "SSID Name in double quotes" password "password double quotes"
nmcli --ask dev wifi connect "Livebox-6130_5GHz" # ask
nmcli connection up "Livebox-6130_5GHz" password "Helloworld"
nmcli radio wifi # check status 
nmcli radio wifi on
nmcli radio wifi off
Enter fullscreen mode Exit fullscreen mode

See IP info

nano /etc/NetworkManager/system-connections/Livebox_5GHz.nmconnection 
Enter fullscreen mode Exit fullscreen mode

Failures

  1. adding wifi into /etc/network/interfaces does not work

Troublshoot

  1. Always make sure ip link is UP

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay