LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > tix
User Name
Password

Notices


Rate this Entry

Installing RTL8188FU (0bda:f179) & USING AS WIFI ACCESS POINT USING HOSTAPD

Posted 06-22-2023 at 03:30 AM by tix

##Installing drivers for Realtek (OEM) device (idVendor=0bda, idProduct=f179) - "rtl8188fu" which supports nl80211 drivers and thus AP (access point) mode
##together with getting hostpad working on the new device
##June 22nd, 2023
#Linux distribution of choice - Slackware 14.2 :)

#Ibrahim Kiptoo Kibowen - tkibowen@gmail.com
#Tunawakilisha +254 (representing the +254)

#"Wee... nani amekula ngwashe yangu?" (Hey! Who has eaten my sweet potatoes?)

##---------------------------------------------------------------------------------
##---------------------------------------------------------------------------------
##STEP 1 - GETTING THE PESKY REALTEK OEM (idVendor=0bda, idProduct=f179) WORKING
##---------------------------------------------------------------------------------
##---------------------------------------------------------------------------------

##REF: https://superuser.com/questions/1402...ror-linux-mint

#listing wlan USB devices using lsusb shows ::::
Bus 002 Device 004: ID 0bda:f179 Realtek Semiconductor Corp.
Bus 001 Device 003: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter

#--> 0bda:8179 is the TPLINK (Realtek) USB dongle already supported in Slackware 14.2 via RTL8188EU driver (wext only)
#--> 0bda:f179 is the troublesome Realtek (RTL OEM) USB dongle that does not have native support in Slackware 14.2


#METHOD 1 - clone repository and build the kernel module
git clone https://github.com/kelebek333/rtl8188fu.git
cd rtl8188fu
make
sudo make install

That will probably generate the following:

$ sudo make install
install -p -m 644 .ko /lib/modules/4.15.0-20-generic/kernel/drivers/net/wireless/
install: cannot stat '.ko': No such file or directory
Makefile:481: recipe for target 'install' failed
make: *** [install] Error 1


##METHOD 2 - using dkms
##install DKMS from slackbuilds - https://slackbuilds.org/repository/1...elopment/dkms/
##extract the slackbuilds archive - dkms.tar.gz --> should create folder dkms/
##copy dkms archive dkms-2.8.4.tar.gz into the dkms/ folder
##as superuser run the dkms.SlackBuild script
##new slackware package should be created - /tmp/dkms-2.8.4-x86_64-1_SBo.tgz --> copy into a safe place
##use slackpkg to install the new slackware package dkms-2.8.4-x86_64-1_SBo.tgz
## ..... kontinue .....

root@darkstar:/tmp/rtl8188fu# cd ..
root@darkstar:/tmp# dkms add ./rtl8188fu/
warning: Generating 12 missing index(es), please wait...

Creating symlink /var/lib/dkms/rtl8188fu/1.0/source ->
/usr/src/rtl8188fu-1.0

DKMS: add completed.
root@darkstar:/tmp# dkms install rtl8188fu/1.0

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
'make' all KVER=4.4.14...............
cleaning build area...

DKMS: build completed.

rtl8188fu.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/4.4.14/kernel/drivers/net/wireless//

depmod.....

DKMS: install completed.
root@darkstar:/tmp#

#as per slackbuilds page for dkms - add the following near top of /etc/rc.d/rc.local for
#automatic rebuilding & loading of new modules - similar to modprobe in older versions of slackware :)
# Enable DKMS module rebuilding
if [ -x /usr/lib/dkms/dkms_autoinstaller ]; then
echo "Running DKMS autoinstaller"
/usr/lib/dkms/dkms_autoinstaller start
fi


