Page 1 of 1

Edimax EW-7811un Wifi USB nano dongle; 10.3 & 11.0 setup

Posted: Sat Nov 12, 2016 6:10 pm
by wb7odyfred
HowTo setup Wifi Edimax EW-7811utn USB Dongle for GhostBSD 10.3 & 11.0

Note that in FreeBSD 12.0 Current revision 307529, the driver was rewritten where the USB & PCI Realtek Devices
where incorporated into one driver rtwn. Load kernel modules: if_rtwn.ko if_rtwn_usb.ko For RTL8188CE Load kernel module: if_rtwn_pci.ko
fred@kliktel ~> uname -mrs
FreeBSD 12.0-CURRENT amd64
fred@kliktel ~> uname -a
FreeBSD kliktel.ghostbsd-pc.home 12.0-CURRENT FreeBSD 12.0-CURRENT #1 r310386M: Thu Dec 22 19:08:02 PST 2016 fred@kliktel.ghostbsd-pc.home:/usr/obj/usr/src/sys/GENERIC amd64

Here are some websites URL to read up on, to gain knowledge about wireless setup on FreeBSD.

https://vzaigrin.wordpress.com/2014/04/ ... h-freebsd/
https://vzaigrin.wordpress.com/2016/10/ ... pberry-pi/
http://unsolicitedbutoffered.blogspot.c ... and_2.html
http://wiki.ghostbsd.org/wiki/index.php/FAQ
http://ghostbsd.org/forums/viewtopic.php?f=58&t=86
viewtopic.php?f=64&t=384
https://www.freebsd.org/doc/handbook/ne ... eless.html
http://wiki.ghostbsd.org/wiki/index.php ... quirements
http://wiki.ghostbsd.org/wiki/index.php/FAQ#Network

# 3 Files to add configuration lines into /boot/loader.conf /etc/rc.conf /etc/wpa_supplicant.conf
#/boot/loader.conf

Code: Select all

if_urtwn_load="YES"
legal.realtek.license_ack=1

#/etc/rc.conf add 2 lines for Edimax EW-7811utn

Code: Select all

wlans_urtwn0="wlan0"
ifconfig_urtwn0="DHCP"
#/etc/wpa_supplicant.conf for an Open Network connection

Code: Select all

network={
 	ssid="innflux"
        key_mgmt=NONE
}
#/etc/wpa_supplicant.conf file for WPA2 Network connection


# or this Network card configuration by Networkmgr added to /etc/rc.conf file
# I needed to set Wifi to channel 6. and the WifiMgr application program looks for word "WPA" to determine wireless Lan devices. With the open network, the network connection will function with or without the word "WPA" set in the /etc/rc.conf file.
wlans_urtwn0="wlan0"
ifconfig_wlan0=" WPA channel 6 DHCP"

Now open a MATE terminal and login as root. Try the next two lines
#su root
password:

#create urtwn0 device

Code: Select all

ifconfig wlan0 create wlandev urtwn0
# restart the two network services: network interface and routing

Code: Select all

service  netif restart
service routing restart
#scan for operating wifi access points

Code: Select all

ifconfig wlan0 up scan


fred@kliktel ~> ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 74:da:38:70:0b:85
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
status: no carrier
ssid "" channel 10 (2457 MHz 11g)
regdomain FCC country US authmode OPEN privacy OFF txpower 30 bmiss 7
scanvalid 60 protmode CTS wme bintval 0
groups: wlan
fred@kliktel ~> ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 74:da:38:70:0b:85
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
status: no carrier
ssid "" channel 10 (2457 MHz 11g)
regdomain FCC country US authmode OPEN privacy OFF txpower 30 bmiss 7
scanvalid 60 protmode CTS wme bintval 0
groups: wlan

#setup wifi parameters for channel 4 and network ID name "innflux"

Code: Select all

ifconfig wlan0 up channel 4 ssid innflux
fred@kliktel ~> ifconfig wlan0 channel 4 ssid innflux
ifconfig: SIOCS80211: Operation not permitted
fred@kliktel ~>

Code: Select all

sudo ifconfig wlan0 channel 4 ssid innflux
Password:
fred@kliktel ~>

