Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jun 2020 08:25:52 +0300
From:      Rozhuk Ivan <rozhuk.im@gmail.com>
To:        freebsd-net@freebsd.org, freebsd-hackers@freebsd.org
Cc:        Rozhuk Ivan <Rozhuk.IM@gmail.com>
Subject:   WiFi with AC on FreeBSD
Message-ID:  <20200610082552.0e08045c@rimwks>

next in thread | raw e-mail | index | archive | help
Hi!

For peoples who want to use linux WiFi drivers on FreeBSD with minimum support overhead :)

This "how-to" (draft) describes how to use OpenWRT as driver with web GUI for WiFi adapters.
No more pain with slow speed, no strange wpa_supplicant gui tools :)

This upgrades WiFi speed from
media: IEEE 802.11 Wireless Ethernet OFDM/36Mbps mode 11a
to 866Mbps on my notebook with intel 8265.


Resourses required:
- 256 Mb ram
- 128 Mb on hard drive
- IOMMU support
- FreeBSD AMD64


1. Download EFI based build.
WWW: https://openwrt.org/docs/guide-developer/uefi-bootable-image
cd /root/
fetch https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-x86-64-generic-squashfs-combined-efi.img.gz
gunzip openwrt-x86-64-generic-squashfs-combined-efi.img.gz


2. Install sysutils/bhyve-firmware from ports.
CSM not required.
Patch required to build port (last attached):
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211074


3. Configure system:
WWW:
https://www.freebsd.org/doc/handbook/virtualization-host-bhyve.html
https://wiki.freebsd.org/bhyve/pci_passthru

echo 'net.link.tap.up_on_open=1' >> /etc/sysctl.conf


/etc/rc.conf:
kld_list="nmdm vmm"
cloned_interfaces="tap0"
ifconfig_tap0_name="wifi0"
ifconfig_wifi0="DHCP up"
ifconfig_wifi0_ipv6="inet6 accept_rtadv auto_linklocal -ifdisabled"


/boot/loader.conf
# bhyve PCI device passthru.
# "1/0/0" - PCI dev ident, see: pciconf -lv
pptdevs="1/0/0"

# For AMD systems
hw.vmm.amdvi.enable="1"


4. Start OpenWRT

/usr/sbin/bhyvectl --destroy --vm=owrt
/usr/sbin/bhyve \
	-A \
	-H \
	-c 2 \
	-m 256M \
	-S \
	-s 0:0,hostbridge \
	-s 1:0,lpc -l com1,stdio \
	-s 3:0,ahci-hd,openwrt-x86-64-generic-squashfs-combined-efi.img \
	-s 5:0,e1000,tap0,mac=00:be:fa:76:45:01 \
	-s 7,passthru,1/0/0 \
	-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
	owrt

To disable output remove: "-l com1,stdio"
"1/0/0" - PCI dev ident, same as in loader.conf.


5. Configure OpenWRT:
uci set network.lan.ipaddr='172.16.0.49'
uci set network.lan.netmask='255.255.255.0'
uci set network.lan.gateway='172.16.0.254'
uci add_list network.lan.dns='172.16.0.254'
uci commit network
/etc/init.d/network restart

opkg update
opkg install luci

Now web GUI can be used to install wpad*, hostapd*, WiFi driver and other staff.

If you want use OpenWRT as bridge - read this: https://openwrt.org/docs/guide-user/network/wifi/relay_configuration
Better to start with simple rourer+nat mode.






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200610082552.0e08045c>