###----ifconfig --
#existing wlan0 (TPLINK) using RTL8188EU driver----
#new wlan1 Realtek (OEM) - (idVendor=0bda, idProduct=f179) - using newly installed driver "rtl8188fu"
root@darkstar:/home/tux# ifconfig wlan1 up
root@darkstar:/home/tux# ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.3.2 netmask 255.255.255.0 broadcast 192.168.3.255
inet6 fe80::a2e:5fff:fe23:57e6 prefixlen 64 scopeid 0x20<link>
ether 08:2e:5f:23:57:e6 txqueuelen 1000 (Ethernet)
RX packets 8000 bytes 9331807 (8.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3876 bytes 2292853 (2.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xfe400000-fe420000

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 14 bytes 864 (864.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 14 bytes 864 (864.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.100.9 netmask 255.255.255.0 broadcast 192.168.100.255
inet6 fe80::1ad6:c7ff:fe12:c418 prefixlen 64 scopeid 0x20<link>
ether 18:d6:c7:12:c4:18 txqueuelen 1000 (Ethernet)
RX packets 821 bytes 93546 (91.3 KiB)
RX errors 0 dropped 214 overruns 0 frame 0
TX packets 205 bytes 21994 (21.4 KiB)
TX errors 0 dropped 1 overruns 0 carrier 0 collisions 0

wlan1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 94:a4:08:6c:64:5f txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


############--------nl80211 drivers --> supported only phy0 (wlan1 - Realtek (OEM)) --> existing wlan0 (TPLINK - RTL8188EU) only supports wext
iw list
root@darkstar:/home/tux# iw list
Wiphy phy0
max # scan SSIDs: 9
max scan IEs length: 2304 bytes
max # sched scan SSIDs: 0
max # match sets: 0
Retry short limit: 7
Retry long limit: 4
Coverage class: 0 (up to 0m)
Supported Ciphers:
* WEP40 (00-0f-ac:1)
* WEP104 (00-0f-ac:5)
* TKIP (00-0f-ac:2)
* CCMP (00-0f-ac:4)
Available Antennas: TX 0 RX 0
Supported interface modes:
* IBSS
* managed
* AP
* P2P-client
* P2P-GO


#######--->wext drivers --> supported by both wlan0 (Realtek (OEM)) and wlan1 (TPLINK - RTL8188EU)
root@darkstar:/home/tux# iwconfig
lo no wireless extensions.

wlan1 unassociated Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency=2.412 GHz Access Point: Not-Associated
Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

wlan0 IEEE 802.11bgn ESSID:"Library" Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency:2.437 GHz Access Point: 64:5E:10:8C:5F:52
Bit Rate:72.2 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:****-****-****-****-****-****-****-**** Security mode:open
Power Management:off
Link Quality=0/100 Signal level=2/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

eth0 no wireless extensions.


##---------------------------------------------------------------------------------
##---------------------------------------------------------------------------------
##STEP 2 - INSTALLING HOSTAPD - FROM SOURCE TARBALL
##---------------------------------------------------------------------------------
##---------------------------------------------------------------------------------

###installing hostpad -- prefer using source tarball as installing using pre-built packages via pkgtool can cause library errors when executing the hostapd binary file :(
####installing hostapd## -- using source tarball (hostapd-2.10.tar.gz) from https://w1.fi/releases/hostapd-2.10.tar.gz
##copy source tarball to /tmp directory
root@darkstar:/home/tux/HOSTAPD# cp hostapd-2.10.tar.gz /tmp/

#change to /tmp directory
root@darkstar:/# cd tmp/

#extract the tarball in the /tmp directory
root@darkstar:/tmp# tar -xvzf hostapd-2.10.tar.gz
hostapd-2.10/
hostapd-2.10/CONTRIBUTIONS
hostapd-2.10/COPYING
hostapd-2.10/README
hostapd-2.10/hostapd/
hostapd-2.10/hostapd/.gitignore
hostapd-2.10/hostapd/Android.mk
hostapd-2.10/hostapd/ChangeLog
.....

#change to newly extracted archive folder
root@darkstar:/tmp# cd hostapd-2.10
#listing of files
root@darkstar:/tmp/hostapd-2.10# ls
CONTRIBUTIONS COPYING README hostapd src

#view readme using joe :)
root@darkstar:/tmp/hostapd-2.10# joe README

****near the top you see that you need a .config file to be able to build using "make" and install using "make install"*****

......

Source code files were moved around in v0.6.x releases and compared to
earlier releases, the programs are now built by first going to a
subdirectory (wpa_supplicant or hostapd) and creating build
configuration (.config) and running 'make' there (for Linux/BSD/cygwin
builds).

......


#change to the hostapd sub-folder
root@darkstar:/tmp/hostapd-2.10/hostapd# ls
Android.mk README android.config ctrl_iface.c eap_register.c hapd_module_tests.c hlr_auc_gw.txt hostapd.android.rc hostapd.eap_user hostapd.sim_db hostapd_cli.1 main.c wired.conf
ChangeLog README-MULTI-AP config_file.c ctrl_iface.h eap_register.h hlr_auc_gw.c hostapd.8 hostapd.conf hostapd.eap_user_sqlite hostapd.vlan hostapd_cli.c nt_password_hash.c wps-ap-nfc.py
Makefile README-WPS config_file.h defconfig eap_testing.txt hlr_auc_gw.milenage_db hostapd.accept hostapd.deny hostapd.radius_clients hostapd.wpa_psk logwatch sae_pk_gen.c

#open the README file inside hostapd sub-folder
root@darkstar:/tmp/hostapd-2.10/hostapd# joe README

****somewhere near the middle of the file you see instructions for creating a .config file using sample deconfig file******

.......
Build configuration
-------------------

In order to be able to build hostapd, you will need to create a build
time configuration file, .config that selects which optional
components are included. See defconfig file for example configuration
and list of available options.


#listing of all files in the hostapd sub-directory show no existing .config file
root@darkstar:/tmp/hostapd-2.10/hostapd# ls -alh
total 820K

drwxrwxr-x 3 root root 4.0K Jan 16 2022 .
drwxrwxr-x 4 root root 4.0K Jun 22 10:26 ..
-rw-rw-r-- 1 root root 56 Jan 16 2022 .gitignore
-rw-rw-r-- 1 root root 23K Jan 16 2022 Android.mk
-rw-rw-r-- 1 root root 66K Jan 16 2022 ChangeLog
-rw-rw-r-- 1 root root 29K Jan 16 2022 Makefile
....


#MEEEEOOOOOWWWWWW!! the defconfig file into .config file LOL!! :)
root@darkstar:/tmp/hostapd-2.10/hostapd# cat defconfig > .config

#listing of all files in the hostapd sub-directory show shows an existing .config file :)
root@darkstar:/tmp/hostapd-2.10/hostapd# ls -alh
total 836K
drwxrwxr-x 3 root root 4.0K Jun 22 10:30 .
drwxrwxr-x 4 root root 4.0K Jun 22 10:26 ..
-rw-r--r-- 1 root root 14K Jun 22 10:30 .config
-rw-rw-r-- 1 root root 56 Jan 16 2022 .gitignore
-rw-rw-r-- 1 root root 23K Jan 16 2022 Android.mk
-rw-rw-r-- 1 root root 66K Jan 16 2022 ChangeLog

.......


#Build hostapd using make and it should output many info :)
root@darkstar:/tmp/hostapd-2.10/hostapd# make
CC main.c
CC config_file.c
CC ../src/ap/hostapd.c
CC ../src/ap/wpa_auth_glue.c
CC ../src/ap/drv_callbacks.c
CC ../src/ap/ap_drv_ops.c
CC ../src/ap/utils.c
CC ../src/ap/authsrv.c
CC ../src/ap/ieee802_1x.c
CC ../src/ap/ap_config.c
CC ../src/ap/eap_user_db.c
CC ../src/ap/ieee802_11_auth.c
CC ../src/ap/sta_info.c
CC ../src/ap/wpa_auth.c
CC ../src/ap/tkip_countermeasures.c
CC ../src/ap/ap_mlme.c
CC ../src/ap/wpa_auth_ie.c
CC ../src/ap/preauth_auth.c
CC ../src/ap/pmksa_cache_auth.c
CC ../src/ap/ieee802_11_shared.c
CC ../src/ap/beacon.c
CC ../src/ap/bss_load.c
CC ../src/ap/neighbor_db.c
CC ../src/ap/rrm.c
CC ../src/drivers/drivers.c
......


##in the end, if no errors, make should return you to command prompt
LD hostapd
CC hostapd_cli.c
CC ../src/common/wpa_ctrl.c
CC ../src/common/cli.c
CC ../src/utils/edit_simple.c
LD hostapd_cli
root@darkstar:/tmp/hostapd-2.10/hostapd#


##install hostpad using make install
root@darkstar:/tmp/hostapd-2.10/hostapd# make install
install -D hostapd /usr/local/bin//hostapd
install -D hostapd_cli /usr/local/bin//hostapd_cli
root@darkstar:/tmp/hostapd-2.10/hostapd#

##Yipeeee!!!!!!! ARRRRRrrrr........ l8tr! :) LOL!!
##success no errors - hostapd installed successfully!

##test your hostapd binary - should not give errors
##first see the available options
root@darkstar:/tmp/hostapd-2.10/hostapd# hostapd --help
hostapd: invalid option -- '-'
hostapd v2.10
User space daemon for IEEE 802.11 AP management,
IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
Copyright (c) 2002-2022, Jouni Malinen <j@w1.fi> and contributors

usage: hostapd [-hdBKtv] [-P <PID file>] [-e <entropy file>] \
[-g <global ctrl_iface>] [-G <group>]\
[-i <comma-separated list of interface names>]\
<configuration file(s)>

options:
-h show this usage
-d show more debug messages (-dd for even more)
-B run daemon in the background
-e entropy file
-g global control interface path
-G group for control interfaces
-P PID file
-K include key data in debug messages
-i list of interface names to use
-S start all the interfaces synchronously
-t include timestamps in some debug messages
-v show hostapd version
root@darkstar:/tmp/hostapd-2.10/hostapd#


#check version
root@darkstar:/tmp/hostapd-2.10/hostapd# hostapd -v
hostapd v2.10
User space daemon for IEEE 802.11 AP management,
IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
Copyright (c) 2002-2022, Jouni Malinen <j@w1.fi> and contributors
root@darkstar:/tmp/hostapd-2.10/hostapd#

#kewl .... no errors .... yippeee!!

##---------------------------------------------------------------------------------
##---------------------------------------------------------------------------------
##STEP 3 - CREATING HOSTAPD CONFIGURATION FILE
##---------------------------------------------------------------------------------
##---------------------------------------------------------------------------------

##you can create a sample hostapd configuration file :::::
#first create a directory for your configurations files :)
root@darkstar:/tmp/hostapd-2.10/hostapd# mkdir /etc/myhostapdconfig

#change to the newly created hostpapd directory
root@darkstar:/tmp/hostapd-2.10/hostapd# cd /etc/myhostapdconfig
root@darkstar:/etc/myhostapdconfig#

#create a new hostapd file ....for example call it hostapd_rtl.conf
#you can create either by "touch hostapd_rtl.conf" then open with your favorite editor :)
#in my case, I simply use Joe --> "joe hostapd_rtl.conf"

##key features of the file are :::::
1) interface -> in this case wlan1 (RTL OEM)
2) driver -> nl80211 - AP mode on the wifi device may not work with wext drivers
3) ssid -> name of your network as seen from wireless devices -- e.g. TuxBox
4) wpa_passphrase -> password to access your network --- e.g. ladies@667