Code: Select all

 ifconfig wlan0 
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 74:da:38:70:0b:85
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
status: associated
ssid innflux channel 1 (2412 MHz 11g ht/20) bssid 2c:e6:cc:25:82:08
regdomain FCC country US authmode OPEN privacy OFF txpower 30 bmiss 7
scanvalid 60 protmode CTS ht20 -ampdutx ampdurx ampdulimit 64k -stbc
wme
groups: wlan
fred@kliktel ~> ping -c 3 he.net
ping: ssend socket: Operation not permitted
fred@kliktel ~> sudo ping -c 3 he.net
ping: cannot resolve he.net: Host name lookup failure
fred@kliktel ~> dhclient wlan0
Cannot open or create pidfile: Permission denied
ifconfig: up: permission denied
wlan0: not found
exiting.
fred@kliktel ~> sudo dhclient wlan0
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 19
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
DHCPOFFER from 10.59.1.1
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14
# looking at response above, that Wii-Fi signal was too weak to connect properly
su root
password:
root@kliktel:/usr/home/fred #

Code: Select all

 dhclient wlan0
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
DHCPOFFER from 10.59.1.1
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPACK from 10.59.1.1
bound to 10.59.24.110 -- renewal in 5400 seconds.
root@kliktel:/usr/home/fred #
root@kliktel:/usr/home/fred #

Code: Select all

 ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 74:da:38:70:0b:85
inet 10.59.24.110 netmask 0xffffe000 broadcast 10.59.31.255
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
status: associated
ssid innflux channel 1 (2412 MHz 11g ht/20) bssid 2c:e6:cc:25:82:08
regdomain FCC country US authmode OPEN privacy OFF txpower 30 bmiss 7
scanvalid 60 protmode CTS ht20 -ampdutx ampdurx ampdulimit 64k -stbc
wme
groups: wlan
root@kliktel:/usr/home/fred #
root@kliktel:/usr/home/fred #

Code: Select all

 ping -c 3 he.net
PING he.net (216.218.186.2): 56 data bytes
64 bytes from 216.218.186.2: icmp_seq=0 ttl=54 time=45.467 ms
64 bytes from 216.218.186.2: icmp_seq=1 ttl=54 time=63.632 ms

--- he.net ping statistics ---
3 packets transmitted, 2 packets received, 33.3% packet loss
round-trip min/avg/max/stddev = 45.467/54.549/63.632/9.083 ms
root@kliktel:/usr/home/fred #
#now change wifi channel 6 to connect to T-Mobile Phone wifi mobile hotspot
root@kliktel:/etc #

Code: Select all

 ifconfig wlan0 up channel 6 
root@kliktel:/etc #

Code: Select all

 ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 74:da:38:70:0b:85
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
status: associated
ssid "T-Mobile BlackBerry 9770" channel 6 (2437 MHz 11g ht/20) bssid 40:6f:2a:c3:db:f9
regdomain FCC country US authmode OPEN privacy OFF txpower 30 bmiss 7
scanvalid 60 protmode CTS ht20 -ampdutx ampdurx ampdulimit 8k
ampdudensity 8 smps -stbc wme
groups: wlan
root@kliktel:/etc #

Code: Select all

 killall dhclient 
dhclient wlan0
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
DHCPOFFER from 192.168.0.1
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPACK from 192.168.0.1
bound to 192.168.0.2 -- renewal in 3600 seconds.
root@kliktel:/etc #
# see that it connected after only a couple DHCPDISCOVER packets to the cell phone mobile hotspot. Its a stronger signal than the Wi-Fi Access Point signal.

I hope this helps you get Wi-Fi working with your GhostBSD /FreeBSD computer. Please comment and add corrections and suggestions to make this forum post better.
I don't know how the Networkmgr GUI Wi-Fi parts work from the desktop, but this setup seems to automatically connect with not much effort. Maybe click on the up/down arrows in the upper right hand corner gets Wi-Fi stuff started going for you. wb7odyfred I need to later add some graphical pictures of the desktop Wi-Fi setup configuration.



For FreeBSD 12.0 Current r307529 Mon Oct 17 20:38:24 2016 UTC Here are some information web URLS to look at.
http://marc.info/?l=freebsd-current&m=1 ... 504202&w=2 Notification of rtwn driver for FreeBSD
https://svnweb.freebsd.org/base?view=re ... ion=307529 SVN notification in revision 307529
the RTWN source code is available on https://github.com/s3erios/rtwn repository.
For FreeBSD 12.0 Current r310386M : Thu Dec 22 19:08:02 PST 2016 use commands below.
su root
password:

Code: Select all

kldstat
kldload if_rtwn if_rtwn_usb
kldstat
#create rtwn0 device
ifconfig wlan0 create wlandev rtwn0
# 3 Files to edit/add configuration lines inside them /boot/loader.conf /etc/rc.conf /etc/wpa_supplicant.conf
#/boot/loader.conf