interface=wlan1
driver=nl80211

hw_mode=g
channel=1
ssid=TuxBox

wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
wpa_passphrase=ladies@667

#save the file and exit :) LOL!!! AARRRRRRrrr....... l8tr!

##---------------------------------------------------------------------------------
##---------------------------------------------------------------------------------
##STEP 4 - CREATING ADDITIONAL CONFIGURATION FILES - DHCP FOR wlan1
##---------------------------------------------------------------------------------
##---------------------------------------------------------------------------------

#create a file for dhcp via wlan1 (RTL OEM) - e.g. dhcpd_wlan1.conf

##**README_LINE**
##************************************************************************************************** ******************************************
##*****************************RECOMMENDED FURTHER READING so that the dhcp configuration below works as expected*****************************
##************************************************************************************************** ******************************************
## 1) configuring bind DNS server
## 2) setup of packet forwarding, ip masquerading and routing using iptables
## *iptables is especially useful if you have another interface with internet which you want to share using hostapd on wlan1 (RTL OEM) - e.g. ppp0, eth0, .../etc

root@darkstar:/etc/myhostapdconfig# joe dhcpd_wlan1.conf

#config for machines connected via wireless (wlan1 RTL OEM)
subnet 192.168.7.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.7.255;
option routers 192.168.7.1;
option domain-name-servers 192.168.7.1;
range 192.168.7.11 192.168.7.101;
range 192.168.7.102 192.168.7.230;
}

#save the file and exit :) LOL!!! AARRRRRRrrr....... l8tr!


##---------------------------------------------------------------------------------
##---------------------------------------------------------------------------------
##STEP 5 - CREATING HOSTAPD STARTUP FILE
##---------------------------------------------------------------------------------
##---------------------------------------------------------------------------------
#start the hostapd using your newly created configuration file
#you can create a startup script where you hostapd configuration file lives -- e.g. startwifi.sh
root@darkstar:/etc/myhostapdconfig# joe startwifi.sh

#put the following items

##<--------COPY PASTE BEGIN--------->
#!/bin/bash

#bring up wireless interface wlan1 using a fixed ip address - as it will be the Listener :) LOL!!! hahahhahhahhehehehhe
`ifconfig wlan1 192.168.7.1 up`

#bring up hostpad using your configuration file --- .e.g hostapd_rtl.conf --> if all goes well - no errors :)
`/usr/local/bin/hostapd -B /etc/myhostapdconfig/hostapd_rtl.conf`

##turn on DHCP server for wlan1 (RTL OEM)
`dhcpd -cf /etc/myhostapdconfig/dhcpd_wlan1.conf wlan1`


##addme --> iptables firewall --- guugle :)

##addme --> bind dns configuration -- guugle :)

#LOL!
##<--------COPY PASTE END----------->