Code: Select all

if_rtwn_load="YES"
if_rtwn_usb_load="YES"
legal.realtek.license_ack=1

#/etc/rc.conf add 2 lines for Edimax EW-7811utn

Code: Select all

wlans_rtwn0="wlan0"
ifconfig_wlan0="WPA DHCP"
#/etc/wpa_supplicant.conf for an Open Network connection

Code: Select all

network={
 	ssid="innflux"
        key_mgmt=NONE
}
# or this Network card configuration by Networkmgr added to /etc/rc.conf file
# I needed channel 6, WifiMgr application program looks for "WPA" to determine wireless lan devices

Code: Select all

wlans_rtwn0="wlan0"
ifconfig_wlan0=" WPA channel 6 DHCP"
Now open a MATE terminal and login as super user root. Try the next two lines
#su root
password:

#create rtwn0 device

Code: Select all

ifconfig wlan0 create wlandev rtwn0
#Bringing up will load the firmware automatically. Then scan for local WiFi access points.

Code: Select all

ifconfig wlan0 up scan
Now your wifi nano usb dongle or your internal wifi pci device should be operational.,

Re: Edimax EW-7811un Wifi USB nano dongle; initial setup ste

Posted: Sat Nov 12, 2016 6:46 pm
by wb7odyfred
Well post first, then remember what steps you forgot to include. OOPS!

#check if your wifi kernel driver is loaded for Edimax EW-7811un, if_urtwn.ko
root@kliktel:/etc #

Code: Select all

 kldstat
Id Refs Address Size Name
1 66 0xffffffff80200000 1cdb000 kernel
2 2 0xffffffff821a8000 a231 opensolaris.ko
3 1 0xffffffff821b4000 2f0bde zfs.ko
4 1 0xffffffff82621000 a9ee linprocfs.ko
5 3 0xffffffff8262c000 7aff linux_common.ko
6 1 0xffffffff82634000 fb6d geom_mirror.ko
7 1 0xffffffff82644000 fc46 geom_journal.ko
8 1 0xffffffff82654000 10585 geom_eli.ko
9 1 0xffffffff82665000 3de28 linux.ko
10 1 0xffffffff826a3000 17dba if_urtwn.ko
11 1 0xffffffff826bb000 389e7 linux64.ko
12 1 0xffffffff826f4000 ea30 iscsi.ko
13 1 0xffffffff82703000 978af i915kms.ko
14 1 0xffffffff8279b000 5518b drm2.ko
15 4 0xffffffff827f1000 26e2 iicbus.ko
16 1 0xffffffff827f4000 1c71 iic.ko
17 1 0xffffffff827f6000 1e6d iicbb.ko
#need to load the kernel module if not already loaded into kernel memory space.

Code: Select all

kldload  if_urtwn.ko
#/boot/loader.conf maybe modify to add the legal.realtek.license_ack=1 line
if_urtwn_load="YES"
legal.realtek.license_ack=1
#check that the Wifi wlan0 interface is up and that networking is operational by pinging a website http://www.ghostbsd.org or http://he.net
root@kliktel:/etc #

Code: Select all

ping -c 3 http://www.ghostbsd.org
PING http://www.ghostbsd.org (192.99.188.34): 56 data bytes
64 bytes from 192.99.188.34: icmp_seq=0 ttl=49 time=151.347 ms
64 bytes from 192.99.188.34: icmp_seq=1 ttl=49 time=211.204 ms
64 bytes from 192.99.188.34: icmp_seq=2 ttl=49 time=137.505 ms

--- http://www.ghostbsd.org ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 137.505/166.685/211.204/31.983 ms
root@kliktel:/etc #
root@kliktel:/etc #

Code: Select all

 dmesg | tail -10
ugen1.3: <vendor 0x0bda> at usbus1
urtwn0: <vendor 0x0bda product 0x8191, class 0/0, rev 2.00/2.00, addr 3> on usbus1
urtwn0: MAC/BB RTL8188CUS, RF 6052 1T1R
urtwn0: enabling 11n
wlan0: Ethernet address: 74:da:38:70:0b:85
wlan0: link state changed to UP
That should show the urtwn0 driver connected with the USB nano WiFi dongle Edimax EW-7811un

Re: Edimax EW-7811un Wifi USB nano dongle; 10.3 & 11.0 setup

Posted: Wed May 24, 2017 3:37 pm
by ASX
By June 9 should be released the first beta of FreeBSD 11.1.
It would be interesting to know if the updated urtwn driver has been backported to FreeBSD-11.1. ;)