#save the file and exit :) LOL!!! AARRRRRRrrr....... l8tr!
#give the file executable permissions

root@darkstar:/etc/myhostapdconfig# chmod 755 startwifi.sh

##IMPORTANTE --->> goto ##**README_LINE** above :)

#run the startup script

root@darkstar:/etc/myhostapdconfig# ./startwifi.sh

#if all goes well, you can open the wifi on your fone/tablet/laptop and you should see your wifi network running on RTL OEM using hostpad

##IMPORTANTE --->> goto ##**README_LINE** above :)

##---------------------------------------------------------------------------------
##---------------------------------------------------------------------------------
##STEP 6 - STARTING HOSTAPD AND WIFI ACCESS POINT (AP) AT SYSTEM STARTUP
##---------------------------------------------------------------------------------
##---------------------------------------------------------------------------------
#add the startup script the system startup script /etc/rc.d/rc.local

root@darkstar:/etc/myhostapdconfig# joe /etc/rc.d/rc.local

##--> bringin up wifi using hostpad and RTL OEM RTL8188FU -> note the space between . and /
`. /etc/myhostapdconfig/startwifi.sh`


#save the file and exit :) LOL!!! AARRRRRRrrr....... l8tr!
#..... the wifi service should start each time system start :)

##IMPORTANTE --->> goto ##**README_LINE** above :)


##Karibu, keti chini. (Welcome, sit down)
##Utatumia nini? (What will you eat?)
##Nipe ugali, mboga, maharagwe na chai. (Give me ugali, vegetables, beans and tea)
##Karibu sana. (Welcome)

#Tunwakilisha +254 (Representing the +254)
Posted in Uncategorized
Views 1565 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 09:11 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration